diff --git a/CMakeLists.txt b/CMakeLists.txt index 91e767a62033766d2b6104eb2e0907f86e9981b1..208188d3c0538ed0ccf9936ed82a95fb2bd78d10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,21 +13,32 @@ add_custom_target(check COMMAND ./clang-tidy.sh WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/ci") +# Specify the .cpp files common across all targets +add_library(common OBJECT + src/Message.cpp + src/Services/MemoryManagementService.cpp + src/Services/ParameterService.cpp + src/Services/RequestVerificationService.cpp + src/Services/TestService.cpp + ) + # Specify the .cpp files for the executables -add_executable(ecss_services src/main.cpp src/Message.cpp src/Service.cpp - src/Services/TestService.cpp src/Services/RequestVerificationService.cpp - src/Services/MemoryManagementService.cpp src/Services/ParameterService.cpp - src/Services/TestService.cpp - src/Services/RequestVerificationService.cpp) +add_executable(ecss_services + src/main.cpp + $<TARGET_OBJECTS:common> + src/Platform/x86/Service.cpp + ) + +IF (EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt") + # Gather all the .cpp files corresponding to tests + file(GLOB test_main_SRC "test/*.cpp") + file(GLOB test_SRC "test/**/*.cpp") -IF(EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt") add_subdirectory(lib/Catch2) - add_executable(tests src/Message.cpp src/Services/TestService.cpp - src/Services/RequestVerificationService.cpp src/Services/ParameterService.cpp - src/Services/MemoryManagementService.cpp test/tests.cpp test/Message.cpp - test/TestPlatform.cpp test/Services/TestService.cpp - test/Services/RequestVerificationService.cpp - test/Services/ParameterService.cpp test/Services/MemoryManagementService.cpp) + add_executable(tests + $<TARGET_OBJECTS:common> + ${test_main_SRC} + ${test_SRC}) target_link_libraries(tests Catch2::Catch2) ENDIF() diff --git a/src/Platform/README.md b/src/Platform/README.md new file mode 100644 index 0000000000000000000000000000000000000000..eb0a3ae39f9c1079d32ec6cd60298838564319a9 --- /dev/null +++ b/src/Platform/README.md @@ -0,0 +1,3 @@ +This folder contains platform-specific files: + +- **x86**: Files to be run on a PC with a proper operating system \ No newline at end of file diff --git a/src/Service.cpp b/src/Platform/x86/Service.cpp similarity index 100% rename from src/Service.cpp rename to src/Platform/x86/Service.cpp