Skip to content

fix: isolate CMake optimization flags from consumers - #136

Merged
gouyt13 merged 3 commits into
mainfrom
fix/cmake-consumer-options
Oct 9, 2026
Merged

gouyt13 merged 3 commits into
mainfrom
fix/cmake-consumer-options

Conversation

@gouyt13

@gouyt13 gouyt13 commented Oct 9, 2026

Copy link
Copy Markdown
Member

Summary

Linking rabitqlib::rabitqlib currently adds RaBitQ's -O3 and -march=native options to downstream compilation. This can override an application's optimization choices and unexpectedly enable host-specific instructions.

Move optimization and native-tuning options to private first-party target configuration. Preserve public C++17, OpenMP, MSVC header definitions, and explicit sanitizer instrumentation/runtime requirements. The library's native-optimization default remains unchanged; a native-built library is still not portable across CPUs.

Add source-tree and installed-consumer checks for evaluated usage requirements, plus coverage of both rotators across IVF and SymphonyQG. Extend CI to cover native, Windows, and sanitized installed consumers, and document the build-policy boundary. No public API, persisted-format, or dependency changes.

Testing

Local Linux x86-64 validation at e963244 using GCC 14.3, Clang 15.0.7, and CMake 3.28.3:

  • Reproduced the regression on main (1d4783a): the new consumer check rejects the leaked -O3 option.
  • GCC and Clang native add_subdirectory consumers: runtime and option checks passed.
  • Installed GCC native consumers in Release, Debug, and custom -O1 configurations: passed. Actual commands retain the consumer's -O1 while keeping RaBitQ's optimization flags private.
  • Installed portable consumer and Ninja Multi-Config Release consumer: passed.
  • Portable Release C++ suite: 318 passed, one conditional skip, zero failures. The skipped OpenMP placement check passed separately as OpenMPBinding with its required environment.
  • Installed ASan/UBSan consumer with leak detection enabled: passed. The first run hit LeakSanitizer's sandbox/ptrace restriction; the same binary passed outside the sandbox without disabling leak detection.
  • Changed C++ consumer source passed clang-format 15; branch diff passed git diff --check.

Windows/MSVC, macOS/AppleClang, and ARM64 were not run locally. Python package/wheel and sample builds were not exercised; their updated CMake helper call sites were reviewed. No performance claim is made.

@gouyt13
gouyt13 merged commit 0973bef into main Oct 9, 2026
35 checks passed
@gouyt13
gouyt13 deleted the fix/cmake-consumer-options branch October 9, 2026 05:44
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