diff --git a/CMakeLists.txt b/CMakeLists.txt index e9070f1a..ad744011 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,11 +13,18 @@ else() set(DRJIT_ENABLE_CUDA_DEFAULT ON) endif() -option(DRJIT_ENABLE_LLVM "Build the Dr.Jit LLVM backend?" ON) -option(DRJIT_ENABLE_CUDA "Build the Dr.Jit CUDA backend?" ${DRJIT_ENABLE_CUDA_DEFAULT}) -option(DRJIT_ENABLE_AUTODIFF "Build Dr.Jit automatic differentation library?" ON) -option(DRJIT_ENABLE_PYTHON "Build Python extension library?" ON) -option(DRJIT_ENABLE_TESTS "Build Dr.Jit test suite? (Warning, this takes *very* long to compile)" OFF) +if (SKBUILD) + set(DRJIT_ENABLE_LEAK_WARNINGS_DEFAULT OFF) +else() + set(DRJIT_ENABLE_LEAK_WARNINGS_DEFAULT ON) +endif() + +option(DRJIT_ENABLE_LLVM "Build the Dr.Jit LLVM backend?" ON) +option(DRJIT_ENABLE_CUDA "Build the Dr.Jit CUDA backend?" ${DRJIT_ENABLE_CUDA_DEFAULT}) +option(DRJIT_ENABLE_AUTODIFF "Build Dr.Jit automatic differentation library?" ON) +option(DRJIT_ENABLE_PYTHON "Build Python extension library?" ON) +option(DRJIT_ENABLE_TESTS "Build Dr.Jit test suite? (Warning, this takes *very* long to compile)" OFF) +option(DRJIT_ENABLE_LEAK_WARNINGS "Emit DrJit and nanobind leak warnings? By default, leak warnings are disabled automatically when building PyPi wheels." ${DRJIT_ENABLE_LEAK_WARNINGS_DEFAULT}) option(DRJIT_STABLE_ABI "Build Python extension using the CPython stable ABI? (Only relevant when using scikit-build)" OFF) mark_as_advanced(DRJIT_STABLE_ABI) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 9886323d..781347a2 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -141,8 +141,8 @@ if (DRJIT_ENABLE_CUDA) target_compile_definitions(drjit-python PRIVATE -DDRJIT_ENABLE_CUDA) endif() -# Disable leak warnings by default in PyPI release builds -if (SKBUILD) +# Disable DrJit and nanobind leak warnings (disabled by default in PyPi builds) +if (NOT DRJIT_ENABLE_LEAK_WARNINGS) target_compile_definitions(drjit-python PRIVATE -DDRJIT_DISABLE_LEAK_WARNINGS) endif()