Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ python3_add_library(_sparsediffengine MODULE
sparsediffpy/_bindings/bindings.c
)

# Match the engine's per-config optimization flags so the extension doesn't rely on
# the toolchain's default CMAKE_C_FLAGS_RELEASE.
if(MSVC)
target_compile_options(_sparsediffengine PRIVATE
$<$<CONFIG:Debug>:/Od /Zi>
$<$<CONFIG:Release>:/O2 /DNDEBUG>
$<$<CONFIG:RelWithDebInfo>:/O2 /Zi /DNDEBUG>
$<$<CONFIG:MinSizeRel>:/Os /DNDEBUG>
)
else()
target_compile_options(_sparsediffengine PRIVATE
$<$<CONFIG:Debug>:-g -O0>
$<$<CONFIG:Release>:-O3 -DNDEBUG>
$<$<CONFIG:RelWithDebInfo>:-O2 -g -DNDEBUG>
$<$<CONFIG:MinSizeRel>:-Os -DNDEBUG>
)
endif()

target_include_directories(_sparsediffengine PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/SparseDiffEngine/include
${CMAKE_CURRENT_SOURCE_DIR}/SparseDiffEngine/include/atoms
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ content-type = "text/markdown"

[tool.scikit-build]
cmake.version = ">=3.15"
cmake.build-type = "Release"
wheel.packages = ["sparsediffpy"]
# Persistent build dir: avoids scikit-build-core's TemporaryDirectory, whose cleanup
# intermittently fails on Windows CI with WinError 32 (lingering mspdbsrv/AV handle).
Expand Down
Loading