feat(build): default BUILD_SHARED_LIBS to ON#24
Conversation
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.
|
Warning Review limit reached
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 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. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
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