|
| 1 | +cmake_minimum_required(VERSION 3.14) |
| 2 | +project(CuraFrame VERSION 3.0.0 LANGUAGES CXX) |
| 3 | + |
| 4 | +set(CMAKE_CXX_STANDARD 17) |
| 5 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 6 | +set(CMAKE_CXX_EXTENSIONS OFF) |
| 7 | + |
| 8 | +# All constraint-bundle translation units |
| 9 | +set(BUNDLE_SOURCES |
| 10 | + constraints/anti_infective/AntiInfectiveBundle.cpp |
| 11 | + constraints/cardiac/CardiacBundle.cpp |
| 12 | + constraints/cns/CNSBundle.cpp |
| 13 | + constraints/formulation/FormulationBundle.cpp |
| 14 | + constraints/hepatic/HepaticBundle.cpp |
| 15 | + constraints/immunologic/ImmunologicBundle.cpp |
| 16 | + constraints/metabolic/MetabolicBundle.cpp |
| 17 | + constraints/oncology/OncologyBundle.cpp |
| 18 | + constraints/pkpd/PKPDBundle.cpp |
| 19 | + constraints/renal/RenalBundle.cpp |
| 20 | + constraints/safety/SafetyBundle.cpp |
| 21 | + constraints/systemic_exposure/SystemicExposureBundle.cpp |
| 22 | +) |
| 23 | + |
| 24 | +# Scoring subsystem translation units |
| 25 | +set(SCORING_SOURCES |
| 26 | + scoring/WeightProfile.cpp |
| 27 | + scoring/WeightedScoringEngine.cpp |
| 28 | + scoring/ScoringPipeline.cpp |
| 29 | +) |
| 30 | + |
| 31 | +# Static library bundling all C++ constraint and scoring logic. |
| 32 | +# The repository root is exposed as the include root so that all relative |
| 33 | +# includes (e.g. "constraint_core/Candidate.hpp" or "../scoring/...") resolve |
| 34 | +# correctly regardless of which translation unit is being compiled. |
| 35 | +add_library(curaframe_cpp STATIC |
| 36 | + ${BUNDLE_SOURCES} |
| 37 | + ${SCORING_SOURCES} |
| 38 | +) |
| 39 | + |
| 40 | +target_include_directories(curaframe_cpp PUBLIC |
| 41 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> |
| 42 | +) |
| 43 | + |
| 44 | +target_compile_options(curaframe_cpp PRIVATE |
| 45 | + $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall -Wextra -Wpedantic> |
| 46 | + $<$<CXX_COMPILER_ID:MSVC>:/W4> |
| 47 | +) |
| 48 | + |
| 49 | +# NOTE: Each bundle uses the REGISTER_CONSTRAINT_BUNDLE self-registration macro, |
| 50 | +# which installs a static initialiser in its own translation unit. When linking |
| 51 | +# this library into an executable, force the linker to include every object file |
| 52 | +# so that all initialisers run, even those with no externally referenced symbols: |
| 53 | +# |
| 54 | +# GCC / Clang (Linux): |
| 55 | +# target_link_libraries(my_app PRIVATE |
| 56 | +# -Wl,--whole-archive curaframe_cpp -Wl,--no-whole-archive) |
| 57 | +# |
| 58 | +# Clang (macOS): |
| 59 | +# target_link_libraries(my_app PRIVATE |
| 60 | +# -Wl,-force_load,$<TARGET_FILE:curaframe_cpp>) |
| 61 | +# |
| 62 | +# MSVC: |
| 63 | +# target_link_libraries(my_app PRIVATE /WHOLEARCHIVE:curaframe_cpp) |
0 commit comments