Soeren Sonnenburg edited this page Aug 27, 2014 · 1 revision
Clone this wiki locally
  • Getting a list of possible interfaces to enable:
$ grep -E "OPTION.*(Modular|Static)" CMakeLists.txt
  • If eigen3 or json-c are missing use the following to download and compile these dependencies:
  • CMake setup for developers (debugging symbols on, optimization off, etc.):
$ mkdir build-debug
$ cd build-debug
  • Specify a different swig executable:
$ cmake -DSWIG_EXECUTABLE=/usr/bin/swig2.0
  • Setup CMake for building the final binaries (debugging off, optimization on):
$ mkdir build-release
$ cd build-release
  • Compile everything and install:
$ make -j GoogleMock # only needed on first build: fetch and compile GoogleMock
$ make -j all # compiling everything
$ make -j install # install required for "make test"
$ make -j test # compile and run all tests and examples
  • Alternative build targets:
$ make -j shogun # only compiling libshogun
$ make -j shogun-unit-test # build unit test binary
$ make -j unit-tests # build and run unit tests
  • Testing/debugging:
$ ctest -D ExperimentalMemCheck # runs all tests with valgrind (depends on -DBUILD_DASHBOARD_REPORTS=ON)
$ cd tests/unit && valgrind --leak-check=full ./shogun-unit-test --gtest_filter=EPInferenceMethod.get_cholesky_probit_likelihood
$ cd tests/unit && valgrind --leak-check=full ./shogun-unit-test --gtest_filter=EPInferenceMethod.*
$ CC=/path/to/gcc CXX=/path/to/g++ cmake ..
  • Under OS X one often has the same Python major versions installed in /usr and /usr/local via brew etc, so one might observe crashes if the wrong Python version is linked against. To use a custom Python installation for Python bindings one would under brew use:
$ cmake -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Headers -DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib  -DPythonModular=ON ..

or, in general:

$ cmake -DPYTHON_INCLUDE_DIR=/path/to/python/include/dir -DPYTHON_LIBRARY=path/to/python/ ..
  • Under Linux, one may need to switch between different versions of Python, in which case the following options need to be included: -DPYTHON_EXECUTABLE:FILEPATH=/path/to/python/version, -DPYTHON_INCLUDE_DIR=/path/to/includes and -DPYTHON_PACKAGES_PATH=/path/to/dist/packages

For example:

cmake -DPYTHON_INCLUDE_DIR=/usr/include/python3.3 -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 -DPYTHON_PACKAGES_PATH=/usr/local/lib/python3.3/dist-packages -DPythonModular=ON ..