Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmake options for building engine simulator as a library #338

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 118 additions & 98 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_LIB "Build the application library. This library includes the visualization and simulation setup." ON)

if (DTV)
add_compile_definitions(ATG_ENGINE_SIM_VIDEO_CAPTURE)
Expand Down Expand Up @@ -138,7 +140,9 @@ 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)

if (PIRANHA_ENABLED)
add_library(engine-sim-script-interpreter STATIC
Expand Down Expand Up @@ -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)
Expand All @@ -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_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_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

Expand Down