Skip to content

Compile the extension with the engine's explicit Release flags - #23

Merged
dance858 merged 1 commit into
mainfrom
explicit-release-flags
Sep 5, 2026
Merged

Compile the extension with the engine's explicit Release flags#23
dance858 merged 1 commit into
mainfrom
explicit-release-flags

Conversation

@dance858

@dance858 dance858 commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Make compilation flags and release mode explicit.

Claude below:

Summary

The _sparsediffengine extension target was only optimized because CMake's default CMAKE_C_FLAGS_RELEASE happens to be -O3 -DNDEBUG. The engine's own -O3 -DNDEBUG / /O2 /DNDEBUG block is scoped to dnlp_diff, so the extension inherited nothing explicit.

  • pyproject.toml: pin cmake.build-type = "Release" (matches the scikit-build-core default; makes the intent declared rather than inherited).
  • CMakeLists.txt: add the same four-config target_compile_options block the engine uses, scoped PRIVATE to _sparsediffengine.

Per-target options are emitted after CMAKE_C_FLAGS, so the extension's -O3 deliberately wins over a packager's CFLAGS, the same policy the engine already applies to itself. Release builds already defined NDEBUG, so no behavior changes; the bindings contain no assert calls of their own.

The _sparsediffengine target was only optimized because CMake's default
CMAKE_C_FLAGS_RELEASE happens to be -O3 -DNDEBUG. Pin cmake.build-type to
Release in pyproject.toml and give the extension the same per-config
target_compile_options block the engine applies to dnlp_diff, so the
optimization level no longer depends on toolchain defaults.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUDtSX6BT4SiDzfPKVZF9C
@dance858
dance858 merged commit 7cebe55 into main Sep 5, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant