Swing and Quantlib on a Mac

Finally switched away from windows and have quantlib and swing options working on Macbook Pro, The steps taken to get here were:

  • Install xcode command tools available from the preference tab, this will provide all the required gcc tools
  • First few attempts to use xcode to compile quantlib completely trashed our /usr/local/include and for some reason also the /usr/local/lib folder, decided to leave xcode out of the picture for now. Although, eventually did get quantlib to build as a static library, but yet to test the result.
  • Download eclipse juno sr1 64-bit CDT for mac os
  • Install the R package for mac, this can be obtained from the r-project.org site, this is a simple dmg file and installs without any issues. Install the R plugins Rcpp and RInside, both are required for integrating R into c++.  If one is feeling brave R can also be built from source, although you will also need a fortran compiler, such as, gfortran. This will also work but it is really unnecessary.
  • Install the GNU Linear Programming Kit, which can be downloaded from here. The installation is the standard ./configure, make, and make install process. Although care must be taken to ensure the correct libraries are prefixed in the configure phase.
  • Install the boost c++ libraries source from here. The installation is,
  1. ./bootstrap  (you can follow this command with the prefix of the installation library)
  2. ./b2
  3. ./b2 install
  • The above steps will setup all the pre-requisites for the real work to come

Download the quantlib source from here.

  • create a new c++ project called QuantLib (not as an application but a static library, since the library is to be linked to the application in the next step)
  • create a source folder called ql into which must be copied all the files from the folder of the same name in the downloaded source
  • configure the project and build the static library for quantlib.

We will test the result by building the chart generated from the code found in the blog Linear vs Dynamic Programming I. An excellent learning place for options and all things related.

  • create a new c++ application
  • create the source file and copy the downloaded code from the site mentioned above
  • configure the project, all configuration information is available in the gallery below

This slideshow requires JavaScript.

plotchart

Once the application is built and run, you will find the chart in the debug folder of the project as a pdf file, plot.pdf. This environment, once setup can become an excellent self learning aid.

About KM Mukku

Kick-start, build and manage teams in product development (particularly in the financial domain), and enjoy all in adaptive case management, business process design and business process improvement. Currently holding the position of CTO at coMakeIT.
This entry was posted in eclipse-cdt, energy, options, quantlib, xcode and tagged , . Bookmark the permalink.

2 Responses to Swing and Quantlib on a Mac

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s