pagmo is written in modern C++, and it requires a compiler able to understand at least C++17. pagmo is known to run on the following setups:
GCC 7 and later versions on GNU/Linux,
Clang 4 and later versions on GNU/Linux,
MSVC 2015 and later versions on Windows,
Clang 4 and later versions on Windows (with the
clang-cldriver for MSVC),
MinGW GCC 8 on Windows,
Clang on OSX (Xcode 6.4 and later),
Clang on FreeBSD.
The pagmo C++ library has the following mandatory dependencies:
Additionally, pagmo has the following optional dependencies:
Additionally, CMake is the build system used by pagmo and it must also be available when installing from source (the minimum required version is 3.3).
pagmo packages are available from a variety of package managers on several platforms.
pagmo, which contains the pagmo shared library,
pagmo-devel, which contains the pagmo headers and the CMake support files.
In order to install pagmo via conda, you just need to add
to the channels, and then we can immediately install pagmo:
$ conda config --add channels conda-forge $ conda config --set channel_priority strict $ conda install pagmo pagmo-devel
The conda packages for pagmo are maintained by the core development team, and they are regularly updated when new pagmo versions are released.
Please refer to the conda documentation for instructions on how to setup and manage your conda installation.
pagmo is also available on the Arch User Repository (AUR) in Arch Linux. It is recommended to use an AUR helper like yay or pikaur for ease of installation. See the AUR helpers page on the Arch Linux wiki for more info.
To install pagmo with optional dependency support like nlopt or ipopt, make sure to install the optional dependencies before installing the pagmo package.
Install optional dependencies:
$ yay -S coin-or-ipopt eigen nlopt
$ yay -S pagmo
A FreeBSD port via pkg has been created for pagmo. In order to install pagmo using pkg, execute the following command:
$ pkg install pagmo2
Installation from source¶
After making sure the dependencies are installed on your system, you can
download the pagmo source code from the
GitHub release page. Alternatively,
and if you like living on the bleeding edge, you can get the very latest
version of pagmo via
$ git clone https://github.com/esa/pagmo2.git
We follow the usual PR-based development workflow, thus pagmo’s
branch is normally kept in a working state.
After downloading and/or unpacking pagmo’s
source code, go to pagmo’s
source tree, create a
build directory and
cd into it. E.g.,
on a Unix-like system:
$ cd /path/to/pagmo $ mkdir build $ cd build
Once you are in the
build directory, you must configure your build
cmake. This will allow you to enable support for optional
dependencies, configure the install destination, etc.
The following options are currently recognised by pagmo’s build system:
PAGMO_BUILD_TESTS: build the test suite (defaults to
PAGMO_BUILD_TUTORIALS: build the C++ tutorials (defaults to
PAGMO_WITH_EIGEN3: enable features depending on Eigen3 (defaults to
PAGMO_WITH_NLOPT: enable the NLopt wrappers (defaults to
PAGMO_WITH_IPOPT: enable the Ipopt wrapper (defaults to
Additionally, there are various useful CMake variables you can set, such as:
CMAKE_BUILD_TYPE: the build type (
Debug, etc.), defaults to
CMAKE_INSTALL_PREFIX: the path into which pagmo will be installed (e.g., this defaults to
/usr/localon Unix-like platforms).
CMAKE_PREFIX_PATH: additional paths that will be searched by CMake when looking for dependencies.
Please consult CMake’s documentation for more details about CMake’s variables and options.
A typical CMake invocation for pagmo may look something like this:
$ cmake ../ -DPAGMO_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=~/.local
That is, we build the test suite and we
will be installing pagmo into our home directory into the
subdirectory. If CMake runs without errors, we can then proceed to actually
$ cmake --build .
This command will build the pagmo library and, if requested, the test suite. Next, we can install pagmo with the command:
$ cmake --build . --target install
This command will install the pagmo library and header files to
the directory tree indicated by the
If enabled, the test suite can be executed with the command:
$ cmake --build . --target test
On Windows, in order to execute the test suite you have to ensure that the
PATH variable includes the directory that contains the pagmo
DLL (otherwise the tests will fail to run).