Skip to content

Commit 963df3a

Browse files
authored
Merge pull request #54 from dfeen87/copilot/validate-cpp-subsystem-architecture
fix: resolve critical and minor issues from C++ subsystem validation
2 parents 9006a4f + f5a80d9 commit 963df3a

34 files changed

Lines changed: 142 additions & 51 deletions

CMakeLists.txt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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)

constraint_core/MultiBundleEvaluator.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
#include "EvaluationReport.hpp"
66
#include "ConstraintRegistry.hpp"
77
#include "../scoring/ScoringPipeline.hpp"
8+
#include "../scoring/ScoringReport.hpp"
89
#include "../scoring/WeightProfile.hpp"
910
#include <sstream>
1011

1112
// Unified Evaluation Layer
1213
class MultiBundleEvaluator {
1314
public:
14-
EvaluationReport evaluate(const Candidate& candidate) {
15+
EvaluationReport evaluate(const Candidate& candidate) const {
1516
EvaluationReport report;
1617
report.candidate_id = candidate.id;
1718

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
#include "AntiInfectiveBundle.hpp"
2+
#include "../../constraint_core/ConstraintRegistry.hpp"
3+
4+
REGISTER_CONSTRAINT_BUNDLE("AntiInfective", AntiInfectiveBundle)

constraints/anti_infective/AntiInfectiveBundle.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define CURAFRAME_ANTI_INFECTIVE_BUNDLE_HPP
33

44
#include "../../constraint_core/ConstraintBundle.hpp"
5-
#include "../../constraint_core/ConstraintRegistry.hpp"
65
#include <sstream>
76

87
class AntiInfectiveBundle : public ConstraintBundle {
@@ -58,6 +57,4 @@ class AntiInfectiveBundle : public ConstraintBundle {
5857
std::string narrative_summary() const override { return summary; }
5958
};
6059

61-
REGISTER_CONSTRAINT_BUNDLE("AntiInfective", AntiInfectiveBundle)
62-
6360
#endif // CURAFRAME_ANTI_INFECTIVE_BUNDLE_HPP
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
#include "CardiacBundle.hpp"
2+
#include "../../constraint_core/ConstraintRegistry.hpp"
3+
4+
REGISTER_CONSTRAINT_BUNDLE("Cardiac", CardiacBundle)

constraints/cardiac/CardiacBundle.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define CURAFRAME_CARDIAC_BUNDLE_HPP
33

44
#include "../../constraint_core/ConstraintBundle.hpp"
5-
#include "../../constraint_core/ConstraintRegistry.hpp"
65
#include <sstream>
76

87
class CardiacBundle : public ConstraintBundle {
@@ -59,6 +58,4 @@ class CardiacBundle : public ConstraintBundle {
5958
std::string narrative_summary() const override { return summary; }
6059
};
6160

62-
REGISTER_CONSTRAINT_BUNDLE("Cardiac", CardiacBundle)
63-
6461
#endif // CURAFRAME_CARDIAC_BUNDLE_HPP

constraints/cns/CNSBundle.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
#include "CNSBundle.hpp"
2+
#include "../../constraint_core/ConstraintRegistry.hpp"
3+
4+
REGISTER_CONSTRAINT_BUNDLE("CNS", CNSBundle)

constraints/cns/CNSBundle.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define CURAFRAME_CNS_BUNDLE_HPP
33

44
#include "../../constraint_core/ConstraintBundle.hpp"
5-
#include "../../constraint_core/ConstraintRegistry.hpp"
65
#include <sstream>
76

87
class CNSBundle : public ConstraintBundle {
@@ -59,6 +58,4 @@ class CNSBundle : public ConstraintBundle {
5958
std::string narrative_summary() const override { return summary; }
6059
};
6160

62-
REGISTER_CONSTRAINT_BUNDLE("CNS", CNSBundle)
63-
6461
#endif // CURAFRAME_CNS_BUNDLE_HPP
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
#include "FormulationBundle.hpp"
2+
#include "../../constraint_core/ConstraintRegistry.hpp"
3+
4+
REGISTER_CONSTRAINT_BUNDLE("Formulation", FormulationBundle)

constraints/formulation/FormulationBundle.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define CURAFRAME_FORMULATION_BUNDLE_HPP
33

44
#include "../../constraint_core/ConstraintBundle.hpp"
5-
#include "../../constraint_core/ConstraintRegistry.hpp"
65
#include <sstream>
76

87
class FormulationBundle : public ConstraintBundle {
@@ -57,6 +56,4 @@ class FormulationBundle : public ConstraintBundle {
5756
std::string narrative_summary() const override { return summary; }
5857
};
5958

60-
REGISTER_CONSTRAINT_BUNDLE("Formulation", FormulationBundle)
61-
6259
#endif // CURAFRAME_FORMULATION_BUNDLE_HPP

0 commit comments

Comments
 (0)