-
Notifications
You must be signed in to change notification settings - Fork 260
Internals: CMake build system
CMake is a meta-build system. Instead of running ./configure and make, we use cmake and ninja
- Mac:
brew install cmake - Linux: use your package manager:
apt,dnf,pacmanetc - For other needed tools, see INSTALL-CMake.md
- Clone a Macaulay2 repository, e.g.
git clone https://github.com/Macaulay2/M2.gitor your own fork. - Add @mahrud's repository as a remote and checkout the cmake branch
git remote add mahrud https://github.com/mahrud/M2.git
git fetch mahrud
git checkout feature/cmake
Note: make sure the source directory does not contain any in-source build artifacts by running make clean distclean from the source directory. Note that this is cleaning artifacts from the configure build system.
2. Move to the build directory and run cmake
cd M2/M2/BUILD/build
cmake -GNinja -S../.. -B. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
Note: If you're on a Mac, you might have to use
CC=/path/to/gcc CXX=/path/to/g++ cmake -GNinja -S../.. -B. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
You can confirm the versions with gcc --version. Versions above 7 have been tested. There are known issues with AppleClang, so avoid that if possible.
-
Run
ninja build-libraries. This has to come first! -
Run
ninja M2-binary M2-coreto build the M2 executable and the core package -
Run
ninja install-packagesto install all packages, andninja installto install Macaulay2. -
Run
ctest -R [keyword] -j4to run the tests with the given keyword. Tryunit-tests,normal,check,check-Elimination, orcheck-Elimination-0.
Other flags and build targets are available, see INSTALL-CMake.md for details.
Issue: ninja fails with an error fatal error: givaro/modular-double.h: No such file or directory even though the givaro package is installed.
Solution: run ninja build-givaro to force building givaro.
Issue: ninja fails with an error engine.h:84:3: error: ‘gmp_arrayZZ’ does not name a type; did you mean ‘gmp_newZZ’.
Solution: run make clean distclean from the source directory. This cleans the build artifacts from an in-source build with the configure system.
Homepage | Projects | Packages | Documentation | Events | Google Group