diff --git a/CMakeLists.txt b/CMakeLists.txt index 19144b325..46fda6c45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,9 +104,6 @@ set(SOURCE_FILES src/simulation_sample/ground_station/sample_ground_station.cpp ) -## Create executable file -add_executable(${PROJECT_NAME} ${SOURCE_FILES}) - ## cspice library if(APPLE) if(APPLE_SILICON) @@ -179,23 +176,31 @@ endif() if(NOT NRLMSISE00_LIB) message(FATAL_ERROR "nrlmsise00 not found in ${EXT_LIB_DIR}") endif() -#target_link_libraries(${PROJECT_NAME} ${NRLMSISE00_LIB}) - -# Initialize link -target_link_libraries(COMPONENT DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT MATH_PHYSICS SETTING_FILE_READER LOGGER UTILITIES) -target_link_libraries(DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SIMULATION MATH_PHYSICS) -target_link_libraries(DISTURBANCE DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT MATH_PHYSICS) -target_link_libraries(SIMULATION DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT DISTURBANCE MATH_PHYSICS) -target_link_libraries(GLOBAL_ENVIRONMENT ${CSPICE_LIB} MATH_PHYSICS) -target_link_libraries(LOCAL_ENVIRONMENT GLOBAL_ENVIRONMENT ${CSPICE_LIB} MATH_PHYSICS) -target_link_libraries(MATH_PHYSICS ${NRLMSISE00_LIB}) -target_link_libraries(SETTING_FILE_READER INIH) - -target_link_libraries(${PROJECT_NAME} DYNAMICS) -target_link_libraries(${PROJECT_NAME} DISTURBANCE) -target_link_libraries(${PROJECT_NAME} SIMULATION) -target_link_libraries(${PROJECT_NAME} GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT) -target_link_libraries(${PROJECT_NAME} COMPONENT) + +# link hack for MSVC link.exe +add_library(lib${PROJECT_NAME} + $ + $ + $ + $ + + $ + $ + $ + $ + $ + $ + $ +) +add_executable(${PROJECT_NAME} ${SOURCE_FILES}) + +target_link_libraries(${PROJECT_NAME} + lib${PROJECT_NAME} + + # ExtLibraries + ${NRLMSISE00_LIB} + ${CSPICE_LIB} +) ## C2A integration if(USE_C2A) @@ -237,11 +242,12 @@ if(GOOGLE_TEST) file(GLOB_RECURSE TEST_FILES ${CMAKE_CURRENT_LIST_DIR}/src/test_*.cpp) # Uncomment the following line to exclude any files that match the REGEX from TEST_FILES # list(FILTER TEST_FILES EXCLUDE REGEX ${CMAKE_CURRENT_LIST_DIR}/src/test_example.cpp) + include_directories(${TEST_PROJECT_NAME}) add_executable(${TEST_PROJECT_NAME} ${TEST_FILES}) target_link_libraries(${TEST_PROJECT_NAME} gtest gtest_main gmock) - target_link_libraries(${TEST_PROJECT_NAME} MATH_PHYSICS) - include_directories(${TEST_PROJECT_NAME}) + target_link_libraries(${TEST_PROJECT_NAME} MATH_PHYSICS ${NRLMSISE00_LIB}) + add_test(NAME s2e-test COMMAND ${TEST_PROJECT_NAME}) enable_testing() diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt index 019dfc82b..03fbfc269 100644 --- a/src/components/CMakeLists.txt +++ b/src/components/CMakeLists.txt @@ -69,7 +69,7 @@ if(USE_C2A_COMMAND_SENDER) ) endif() -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT ${SOURCE_FILES} ) diff --git a/src/disturbances/CMakeLists.txt b/src/disturbances/CMakeLists.txt index 1ec497d73..cbd75b0c5 100644 --- a/src/disturbances/CMakeLists.txt +++ b/src/disturbances/CMakeLists.txt @@ -1,7 +1,7 @@ project(DISTURBANCE) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT air_drag.cpp disturbances.cpp geopotential.cpp diff --git a/src/dynamics/CMakeLists.txt b/src/dynamics/CMakeLists.txt index 72f038590..d878e37f9 100644 --- a/src/dynamics/CMakeLists.txt +++ b/src/dynamics/CMakeLists.txt @@ -1,7 +1,7 @@ project(DYNAMICS) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT orbit/orbit.cpp orbit/sgp4_orbit_propagation.cpp orbit/rk4_orbit_propagation.cpp diff --git a/src/environment/global/CMakeLists.txt b/src/environment/global/CMakeLists.txt index 8ce63a332..238590564 100644 --- a/src/environment/global/CMakeLists.txt +++ b/src/environment/global/CMakeLists.txt @@ -1,7 +1,7 @@ project(GLOBAL_ENVIRONMENT) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT global_environment.cpp celestial_information.cpp hipparcos_catalogue.cpp diff --git a/src/environment/local/CMakeLists.txt b/src/environment/local/CMakeLists.txt index b9943f9d0..d7d52406a 100644 --- a/src/environment/local/CMakeLists.txt +++ b/src/environment/local/CMakeLists.txt @@ -1,7 +1,7 @@ project(LOCAL_ENVIRONMENT) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT atmosphere.cpp local_environment.cpp geomagnetic_field.cpp diff --git a/src/logger/CMakeLists.txt b/src/logger/CMakeLists.txt index 336e85042..75af4bc57 100644 --- a/src/logger/CMakeLists.txt +++ b/src/logger/CMakeLists.txt @@ -1,7 +1,7 @@ project(LOGGER) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT logger.cpp initialize_log.cpp ) diff --git a/src/math_physics/CMakeLists.txt b/src/math_physics/CMakeLists.txt index 7eb305f84..21e5dee87 100644 --- a/src/math_physics/CMakeLists.txt +++ b/src/math_physics/CMakeLists.txt @@ -1,7 +1,7 @@ project(MATH_PHYSICS) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT atmosphere/simple_air_density_model.cpp atmosphere/harris_priester_model.cpp atmosphere/wrapper_nrlmsise00.cpp diff --git a/src/setting_file_reader/CMakeLists.txt b/src/setting_file_reader/CMakeLists.txt index 898d3e0fa..18d1b69e8 100644 --- a/src/setting_file_reader/CMakeLists.txt +++ b/src/setting_file_reader/CMakeLists.txt @@ -1,7 +1,7 @@ project(SETTING_FILE_READER) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT initialize_file_access.cpp c2a_command_database.cpp wings_operation_file.cpp diff --git a/src/simulation/CMakeLists.txt b/src/simulation/CMakeLists.txt index 360406dca..229a03711 100644 --- a/src/simulation/CMakeLists.txt +++ b/src/simulation/CMakeLists.txt @@ -1,7 +1,7 @@ project(SIMULATION) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT case/simulation_case.cpp monte_carlo_simulation/monte_carlo_simulation_executor.cpp diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt index ce9bef781..f808742ad 100644 --- a/src/utilities/CMakeLists.txt +++ b/src/utilities/CMakeLists.txt @@ -1,7 +1,7 @@ project(UTILITIES) cmake_minimum_required(VERSION 3.13) -add_library(${PROJECT_NAME} STATIC +add_library(${PROJECT_NAME} OBJECT endian.cpp slip.cpp quantization.cpp