Sunday 15 April 2012

Using QuantLib on the iPad: Part I - Build Boost


Using QuantLib on iOS is done in three steps:

  • Build Boost for iOS
  • Build QuantLib for iOS
  • Interface QuantLib (written in C++) to Objective-C

So, to use QuantLib I first need to build the boost libraries. Fortunately there are a lot of blog posts around which describe what needs to be done to get this working on under iOS - I need to build it for the iOS simulator under i386 and on the iPad/iPhone under the arm chipset.

The best way to do this is to bundle the Boost libraries and header files in single package via a frameworkPete Goodliffe has an excellent guide to on how to do this and has provided the scripts on gitorious. However, the current version of Boost does not work correctly with Objective-C. Fortunately, Arne has provided a fix and has updated the scripts to work using the latest version of xcode (4.3) as Apple have completely changed where all the development executables live to /Application/Xcode.app/Contents/Developer. This version of the script is available on github.

It's not hard to obtain and build the Boost libraries using the script. This creates a framework (library) that can be included in an IOS application that makes development very simple.

Once built, the framework is then included in the build, as below.


There is no need to setup include paths and link libraries as the framework takes care of all this.

One thing to note is that the script builds the basic Boost library. If you want to build anything else, such as the boost unit test framework (UTF), you'll need to alter the script. It's not a configuration change in the script and requires some extra bjam commands to be run and the object files linked into the library. I'll do this at some point as QuantLib uses the UTF for it's unit testing, but at the moment it is not a priority for me.

No comments:

Post a Comment