making shogun with cmake

[Reposted from Shogun’s mailing list]

default is libshogun.

run, within a build directory inside shogun/, cmake ..

if testing is required, run cmake -DENABLE_TESTING=ON .. and then make and run ctest –output-on-failure, this will run the tests as well as unit-tests.

If valgrind check is needed, run cmake -DENABLE_TESTING=ON -DBUILD_DASHBOARD_REPORTS=ON .. and run ctest –output-on-failure. this will run valgrind on all the tests. If only unit-testing is required, then use ctest -R unit. If verbose is required, then run it with ctest -V (or -VV) -R unit.

alternatively,  just use -DENABLE_TESTING=ON and run valgrind on any suspected test

valgrind “-q” “–tool=memcheck” “–leak-check=yes” “–show-reachable=yes” “–workaround-gcc296-bugs=yes” “–num-callers=50” ./tests/unit/shogun-unit-test “–gtest_filter=SparseMatrixOperator.*”

To build it for another interface, refer to Viktor’s mail which is –

this will build you libshogun, without interfaces. if you want modular interfaces then you have to turn it on, either with cmake cmd argument or with cmake gui. e.g. if you want python modular interface:
cmake -DPythonModular=ON ..

the defines for the various interfaces:
. .. python modular: -DPythonModular=ON
. .. ruby modular: -DRubyModular=ON
. .. octave modular: -DOctaveModular=ON
. .. csharp modular: -DCSharpModular=ON
. .. python modular: -DJavaModular=ON
. .. lua modular: -DLuaModular=ON

there are some other funky defines like:
. .. -DENABLE_TESTING=ON  turns on unit testing and all the example (compilation) and run for the interfaces you’ve chosen to compile.
NOTE: for running the tests, after a successful ‘make’ instead of the old ‘make tests’ use ctest:
ctest –output-on-failure

. .. -DBUNDLE_EIGEN=ON your system does not ship the right eigen version (3.1.2 or later)? just use this define, and cmake will automagically download/compile and bundle eigen 3.1.4 into shogun

. .. -DBUNDLE_JSON=ON same as the previous case just with libjson-c

and now something more…FANCY!
cmake comes with a nice cpack utility that basically can generate all kinds of packages, not only .tar.gz and .tar.bz2 but like debian’s .deb or redhat’s rpm, osx’ mpkg etc. so hopefully with this we soon be able to ship various nightly built binary packages for you.
of course this work is still under progress…. if you want it sooner, come and help us, so we can get it for you sooner.

anyways, enjoy!
and of course if you run into some problems while trying to cmake shogun, just write here on the mailing list or come to the irc channel and ask somebody!


Hi Klye

your best bet is to use cmake gui, i.e. ccmake on UNIX systems.
there you can browse through the possible options, and i’ve written a small description for all the possible options.
for the 2 things you were looking for:

–disable-svm-light  in cmake is -DUSE_SVMLIGHT=OFF
–enable-svm-light  in cmake is -DUSE_SVMLIGHT=ON

–enable-swig-directors is -DUSE_SWIG_DIRECTORS=ON

we are in progress with updating the ./src/INSTALL file where we’d describe things in more detail than my little email.


Leave a Reply

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

You are commenting using your 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