UltrafastSecp256k1/CMakePresets.json
shrec 474b9191ea
build: add arm64-cross and riscv64-cross CMake presets
Both cross-toolchains (aarch64-linux-gnu-gcc, riscv64-linux-gnu-gcc) are
confirmed to produce clean Release builds with bench_unified + test suite:
  ARM64:   ELF 64-bit AArch64 (armv8-a), bench_unified + run_selftest
  RISC-V:  ELF 64-bit rv64gc_zba_zbb + lp64d, bench_unified + run_selftest

Usage:
  cmake --preset arm64-cross  -S libs/UltrafastSecp256k1 -B build-arm64
  cmake --preset riscv64-cross -S libs/UltrafastSecp256k1 -B build-riscv64
2026-03-21 10:40:10 +00:00

283 lines
9.6 KiB
JSON

{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "base",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "base-linux",
"hidden": true,
"inherits": "base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "base-windows",
"hidden": true,
"inherits": "base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Ninja"
},
{
"name": "cpu-release",
"displayName": "CPU Release (Safe)",
"description": "CPU-only optimized build with safe defaults (stack protector, FORTIFY_SOURCE active)",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "OFF",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_BUILD_BENCH": "ON",
"SECP256K1_SPEED_FIRST": "OFF"
}
},
{
"name": "cpu-release-speed",
"displayName": "CPU Release (Speed-First, UNSAFE)",
"description": "CPU-only maximum throughput: -Ofast, no stack protector, no FORTIFY_SOURCE. Use only in controlled environments.",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "OFF",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_BUILD_BENCH": "ON",
"SECP256K1_SPEED_FIRST": "ON"
}
},
{
"name": "cpu-debug",
"displayName": "CPU Debug",
"description": "CPU-only debug build",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "OFF",
"SECP256K1_BUILD_TESTS": "ON"
}
},
{
"name": "arm64-cross",
"displayName": "ARM64 Cross (Linux → AArch64)",
"description": "Cross-compile CPU-only release for AArch64/ARM64 using aarch64-linux-gnu-gcc",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../../cmake/arm64-toolchain.cmake",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "OFF",
"SECP256K1_BUILD_OPENCL": "OFF",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_BUILD_BENCH": "ON"
}
},
{
"name": "riscv64-cross",
"displayName": "RISC-V 64 Cross (Linux → rv64gc)",
"description": "Cross-compile CPU-only release for RISC-V 64-bit (rv64gc_zba_zbb) using riscv64-linux-gnu-gcc",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../../cmake/riscv64-toolchain.cmake",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "OFF",
"SECP256K1_BUILD_OPENCL": "OFF",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_BUILD_BENCH": "ON"
}
},
{
"name": "cuda-release",
"displayName": "CUDA Release (Linux)",
"description": "CPU + CUDA GPU optimized build for Linux",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "ON",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_BUILD_BENCH": "ON",
"CMAKE_CUDA_ARCHITECTURES": "native",
"CMAKE_CUDA_SEPARABLE_COMPILATION": "ON"
}
},
{
"name": "cuda-debug",
"displayName": "CUDA Debug (Linux)",
"description": "CPU + CUDA GPU debug build for Linux",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "ON",
"SECP256K1_BUILD_TESTS": "ON",
"CMAKE_CUDA_ARCHITECTURES": "native",
"CMAKE_CUDA_SEPARABLE_COMPILATION": "ON"
}
},
{
"name": "cuda-release-5060ti",
"displayName": "CUDA Release RTX 5060 Ti",
"description": "Optimized for RTX 5060 Ti (SM 8.9)",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "ON",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_BUILD_BENCH": "ON",
"CMAKE_CUDA_ARCHITECTURES": "89",
"CMAKE_CUDA_SEPARABLE_COMPILATION": "ON"
}
},
{
"name": "cpu-asan",
"displayName": "CPU ASan+UBSan",
"description": "CPU debug with AddressSanitizer + UndefinedBehaviorSanitizer",
"inherits": "base-linux",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "OFF",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_USE_ASM": "OFF",
"CMAKE_C_FLAGS": "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer",
"CMAKE_CXX_FLAGS": "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer",
"CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address,undefined"
}
},
{
"name": "cpu-tsan",
"displayName": "CPU TSan",
"description": "CPU debug with ThreadSanitizer (for multi-threaded tests)",
"inherits": "base-linux",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"SECP256K1_BUILD_CPU": "ON",
"SECP256K1_BUILD_CUDA": "OFF",
"SECP256K1_BUILD_TESTS": "ON",
"SECP256K1_USE_ASM": "OFF",
"CMAKE_C_FLAGS": "-fsanitize=thread -fno-omit-frame-pointer",
"CMAKE_CXX_FLAGS": "-fsanitize=thread -fno-omit-frame-pointer",
"CMAKE_EXE_LINKER_FLAGS": "-fsanitize=thread"
}
}
],
"buildPresets": [
{
"name": "cpu-release",
"configurePreset": "cpu-release"
},
{
"name": "cpu-release-speed",
"configurePreset": "cpu-release-speed"
},
{
"name": "cpu-debug",
"configurePreset": "cpu-debug"
},
{
"name": "cuda-release",
"configurePreset": "cuda-release"
},
{
"name": "cuda-debug",
"configurePreset": "cuda-debug"
},
{
"name": "cuda-release-5060ti",
"configurePreset": "cuda-release-5060ti"
},
{
"name": "cpu-asan",
"configurePreset": "cpu-asan"
},
{
"name": "cpu-tsan",
"configurePreset": "cpu-tsan"
},
{
"name": "cuda-audit",
"configurePreset": "cuda-release"
},
{
"name": "cuda-audit-5060ti",
"configurePreset": "cuda-release-5060ti"
}
],
"testPresets": [
{
"name": "cpu-release",
"configurePreset": "cpu-release",
"output": {
"outputOnFailure": true
}
},
{
"name": "cpu-debug",
"configurePreset": "cpu-debug",
"output": {
"outputOnFailure": true
}
},
{
"name": "cpu-asan",
"configurePreset": "cpu-asan",
"output": {
"outputOnFailure": true
}
},
{
"name": "cpu-tsan",
"configurePreset": "cpu-tsan",
"output": {
"outputOnFailure": true
}
},
{
"name": "cuda-audit",
"configurePreset": "cuda-release",
"output": {
"outputOnFailure": true
},
"filter": {
"include": {
"name": "^(gpu_abi_gate|gpu_ops_equivalence|gpu_host_api_negative|gpu_backend_matrix|unified_audit)$"
}
}
},
{
"name": "cuda-audit-5060ti",
"configurePreset": "cuda-release-5060ti",
"output": {
"outputOnFailure": true
},
"filter": {
"include": {
"name": "^(gpu_abi_gate|gpu_ops_equivalence|gpu_host_api_negative|gpu_backend_matrix|unified_audit)$"
}
}
}
]
}