How to upload to biicode. Example 4: Oscpack by Ross Bencina

Updated for biicode 2.0!

As the headline states, this is the fourth example about how to upload libraries to biicode.  If you’ve done this kind of thing before, keep reading, we’ll explain how to upload Oscpack lib. Otherwise, you may be interested on reading first any previous articles of the series:

Upload to biicode Oscpack

Oscpack is a set of C++ classes for packing and unpacking Open Sound Control (OSC) packets. Developed by Ross Bencina, Oscpack proved to be an essential library requested in our forum. As Ross Bencina explains, Oscpack includes a minimal set of UDP networking classes for Windows and POSIX. It enables an easy way to construct, send, receive and parse OSC packets.

Basics

Install biicode and make sure you’ve got the latest version of the library you want to use. To keep the biicode version updated, fork or clone the library on a public git repository (as Bitbucket or Github). Oscpack 1.1.0 is available on google code hosting. This guide uses Bitbucket, but the same steps apply to Github and Travis CI fans.

Create a new BIICODE project:

Put the content of the latest version of Oscpack into blocks/mariadeanton/oscpack folder. Adapt the readme file to notify users the specifics of the lib and its biicode adaptation.

Create a new Bitbucket repository:

bitbucket repository

Copy the HTTPS or SSH address as marked in red on the image. You will need this on the steps below to establish a “remote origin”:

Once first commit is pushed the original library is ready to be adapted.

Specifics

A. Check if biicode finds the links between sources

Execute bii deps to get all information related to biicode’s dependency scanning:

biideps1

Seems we’ve got to include the current working directory into dependency search and build.

If you execute:

It won’t compile.

A.1. Create a biicode.conf  file into blocks/username/blockname/ folder

and write into its [paths] section:

 

osc-paths

B. Build and compile

B.1. Ensure original code logic remains

Just with these updates, both biicode and compiler know they should include current source directory, but bii cpp:build can’t compile properly, why is this happening?

Check out the previous CMakeLists.txt, it separates the versions of NetworkingUtils.cpp depending on whether the OS is Win32 or POSIX based. It also includes winmm library when using Win32 . As Ross Bencina himself explains “the IpSystemTypePath selects the correct ones based on the current platform”.

Update your CMakeLists.txt to ignore posix folder content while on Win32 and vice versa. It also adds a line after ADD_BIICODE_TARGETS to link winmm lib on Win32:

B.2. See for yourself what’s going on

Execute:

(A successful build happens on POSIX OS but not on Win32)
Let’s check the bii_username_blockname_vars.cmake file located into the cmake folder on your project. You can see all source code files linked here.
cmake

There it is! ip/win32/UdpSocket.cpp is missing.

B.3. Manually specify dependencies

Establish a dependency between ip/UdpSocket.h and ip/win32/UdpSocket.cpp just writing in the [dependencies] section of your biicode.conf file:

 

osc-dependencies

Save all changes and you’re ready to go!

C. Publish

Push your changes to Bitbucket and publish to biicode, Oscpack library is ready to be reused!

Once you’ve tested Oscpack library on the different OS you can publish it as stable:

D. Enjoy!

Use Oscpack library on biicode. For example, you can include:

If you liked this post please comment below. If you want to try biicode just click on the sidebar button and if you have any doubts check our docs and forum.


Related Posts