On Windows, configure Ninja (installed with MSVC) before performing the build.
Open the command prompt and navigate to the aocl-libm directory.
Run the following command, replacing “Path_To_VisualStudio” with the actual path where Visual Studio is installed:
“Path_To_VisualStudio\VCAuxiliary\Build\vcvarsall.bat” x64
To list CMake configuration preset names:
$ cmake --list-presets
To configure CMake, select any preset name from --list-presets:
$ cmake --preset dev-release-gcc --fresh
To build, select the corresponding config preset name from --build --list-presets:
$ cmake --build --preset dev-release-gcc
To build the library in parallel:
$ cmake --build --preset dev-release-gcc -j<number_of_parallel_builds>
To build the library in verbose mode:
$ cmake --build --preset dev-release-gcc -v
Note
By default, AOCL-LibM builds a fat binary that uses dynamic dispatch to run on machines with different x86 architectures (AVX2 and above). If you want a lightweight binary targeting a specific architecture, you can build with STATIC_DISPATCH. See Dynamic Dispatch for details on the default runtime dispatch behavior.
To configure CMake for STATIC_DISPATCH:
Available options for ALM_STATIC_DISPATCH:
Option Value |
Code Path |
Minimum CPU Requirement |
|---|---|---|
|
ZEN2 optimized |
AMD Zen 2 |
|
ZEN3 optimized |
AMD Zen 3 |
|
ZEN4 optimized |
AMD Zen 4 |
|
ZEN5 optimized |
AMD Zen 5 |
|
ZEN2 optimized |
AMD Zen 2 |
|
Portable AVX-512 |
Any CPU with AVX-512 support |
Example:
$ cmake --preset dev-release-gcc -DALM_STATIC_DISPATCH=ZEN3 --fresh
Note
The compiled library should only be executed on machines that match the target architecture specified during compilation (e.g., ZEN3 binaries should run on ZEN3-compatible processors).
CMake-built aocl-libm library is installed only in release mode
and the aocl-libm library is installed in build/{presetName}.