-
Notifications
You must be signed in to change notification settings - Fork 0
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
,pacman
etc - For other needed tools, see INSTALL-CMake.md
- Clone a Macaulay2 repository, e.g.
git clone https://github.com/Macaulay2/M2.git
or your own fork. -
Add @mahrud's repository as a remote and checkout the feature/cmake branchmerged now
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.
- 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-core
to build the M2 executable and the core package -
Run
ninja install-packages
to install all packages, andninja install
to install Macaulay2 on the system. -
Run
ctest -R [keyword] -j4
to 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.
-
Home
- Introduction
- Macaulay2 Contribution Guides
- Macaulay2 Workshop Guides
-
Macaulay2 Internals
- Building Macaulay2 from source
- Components of Macaulay2
- Case Studies
- Web servers
- Other
- Frequently Asked Questions
- Road map