cpptensor/Build options
Build options
The full set of cpptensor CMake toggles — build profiles, feature flags, sanitizers, and warning policy.
cpptensor exposes its configuration through CMake options. Pass them as
-D<OPTION>=<VALUE> at configure time.
Build profiles
- Profiles:
Debug,Release,RelWithDebInfo. - Single-config generators default to
RelWithDebInfoifCMAKE_BUILD_TYPEis omitted.
Target toggles
| Option | Default | Description |
|---|---|---|
CPPTENSOR_BUILD_TESTS | OFF | Build the Catch2 test suite. |
CPPTENSOR_BUILD_EXAMPLES | OFF | Build example binaries. |
CPPTENSOR_BUILD_BENCHMARKS | OFF | Build Google Benchmark targets. |
Backend feature flags
| Option | Default | Description |
|---|---|---|
USE_OPENBLAS | ON | BLAS-backed matmul/dot; required for svd/eig. |
BUILD_AVX2 | auto | AVX2-specialized kernels (fails if forced on unsupported targets). |
BUILD_AVX512 | auto | AVX-512-specialized kernels (same guardrail). |
BUILD_CUDA | OFF | Early CUDA support; forced OFF on Apple platforms. |
USE_STD_SIMD | — | Declared in CMake but not currently wired as an active backend toggle. |
Developer toggles
| Option | Description |
|---|---|
CPPTENSOR_ENABLE_PROFILING | Profiling-friendly frame-pointer settings. |
CPPTENSOR_ENABLE_LTO | Interprocedural optimization for Release/RelWithDebInfo when supported. |
CPPTENSOR_ENABLE_GPERFTOOLS | Link example binaries with libprofiler when available. |
Safety: warnings & sanitizers
| Option | Description |
|---|---|
CPPTENSOR_ENABLE_STRICT_WARNINGS | Stricter warning profile on cpptensor-owned targets. |
CPPTENSOR_WARNINGS_AS_ERRORS | Promote warnings to errors. |
CPPTENSOR_ENABLE_ASAN | AddressSanitizer. |
CPPTENSOR_ENABLE_UBSAN | UndefinedBehaviorSanitizer. |
CPPTENSOR_ENABLE_TSAN | ThreadSanitizer. |
Sanitizer constraints
Sanitizers support GCC/Clang-style toolchains. ASAN and TSAN are mutually
exclusive, and sanitizer mode currently requires BUILD_CUDA=OFF.
Warning policy is compiler-specific and scoped to cpptensor-owned targets only:
- GCC/Clang/AppleClang:
-Wall -Wextra -Wpedantic -Wformat=2 -Wnull-dereference -Wnon-virtual-dtor - MSVC:
/W4 /permissive- - With
CPPTENSOR_WARNINGS_AS_ERRORS=ON,-Werror//WXis added for the same scoped targets.
Example: sanitizer build
conda run -n cpptensor cmake -S . -B build-sanitize -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCPPTENSOR_BUILD_TESTS=ON \
-DBUILD_CUDA=OFF \
-DUSE_OPENBLAS=OFF \
-DCPPTENSOR_ENABLE_ASAN=ON \
-DCPPTENSOR_ENABLE_UBSAN=ON
conda run -n cpptensor cmake --build build-sanitize -j
conda run -n cpptensor ctest --test-dir build-sanitize --output-on-failureCI runs a sanitizer-warning-gate job that combines ASAN + UBSAN + strict
warnings-as-errors and then runs the full CTest suite.