Skip to content

feat(build): default BUILD_SHARED_LIBS to ON#24

Merged
olantwin merged 1 commit into
mainfrom
feat/default-shared-libs
Jun 4, 2026
Merged

feat(build): default BUILD_SHARED_LIBS to ON#24
olantwin merged 1 commit into
mainfrom
feat/default-shared-libs

Conversation

@olantwin
Copy link
Copy Markdown
Contributor

@olantwin olantwin commented Jun 4, 2026

Summary

  • Default `BUILD_SHARED_LIBS` to `ON` via `option()` at the top of the top-level `CMakeLists.txt`.

Motivation

The main `SHiPGeometry` library and every subsystem (`Cavern`, `Target`, `MuonShield`, `Magnet`, `DecayVolume`, `Trackers`, `Calorimeter`, `UpstreamTagger`, `TimingDetector`) use bare `add_library( src/...)` — no `SHARED` keyword. Without setting `BUILD_SHARED_LIBS=ON` in the configure, CMake produces static archives in `lib/` instead of the `.so` files the rest of the SHiP stack (`SHiPGeometryService`, `aegir`, conda packagers) consumes.

Surfaced while writing a conda recipe for `SHiPGeometry` — the recipe initially silently produced `.a` files and the downstream tests failed. Default to `ON` so the shared library this project clearly intends to provide is what you get out of the box; users who want static can still pass `-DBUILD_SHARED_LIBS=OFF` explicitly.

Test plan

  • CI (`build-test.yml`) stays green.
  • Manual: after this change, `cmake -S . -B /tmp/g` produces `libSHiPGeometry.so` and `libCavern.so` etc. in the build tree (rather than `.a`).

Every subsystem (Cavern, Target, MuonShield, Magnet, DecayVolume,
Trackers, Calorimeter, UpstreamTagger, TimingDetector) plus the main
SHiPGeometry library uses bare add_library(<Name> src/...) without an
explicit SHARED. Without BUILD_SHARED_LIBS=ON in the configure, CMake
default behaviour produces static archives in lib/, which silently
breaks downstream packagers and consumers that assume shared libs.

Default BUILD_SHARED_LIBS to ON via option() so the shared library
behaviour the rest of the project (and downstream SHiPGeometryService
and aegir) clearly expects is what you get out of the box. Users who
want static can still pass -DBUILD_SHARED_LIBS=OFF explicitly.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Warning

Review limit reached

@olantwin, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 33 minutes and 59 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ffbad629-6126-4a3a-8b9f-92227e4dff72

📥 Commits

Reviewing files that changed from the base of the PR and between a4df127 and 06c5c05.

📒 Files selected for processing (1)
  • CMakeLists.txt
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/default-shared-libs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@olantwin olantwin merged commit a5bac91 into main Jun 4, 2026
3 checks passed
@olantwin olantwin deleted the feat/default-shared-libs branch June 4, 2026 14:46
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