List of CMake Options
This page contains a list of all CMake options that can be used to configure idol. In particular, this is useful to link idol with external solvers.
Linking with External Solvers
Gurobi (Commercial Solver)
To link with Gurobi, you will need to pass the USE_GUROBI
CMake option with value YES
.
By default, CMake will look for Gurobi inside the folder indicated by the environment variable GUROBI_HOME
(see this official Gurobi page).
Note that it is also possible to pass the CMake option GUROBI_DIR=/path/to/gurobi/install/dir
in order to specify
another directory to look for Gurobi.
Example
The following will create an install
target which will install idol with Gurobi.
cmake -DUSE_GUROBI=YES -DGUROBI_DIR=/path/to/gurobi/install/dir ..
If you are doing a local installation, then the same can be achieved as follows.
set(USE_GUROBI YES)
set(GUROBI_DIR /path/to/gurobi/install/dir)
Mosek (Commercial Solver)
To link with Mosek, you will need to pass the USE_MOSEK
CMake option with value YES
.
By default, CMake will look for Mosek inside the folder indicated by the environment variable MOSEK_HOME
.
Note that it is also possible to pass the CMake option MOSEK_DIR=/path/to/mosek/install/dir
in order to specify
another directory to look for Mosek.
Note that MOSEK_HOME
(or equivalently MOSEK_DIR
) should point to the Mosek installation folder where
folders h
and bin
can be found. For instance, MOSEK_HOME=/home/<MY_USERNAME>/mosek/10.0/tools/platform/linux64x86
.
Example
The following will create an install
target which will install idol with Mosek.
cmake -DUSE_MOSEK=YES -DMOSEK_DIR=/path/to/mosek/install/dir ..
If you are doing a local installation, then the same can be achieved as follows.
set(USE_MOSEK YES)
set(MOSEK_DIR /path/to/mosek/install/dir)
Attention
If you intend to use Mosek for solving QPs or SOCPs, please read this.
GLPK (Open-Source Solver)
To link with GLPK, you will need to pass the USE_GLPK
CMake option with value YES
.
By default, CMake will look for GLPK inside the folder indicated by the environment variable GLPK_HOME
as well
as in the default installation folders /usr/include
and /usr/lib
.
Note that it is also possible to pass the CMake option GLPK_DIR=/path/to/glpk/install/dir
in order to specify
another directory to look for GLPK.
Example
The following will create an install
target which will install idol with GLPK.
cmake -DUSE_GLPK=YES -DGLPK_DIR=/path/to/glpk/install/dir ..
If you are doing a local installation, then the same can be achieved as follows.
set(USE_GLPK YES)
set(GLPK_DIR /path/to/glpk/install/dir)
HiGHS (Open-Source Solver)
To link with GLPK, you will need to pass the USE_HIGHS
CMake option with value YES
.
By default, CMake will look for HIGHS inside the default installation folders /usr/include
and /usr/lib
.
Note that it is also possible to pass the CMake option HIGHS_DIR=/path/to/highs/install/dir
in order to specify
another directory to look for GLPK.
Example
The following will create an install
target which will install idol with GLPK.
cmake -DUSE_HIGHS=YES -DHIGHS_DIR=/path/to/glpk/install/dir ..
If you are doing a local installation, then the same can be achieved as follows.
set(USE_HIGHS YES)
set(HIGHS_DIR /path/to/glpk/install/dir)
Building Examples
Examples : can be found at the root level of the idol repository, inside the directory examples
.
By default, CMake will not generate targets to build these example. To tell CMake to generate these, you
need to set the CMake option BUILD_EXAMPLE
to YES
.
Example
The following will tell CMake to create targets for examples.
cmake -DBUILD_EXAMPLES=YES ..
For instance, we can now build the Knapsack Problem example,
make example_knapsack
and run it.
cd examples && ./example_knapsack
Other optional dependencies
Using martinus/robin-hood-hashing hash map
Internally, idol uses unordered maps (also called hash maps).
Unfortunately, the default std
implementation is not the best choice when
it comes to performance. To avoid this, if found relevant, users can tell idol to use the hash-map implementation of
martinus/robin-hood-hashing. It’s actually a header-only library, so
all you have to do is to tell CMake where the robin_hood.hpp
file is. This is done through the CMake option
ROBINHOOD_DIR=/path/to/robin_hood/folder
together with USE_ROBINHOOD=YES
.
Note that, if ROBINHOOD_DIR
is not specified, robin_hood.hpp
is searched for in /usr/include
,
/usr/include/robin_hood/
, /usr/local/include/
, /usr/local/include/robin_hood/
and in the path
stored in the environment variable ROBINHOOD_HOME
.
Example
The following will create an install
target which will install idol with martinus’s robin_hood hash map
implementation.
cmake -DUSE_ROBINHOOD=YES -DROBINHOOD_DIR=/path/to/robin_hood/folder ..
Using Eigen
Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. It is internally used by idol for some of its functionalities. In particular, this is necessary for solving QPs and SOCPs with the Mosek solver.
Since Eigen is a header-only library, all you have to do is to tell CMake where the Eigen
folder is. This is done
through the CMake option EIGEN_DIR=/path/to/eigen/folder
together with USE_EIGEN=YES
.
Example
The following will create an install
target which will install idol with Eigen.
cmake -DUSE_EIGEN=YES -DEIGEN_DIR=/path/to/eigen/folder ..
Building Unit and Integration Tests
To build tests for idol, please refer to this developer page.