From f2894bec33133704c2e2b1a516725b22f722fa9b Mon Sep 17 00:00:00 2001 From: EPICGameGuy Date: Sat, 8 Oct 2022 14:19:48 -0400 Subject: [PATCH 1/3] Added cmake options for building engine simulator as a library --- CMakeLists.txt | 214 +++++++++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 97 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faa5a0bf..5db952af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.10) option(DTV "Enable video output" OFF) option(PIRANHA_ENABLED "Enable scripting input" ON) option(DISCORD_ENABLED "Enable Discord Rich Presence" ON) +option(BUILD_APP "Build Application" ON) +option(BUILD_APP_AS_LIB "Build Application as a library" OFF) if (DTV) add_compile_definitions(ATG_ENGINE_SIM_VIDEO_CAPTURE) @@ -139,6 +141,8 @@ target_link_libraries(engine-sim target_include_directories(engine-sim PUBLIC dependencies/submodules) + +add_subdirectory(dependencies/submodules/simple-2d-constraint-solver) if (PIRANHA_ENABLED) add_library(engine-sim-script-interpreter STATIC @@ -187,6 +191,8 @@ if (PIRANHA_ENABLED) target_link_libraries(engine-sim-script-interpreter csv-io piranha) + + add_subdirectory(dependencies/submodules/piranha) endif (PIRANHA_ENABLED) if (DISCORD_ENABLED) @@ -201,103 +207,117 @@ if (DISCORD_ENABLED) ) endif (DISCORD_ENABLED) -add_executable(engine-sim-app WIN32 - # Source files - src/main.cpp - src/engine_sim_application.cpp - src/geometry_generator.cpp - src/simulation_object.cpp - src/piston_object.cpp - src/connecting_rod_object.cpp - src/ui_element.cpp - src/ui_manager.cpp - src/cylinder_pressure_gauge.cpp - src/ui_math.cpp - src/gauge.cpp - src/crankshaft_object.cpp - src/cylinder_bank_object.cpp - src/cylinder_head_object.cpp - src/ui_button.cpp - src/ui_utilities.cpp - src/combustion_chamber_object.cpp - src/oscilloscope.cpp - src/shaders.cpp - src/engine_view.cpp - src/right_gauge_cluster.cpp - src/cylinder_temperature_gauge.cpp - src/labeled_gauge.cpp - src/throttle_display.cpp - src/afr_cluster.cpp - src/fuel_cluster.cpp - src/oscilloscope_cluster.cpp - src/performance_cluster.cpp - src/firing_order_display.cpp - src/load_simulation_cluster.cpp - src/mixer_cluster.cpp - src/info_cluster.cpp - - # Include files - include/delta.h - include/dtv.h - include/engine_sim_application.h - include/geometry_generator.h - include/simulation_object.h - include/piston_object.h - include/connecting_rod_object.h - include/ui_element.h - include/ui_manager.h - include/cylinder_pressure_gauge.h - include/ui_math.h - include/units.h - include/crankshaft_object.h - include/cylinder_bank_object.h - include/cylinder_head_object.h - include/ui_button.h - include/ui_utilities.h - include/combustion_chamber_object.h - include/oscilloscope.h - include/shaders.h - include/engine_view.h - include/right_gauge_cluster.h - include/cylinder_temperature_gauge.h - include/labeled_gauge.h - include/throttle_display.h - include/afr_cluster.h - include/fuel_cluster.h - include/oscilloscope_cluster.h - include/performance_cluster.h - include/firing_order_display.h - include/load_simulation_cluster.h - include/mixer_cluster.h - include/info_cluster.h -) - -target_link_libraries(engine-sim-app - engine-sim -) - -if (DTV) - target_link_libraries(engine-sim-app - direct-to-video) -endif (DTV) - -if (PIRANHA_ENABLED) - target_link_libraries(engine-sim-app - engine-sim-script-interpreter) -endif (PIRANHA_ENABLED) - -if (DISCORD_ENABLED) - add_library(discord-rpc STATIC IMPORTED) - set_property(TARGET discord-rpc PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/dependencies/discord/lib/discord-rpc.lib) - target_link_libraries(engine-sim-app - discord - discord-rpc) -endif (DISCORD_ENABLED) - -target_include_directories(engine-sim-app - PUBLIC dependencies/submodules) - -add_subdirectory(dependencies) +if (BUILD_APP_AS_LIB OR BUILD_APP) + add_library(engine-sim-app-lib STATIC + # Source files + src/engine_sim_application.cpp + src/geometry_generator.cpp + src/simulation_object.cpp + src/piston_object.cpp + src/connecting_rod_object.cpp + src/ui_element.cpp + src/ui_manager.cpp + src/cylinder_pressure_gauge.cpp + src/ui_math.cpp + src/gauge.cpp + src/crankshaft_object.cpp + src/cylinder_bank_object.cpp + src/cylinder_head_object.cpp + src/ui_button.cpp + src/ui_utilities.cpp + src/combustion_chamber_object.cpp + src/oscilloscope.cpp + src/shaders.cpp + src/engine_view.cpp + src/right_gauge_cluster.cpp + src/cylinder_temperature_gauge.cpp + src/labeled_gauge.cpp + src/throttle_display.cpp + src/afr_cluster.cpp + src/fuel_cluster.cpp + src/oscilloscope_cluster.cpp + src/performance_cluster.cpp + src/firing_order_display.cpp + src/load_simulation_cluster.cpp + src/mixer_cluster.cpp + src/info_cluster.cpp + + # Include files + include/delta.h + include/dtv.h + include/engine_sim_application.h + include/geometry_generator.h + include/simulation_object.h + include/piston_object.h + include/connecting_rod_object.h + include/ui_element.h + include/ui_manager.h + include/cylinder_pressure_gauge.h + include/ui_math.h + include/units.h + include/crankshaft_object.h + include/cylinder_bank_object.h + include/cylinder_head_object.h + include/ui_button.h + include/ui_utilities.h + include/combustion_chamber_object.h + include/oscilloscope.h + include/shaders.h + include/engine_view.h + include/right_gauge_cluster.h + include/cylinder_temperature_gauge.h + include/labeled_gauge.h + include/throttle_display.h + include/afr_cluster.h + include/fuel_cluster.h + include/oscilloscope_cluster.h + include/performance_cluster.h + include/firing_order_display.h + include/load_simulation_cluster.h + include/mixer_cluster.h + include/info_cluster.h + ) + + target_link_libraries(engine-sim-app-lib + engine-sim + ) + + if (DTV) + target_link_libraries(engine-sim-app-lib + direct-to-video) + add_subdirectory(dependencies/submodules/direct-to-video) + endif (DTV) + + if (PIRANHA_ENABLED) + target_link_libraries(engine-sim-app-lib + engine-sim-script-interpreter) + endif (PIRANHA_ENABLED) + + if (DISCORD_ENABLED) + add_library(discord-rpc STATIC IMPORTED) + set_property(TARGET discord-rpc PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/dependencies/discord/lib/discord-rpc.lib) + target_link_libraries(engine-sim-app-lib + discord + discord-rpc) + endif (DISCORD_ENABLED) + + target_include_directories(engine-sim-app-lib + PUBLIC dependencies/submodules) + + add_subdirectory(dependencies/submodules/delta-studio) + add_subdirectory(dependencies/submodules/csv-io) +endif (BUILD_APP_AS_LIB OR BUILD_APP) + +if (BUILD_APP) + add_executable(engine-sim-app WIN32 + # Source files + src/main.cpp + ) + + target_link_libraries(engine-sim-app + engine-sim-app-lib + ) +endif (BUILD_APP) # GTEST From 8f21b17091f4eb9336c7cbfd494aa2113f060e30 Mon Sep 17 00:00:00 2001 From: EPICGameGuy Date: Sat, 8 Oct 2022 14:29:20 -0400 Subject: [PATCH 2/3] Changed naming for BUILD_APP_LIB cmake option --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5db952af..c9efba49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ option(DTV "Enable video output" OFF) option(PIRANHA_ENABLED "Enable scripting input" ON) option(DISCORD_ENABLED "Enable Discord Rich Presence" ON) option(BUILD_APP "Build Application" ON) -option(BUILD_APP_AS_LIB "Build Application as a library" OFF) +option(BUILD_APP_LIB "Build the application library. This library includes the visualization and simulation setup." ON) if (DTV) add_compile_definitions(ATG_ENGINE_SIM_VIDEO_CAPTURE) @@ -207,7 +207,7 @@ if (DISCORD_ENABLED) ) endif (DISCORD_ENABLED) -if (BUILD_APP_AS_LIB OR BUILD_APP) +if (BUILD_APP_LIB OR BUILD_APP) add_library(engine-sim-app-lib STATIC # Source files src/engine_sim_application.cpp @@ -306,7 +306,7 @@ if (BUILD_APP_AS_LIB OR BUILD_APP) add_subdirectory(dependencies/submodules/delta-studio) add_subdirectory(dependencies/submodules/csv-io) -endif (BUILD_APP_AS_LIB OR BUILD_APP) +endif (BUILD_APP_LIB OR BUILD_APP) if (BUILD_APP) add_executable(engine-sim-app WIN32 From 05e2adf31a54c0ee89b3f999756fe3f717204e45 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Thu, 31 Oct 2024 16:15:09 -0400 Subject: [PATCH 3/3] Update CMakeLists.txt Co-authored-by: Miouzora <91665686+Miou-zora@users.noreply.github.com> --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9efba49..3cff927d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,7 @@ target_link_libraries(engine-sim delta-basic) target_include_directories(engine-sim - PUBLIC dependencies/submodules) + PUBLIC dependencies/submodules include) add_subdirectory(dependencies/submodules/simple-2d-constraint-solver)