Loading...
Searching...
No Matches
Build from source

Describes how to compile and install idol from source.

Requirements

To build idol and idol_cl from source, you need:

  • CMake ≥ 3.22
  • C++20 compiler (GCC or Clang)
  • Git

You can verify your tools with:

cmake --version
g++ --version
clang++ --version
git --version

Build instructions

Follow these steps to compile and install idol.

Step 1 — Clone the repository

git clone https://github.com/hlefebvr/idol.git

Step 2 — Create a build directory

mkdir -p idol/build
cd idol/build

Using a separate build directory keeps the source tree clean.

Step 3 — Configure and build

cmake ..
cmake --build .

This compiles the idol library and the idol_cl executable.

Step 4 — Install

sudo cmake --install .

By default, this installs files into:

/usr/local/bin
/usr/local/lib
/usr/local/include

Step 5 — Verify installation

idol_cl --version

If the command prints the version, the installation was successful.

CMake Options

You can customize the build using CMake options.

Enable MibS support

MibS is a mixed-integer linear solver that can be integrated in idol.

When installing via package managers (apt-get or brew), it is included automatically.
When building from source, you must install it on your own, enable and configure it manually.

First, install MibS by following the instructions on the official MibS documentation. Then either:

  • set the environment variable:
export COIN_OR_HOME=/path/to/coin-or/dist
  • or pass the directory directly to CMake with the option COIN_OR_DIR.

Finally, enable MibS with the CMake option USE_MIBS=ON.

cmake -DUSE_MIBS=ON -DCOIN_OR_DIR=/path/to/coin-or/dist ..

Both COIN_OR_HOME and COIN_OR_DIR must point to the COIN-OR dist directory.

Enable Cgl support

Cgl is a cut generation library from coin-or. It can be used by idol to generate cutting planes in a branch-and-bound algorithm.

When installing via package managers (apt-get or brew), Cgl is included automatically.
When building from source, you must install it on your own, enable and configure it manually.

First, install Cgl from source followin the instructions on the official Cgl documentation. Namely, do as follows

mkdir coin-or
cd coin-or
wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew
chmod u+x coinbrew
./coinbrew fetch Cgl@master
./coinbrew build Cgl

Then either:

  • set the environment variable:
export COIN_OR_HOME=/path/to/coin-or/dist
  • or pass the directory directly to CMake with the option COIN_OR_DIR.

Finally, enable Cgl with the CMake option USE_CGL=ON.

cmake -DUSE_CGL=ON -DCOIN_OR_DIR=/path/to/coin-or/dist ..

Both COIN_OR_HOME and COIN_OR_DIR must point to the COIN-OR dist directory.

Custom installation directory

To install into a custom location, set:

cmake -DCMAKE_INSTALL_PREFIX=/custom/install/path ..

Example:

cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local ..

The executable will be installed into:

$HOME/.local/bin/idol_cl

Build examples

To build the example programs:

cmake -DBUILD_EXAMPLES=ON ..

Build tests

To build the test suite:

cmake -DBUILD_TESTS=ON ..