Files
Duncan Ogilvie b44d8d2c3f Disable optimizations in Release mode on MSVC
This configuration isn't used in CI, but takes ~10min to build locally
2026-05-12 13:13:26 +02:00

169 lines
4.0 KiB
TOML

[cmake]
version = "3.27" # IMPORTED_RUNTIME_ARTIFACTS, $<LIST:FILTER,...>
cmkr-include = "cmake/cmkr.cmake"
[project]
name = "llvm-nanobind"
[variables]
CMAKE_EXPORT_COMPILE_COMMANDS = true
CMAKE_MODULE_PATH = "${CMAKE_SOURCE_DIR}/cmake"
# TODO: when finding Python 3.14 this produces abi3 modules that are not compatible with 3.12
[find-package.Python]
version = "3.12"
components = ["Interpreter", "Development.Module", "Development.SABIModule"]
[find-package.nanobind-wrapper]
[find-package.LLVM-Wrapper]
[template.nanobind_module]
type = "shared"
add-function = "nanobind_add_typed_module"
pass-sources = true
[target.llvm]
type = "nanobind_module"
sources = ["src/llvm-nanobind.cpp"]
compile-features = ["cxx_std_20"]
link-libraries = ["::LLVM-C-Wrapper"]
# cl.exe: /O2 /Ob2 is brutal on large TUs with heavy templates.
# /O1 (favor size) with /Ob1 (inline only __inline) is much faster to compile
# and makes no practical difference for binding glue code.
compile-options = ["$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:Release>>:/Od>"]
# Test executable template
[template.test]
type = "executable"
compile-features = ["cxx_std_20"]
link-libraries = ["::LLVM-C-Wrapper"]
[target.llvm-c-test-vendored]
type = "test"
sources = ["llvm-c/llvm-c-test/*.c", "llvm-c/llvm-c-test/*.cpp"]
headers = ["llvm-c/llvm-c-test/*.h"]
properties = { OUTPUT_NAME = "llvm-c-test" }
link-libraries = ["::LLVM-Wrapper"]
# Test targets
[target.test_context]
type = "test"
sources = ["tests/test_context.cpp"]
[target.test_module]
type = "test"
sources = ["tests/test_module.cpp"]
[target.test_types]
type = "test"
sources = ["tests/test_types.cpp"]
[target.test_function]
type = "test"
sources = ["tests/test_function.cpp"]
[target.test_basic_block]
type = "test"
sources = ["tests/test_basic_block.cpp"]
[target.test_builder_arithmetic]
type = "test"
sources = ["tests/test_builder_arithmetic.cpp"]
[target.test_builder_memory]
type = "test"
sources = ["tests/test_builder_memory.cpp"]
[target.test_builder_control_flow]
type = "test"
sources = ["tests/test_builder_control_flow.cpp"]
[target.test_builder_casts]
type = "test"
sources = ["tests/test_builder_casts.cpp"]
[target.test_builder_cmp]
type = "test"
sources = ["tests/test_builder_cmp.cpp"]
[target.test_constants]
type = "test"
sources = ["tests/test_constants.cpp"]
[target.test_globals]
type = "test"
sources = ["tests/test_globals.cpp"]
[target.test_phi]
type = "test"
sources = ["tests/test_phi.cpp"]
[target.test_factorial]
type = "test"
sources = ["tests/test_factorial.cpp"]
[target.test_struct]
type = "test"
sources = ["tests/test_struct.cpp"]
[target.test_predecessors]
type = "test"
sources = ["tests/test_predecessors.cpp"]
# New API tests
[target.test_target_codegen]
type = "test"
sources = ["tests/test_target_codegen.cpp"]
[target.test_bitcode_linker]
type = "test"
sources = ["tests/test_bitcode_linker.cpp"]
[target.test_passbuilder]
type = "test"
sources = ["tests/test_passbuilder.cpp"]
[target.test_call_conv]
type = "test"
sources = ["tests/test_call_conv.cpp"]
[target.test_function_extended]
type = "test"
sources = ["tests/test_function_extended.cpp"]
# Regression test for LLVM bug
[target.test_symbol_size_crash]
type = "test"
sources = ["tests/regressions/test_symbol_size_crash.cpp"]
# Obfuscation tools template
[template.obfuscation_tool]
type = "executable"
compile-features = ["cxx_std_20"]
link-libraries = ["::LLVM-Wrapper"]
# Obfuscation tools
[target.mba_sub]
type = "obfuscation_tool"
sources = ["tools/obfuscation/mba_sub.cpp"]
[target.bb_split]
type = "obfuscation_tool"
sources = ["tools/obfuscation/bb_split.cpp"]
[target.indirect_branch]
type = "obfuscation_tool"
sources = ["tools/obfuscation/indirect_branch.cpp"]
[target.control_flow_flatten]
type = "obfuscation_tool"
sources = ["tools/obfuscation/control_flow_flatten.cpp"]
[target.indirect_branch_enc]
type = "obfuscation_tool"
sources = ["tools/obfuscation/indirect_branch_enc.cpp"]
[target.string_encrypt]
type = "obfuscation_tool"
sources = ["tools/obfuscation/string_encrypt.cpp"]