Building from Source
Build MAG with CMake and the repository presets.
Prerequisites
Install the following tools before configuring the project:
A modern C++ compiler with C++20 modules support:
Clang 18+
GCC 15+
MSVC 19.40+
CMake 3.28.3+
Ninja
Python 3 when development tooling is enabled
The bundled presets assume Ninja and create build directories under build/.
Quick start with presets
Choose the preset that matches your toolchain:
Preset |
Typical use |
|---|---|
clang-debug |
Clang debug build |
clang-release |
Clang release build |
gcc-debug |
GCC debug build |
gcc-release |
GCC release build |
msvc-debug |
MSVC debug build |
msvc-release |
MSVC release build |
Example with Clang:
cmake --preset clang-release -DMAG_NO_DEV_TOOLS=ON
cmake --build --preset clang-release
To run the test suite for a preset-enabled build:
ctest --preset clang-release --output-on-failure
Build Options
Platform notes
On x86 and x86_64 targets, MAG enables SSE-family compile options for SIMD builds.
MAG_SIMD_BACKENDsupportsAUTO,SSE2,SSSE3, andSSE4_1on x86/x64.On ARM targets, MAG selects the NEON backend when available.
MAG_SIMD_BACKENDsupportsAUTOandNEONon ARM/ARM64.The selected backend emits one compile definition:
MAG_SIMD_BACKEND_SSE2,MAG_SIMD_BACKEND_SSSE3,MAG_SIMD_BACKEND_SSE4_1, orMAG_SIMD_BACKEND_NEON.On unsupported architectures, MAG disables SIMD backends automatically and falls back to scalar implementations in the cmake file. - If the project is compiled with SIMD enabled on an unsupported architecture/backend, it will result in a compilation failure.
Development tooling is only configured for top-level builds when
MAG_NO_DEV_TOOLSis left disabled.
Next step
Once MAG builds successfully, continue with Integrating MAG to link it into another project.