mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 20:54:59 +01:00
Merge branch 'master' into feat/renderers-cleanup
This commit is contained in:
@@ -83,6 +83,7 @@ option(WITH_CRASHPAD "Compile with crashpad" OFF)
|
||||
option(WITH_DISCORD_RPC "Compile with DISCORD RICH PRESENCE" ON)
|
||||
option(USE_LTO "Use link-time optimization" OFF)
|
||||
option(WITH_TESTS "Build and run the unit tests with the game, a failing test fails the build" ON)
|
||||
option(WITH_EDITOR_SELFTESTS "Run the scripts of the editor and launcher self-tests named by the EU07_EDITOR_SELFTEST and EU07_LAUNCHER_SELFTEST variables" OFF)
|
||||
option(GENERATE_PDB "Generate executable with program debugging symbols" ON)
|
||||
option(ENABLE_MCC "Enable multicore compilation" ON)
|
||||
option(WITHDUMPGEN "Enable generating DMP files on crash" ON)
|
||||
@@ -189,6 +190,7 @@ set(SOURCES
|
||||
"scene/scene.cpp"
|
||||
"scene/scenenode.cpp"
|
||||
"simulation/simulation.cpp"
|
||||
"simulation/blackboxrecorder.cpp"
|
||||
"model/vertex.cpp"
|
||||
"audio/audio.cpp"
|
||||
"audio/audiorenderer.cpp"
|
||||
@@ -213,6 +215,8 @@ set(SOURCES
|
||||
"editor/editorIncludeInfo.cpp"
|
||||
"editor/editorTerrain.cpp"
|
||||
"editor/editorTrack.cpp"
|
||||
"editor/editorTrackTrace.cpp"
|
||||
"editor/editorFouling.cpp"
|
||||
"editor/editorRoad.cpp"
|
||||
"editor/editorAlignment.cpp"
|
||||
"editor/editorTrackShape.cpp"
|
||||
@@ -249,7 +253,9 @@ set(SOURCES
|
||||
"application/editormoderecords.cpp"
|
||||
"application/editormodeswitchdrive.cpp"
|
||||
"application/editormodeswitchtool.cpp"
|
||||
"application/editormodeswitchtemplate.cpp"
|
||||
"application/editormodenmt.cpp"
|
||||
"application/editormodegradeline.cpp"
|
||||
"application/editormodeswitchslide.cpp"
|
||||
"application/editormodeswitchdesign.cpp"
|
||||
"application/editormodetrackbed.cpp"
|
||||
@@ -259,6 +265,8 @@ set(SOURCES
|
||||
"application/editormodeprofile.cpp"
|
||||
"application/editormodetextures.cpp"
|
||||
"application/editormodegauge.cpp"
|
||||
"application/editormoderide.cpp"
|
||||
"application/editormodeminimap.cpp"
|
||||
"application/editormodeinfra.cpp"
|
||||
"application/editormodespeed.cpp"
|
||||
"application/editormodesrk.cpp"
|
||||
@@ -634,6 +642,11 @@ if (ADD_VERSION_SUFFIX)
|
||||
set (SUFFIX "_${SRC_SHORT_DATE}_${GIT_HASH}")
|
||||
endif()
|
||||
|
||||
# a build without AVX2 says so in its name, so a starter can pick it on a CPU without AVX2
|
||||
if (NOT ENABLE_AVX2)
|
||||
set (SUFFIX "${SUFFIX}_noavx2")
|
||||
endif()
|
||||
|
||||
set(OPENVR_LIBRARY "openvr_api")
|
||||
set(OPENVR_INCLUDE_DIR "")
|
||||
|
||||
@@ -695,6 +708,7 @@ set(CORE_SOURCES
|
||||
"McZapkie/friction.cpp"
|
||||
"McZapkie/hamulce.cpp"
|
||||
"McZapkie/Mover.cpp"
|
||||
"McZapkie/couplerphysics.cpp"
|
||||
"McZapkie/Oerlikon_ESt.cpp"
|
||||
"utilities/parser.cpp"
|
||||
"utilities/utilities.cpp"
|
||||
@@ -703,11 +717,15 @@ set(CORE_SOURCES
|
||||
"scripting/scriptscreenkernels.cpp"
|
||||
"scripting/scriptscreendrawing.cpp"
|
||||
"simulation/simulationtestrules.cpp"
|
||||
"vehicle/blackbox.cpp"
|
||||
"utilities/physicslog.cpp"
|
||||
"vehicle/enginestart.cpp"
|
||||
"vehicle/brakesetting.cpp"
|
||||
"vehicle/handover.cpp"
|
||||
"vehicle/horn.cpp"
|
||||
"vehicle/linebreaker.cpp"
|
||||
"vehicle/smoke.cpp"
|
||||
"vehicle/odometer.cpp"
|
||||
)
|
||||
add_library(eu07_core STATIC ${CORE_SOURCES})
|
||||
target_link_libraries(eu07_core PUBLIC eu07_settings)
|
||||
@@ -869,6 +887,12 @@ else()
|
||||
target_compile_definitions(eu07_settings INTERFACE WITH_DISCORD_RPC=0)
|
||||
endif()
|
||||
|
||||
if(WITH_EDITOR_SELFTESTS)
|
||||
target_compile_definitions(eu07_settings INTERFACE WITH_EDITOR_SELFTESTS=1)
|
||||
else()
|
||||
target_compile_definitions(eu07_settings INTERFACE WITH_EDITOR_SELFTESTS=0)
|
||||
endif()
|
||||
|
||||
find_package(OpenAL REQUIRED)
|
||||
if (TARGET OpenAL::OpenAL)
|
||||
target_link_libraries(eu07_settings INTERFACE OpenAL::OpenAL)
|
||||
@@ -899,7 +923,8 @@ if (WIN32)
|
||||
target_link_libraries(eu07_settings INTERFACE ws2_32)
|
||||
endif()
|
||||
|
||||
# http client of the editor's geoportal orthophoto layer: WinHTTP on Windows, libcurl elsewhere when available
|
||||
# http client of the editor, for the orthophoto, the terrain model and the topo map of geoportal.gov.pl: WinHTTP on Windows,
|
||||
# libcurl elsewhere when available
|
||||
if (WIN32)
|
||||
target_link_libraries(eu07_settings INTERFACE winhttp)
|
||||
else()
|
||||
@@ -908,7 +933,7 @@ else()
|
||||
target_link_libraries(eu07_settings INTERFACE CURL::libcurl)
|
||||
target_compile_definitions(eu07_settings INTERFACE EU07_WITH_CURL)
|
||||
else()
|
||||
message(STATUS "libcurl not found: the editor's orthophoto layer will only show cached tiles")
|
||||
message(STATUS "libcurl not found: the editor's orthophoto and terrain model will only show what's cached, its topo map nothing")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -925,6 +950,41 @@ if (WIN32)
|
||||
)
|
||||
endif ()
|
||||
|
||||
# Linux: the game loads its shared libraries from its own folder first ($ORIGIN), and the build copies them there,
|
||||
# so the folder runs on a system that doesn't have them, or has other versions. the RPATH is a DT_RPATH rather
|
||||
# than a DT_RUNPATH, because only that one is also used for the libraries the copied ones load (libsndfile's codecs)
|
||||
if (UNIX AND NOT APPLE)
|
||||
option(BUNDLE_RUNTIME_LIBS "Linux: copy the shared libraries the game needs next to it and load them from there" ON)
|
||||
endif()
|
||||
if (UNIX AND NOT APPLE AND BUNDLE_RUNTIME_LIBS)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH TRUE
|
||||
INSTALL_RPATH "$ORIGIN")
|
||||
target_link_options(${PROJECT_NAME} PRIVATE "LINKER:--disable-new-dtags")
|
||||
|
||||
# the RPATH no longer leads to libraries outside the system folders (Python from setup-python, an OpenAL Soft
|
||||
# in /usr/local), so their folders are given to the script as well
|
||||
set(EU07_BUNDLE_SEARCH_DIRS "")
|
||||
foreach(library IN LISTS Python3_LIBRARIES OPENAL_LIBRARY LUAJIT_LIBRARIES libserialport_LIBRARY)
|
||||
if (IS_ABSOLUTE "${library}")
|
||||
get_filename_component(library_dir "${library}" DIRECTORY)
|
||||
list(APPEND EU07_BUNDLE_SEARCH_DIRS "${library_dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
list(APPEND EU07_BUNDLE_SEARCH_DIRS ${Python3_LIBRARY_DIRS})
|
||||
list(REMOVE_DUPLICATES EU07_BUNDLE_SEARCH_DIRS)
|
||||
string(REPLACE ";" "|" EU07_BUNDLE_SEARCH_DIRS "${EU07_BUNDLE_SEARCH_DIRS}")
|
||||
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DGAME=$<TARGET_FILE:${PROJECT_NAME}>
|
||||
-DSEARCH_DIRS=${EU07_BUNDLE_SEARCH_DIRS}
|
||||
-DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/CMake_modules/bundle_runtime_libs.cmake"
|
||||
COMMENT "Copying the shared libraries next to the game"
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND WITH_PYTHON)
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME} POST_BUILD
|
||||
|
||||
Reference in New Issue
Block a user