| 1 |
# Sub build: MiniCore engine |
| 2 |
add_subdirectory(MiniCore) |
| 3 |
|
| 4 |
# Sub build: Menu Toolkit From Hell |
| 5 |
add_subdirectory(MTFH) |
| 6 |
|
| 7 |
# Sub build: Sound Toolkit From Hell |
| 8 |
add_subdirectory(STFH) |
| 9 |
|
| 10 |
# Engine include paths |
| 11 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/MiniCore/src/Asset") |
| 12 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/MiniCore/src/Core") |
| 13 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/MiniCore/src/Graphics") |
| 14 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/MiniCore/src/Particles") |
| 15 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/MiniCore/src/Physics") |
| 16 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/MiniCore/src/Text") |
| 17 |
|
| 18 |
# Menu toolkit and menu include paths |
| 19 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/MTFH") |
| 20 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/menu") |
| 21 |
|
| 22 |
# Sound toolkit include paths |
| 23 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/STFH") |
| 24 |
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/audio") |
| 25 |
|
| 26 |
# Translation files in src/game/translations (without .ts) |
| 27 |
set(TS dustrac-game_fi dustrac-game_it dustrac-game_cs dustrac-game_fr dustrac-game_de dustrac-game_nl dustrac-game_tr) |
| 28 |
set(TS_FILES) |
| 29 |
set(QM_FILES) |
| 30 |
foreach(TS_FILE ${TS}) |
| 31 |
list(APPEND TS_FILES ${CMAKE_SOURCE_DIR}/src/game/translations/${TS_FILE}.ts) |
| 32 |
list(APPEND QM_FILES ${CMAKE_BINARY_DIR}/data/translations/${TS_FILE}.qm) |
| 33 |
endforeach() |
| 34 |
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/data/translations) |
| 35 |
|
| 36 |
# Set headers that don't have a corresponding cpp file |
| 37 |
set(HDR |
| 38 |
layers.hpp |
| 39 |
shaders.h |
| 40 |
shaders30.h |
| 41 |
../common/userexception.hpp |
| 42 |
) |
| 43 |
|
| 44 |
# Set sources |
| 45 |
set(SRC |
| 46 |
ai.cpp |
| 47 |
application.cpp |
| 48 |
bridge.cpp |
| 49 |
car.cpp |
| 50 |
carfactory.cpp |
| 51 |
carparticleeffectmanager.cpp |
| 52 |
carphysicscomponent.cpp |
| 53 |
carsoundeffectmanager.cpp |
| 54 |
carstatusview.cpp |
| 55 |
checkeredflag.cpp |
| 56 |
crashoverlay.cpp |
| 57 |
database.cpp |
| 58 |
difficultyprofile.cpp |
| 59 |
eventhandler.cpp |
| 60 |
fadeanimation.cpp |
| 61 |
fontfactory.cpp |
| 62 |
game.cpp |
| 63 |
gearbox.cpp |
| 64 |
graphicsfactory.cpp |
| 65 |
inputhandler.cpp |
| 66 |
intro.cpp |
| 67 |
main.cpp |
| 68 |
map.cpp |
| 69 |
messageoverlay.cpp |
| 70 |
minimap.cpp |
| 71 |
particlefactory.cpp |
| 72 |
pit.cpp |
| 73 |
offtrackdetector.cpp |
| 74 |
overlaybase.cpp |
| 75 |
race.cpp |
| 76 |
renderer.cpp |
| 77 |
scene.cpp |
| 78 |
settings.cpp |
| 79 |
startlights.cpp |
| 80 |
startlightsoverlay.cpp |
| 81 |
statemachine.cpp |
| 82 |
timing.cpp |
| 83 |
timingoverlay.cpp |
| 84 |
tire.cpp |
| 85 |
track.cpp |
| 86 |
trackdata.cpp |
| 87 |
trackloader.cpp |
| 88 |
trackobject.cpp |
| 89 |
trackobjectfactory.cpp |
| 90 |
tracktile.cpp |
| 91 |
tree.cpp |
| 92 |
../common/config.hpp |
| 93 |
../common/datakeywords.hpp |
| 94 |
../common/objectbase.cpp |
| 95 |
../common/objects.cpp |
| 96 |
../common/route.cpp |
| 97 |
../common/targetnodebase.cpp |
| 98 |
../common/trackdatabase.cpp |
| 99 |
../common/tracktilebase.cpp |
| 100 |
../common/mapbase.cpp |
| 101 |
audio/audioworker.cpp |
| 102 |
audio/audiosource.cpp |
| 103 |
audio/openaldata.cpp |
| 104 |
audio/openaldevice.cpp |
| 105 |
audio/openalsource.cpp |
| 106 |
audio/openaloggdata.cpp |
| 107 |
audio/openalwavdata.cpp |
| 108 |
menu/confirmationmenu.cpp |
| 109 |
menu/credits.cpp |
| 110 |
menu/difficultymenu.cpp |
| 111 |
menu/help.cpp |
| 112 |
menu/keyconfigmenu.cpp |
| 113 |
menu/lapcountmenu.cpp |
| 114 |
menu/mainmenu.cpp |
| 115 |
menu/resolutionmenu.cpp |
| 116 |
menu/settingsmenu.cpp |
| 117 |
menu/surfacemenu.cpp |
| 118 |
menu/textmenuitemview.cpp |
| 119 |
menu/trackselectionmenu.cpp |
| 120 |
menu/vsyncmenu.cpp |
| 121 |
) |
| 122 |
|
| 123 |
set(RCS ${CMAKE_SOURCE_DIR}/data/icons/icons.qrc) |
| 124 |
|
| 125 |
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
| 126 |
|
| 127 |
qt_add_resources(RC_SRC ${RCS}) |
| 128 |
qt_add_translation(QM ${TS_FILES}) |
| 129 |
|
| 130 |
# Copy desktop file |
| 131 |
if(ReleaseBuild AND UNIX) |
| 132 |
set(DesktopFileSourcePath) |
| 133 |
if(USC) |
| 134 |
set(DesktopFileSourcePath ${CMAKE_SOURCE_DIR}/src/dustrac-game.desktop.opt.in) |
| 135 |
else() |
| 136 |
set(DesktopFileSourcePath ${CMAKE_SOURCE_DIR}/src/dustrac-game.desktop.in) |
| 137 |
endif() |
| 138 |
add_custom_target(desktop-file-game ALL |
| 139 |
COMMAND cmake -E copy ${DesktopFileSourcePath} |
| 140 |
${CMAKE_BINARY_DIR}/dustrac-game.desktop |
| 141 |
DEPENDS ${GAME_BINARY_NAME}) |
| 142 |
endif() |
| 143 |
|
| 144 |
# Resource compilation for MinGW |
| 145 |
if(MINGW) |
| 146 |
add_custom_command( |
| 147 |
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/windowsrc.o |
| 148 |
COMMAND |
| 149 |
${CMAKE_RC_COMPILER} |
| 150 |
-I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/data/icons/WindowsGame.rc |
| 151 |
-o ${CMAKE_CURRENT_BINARY_DIR}/windowsrc.o) |
| 152 |
set(SRC ${SRC} ${CMAKE_CURRENT_BINARY_DIR}/windowsrc.o) |
| 153 |
endif() |
| 154 |
|
| 155 |
# The main game executable |
| 156 |
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) |
| 157 |
add_executable(${GAME_BINARY_NAME} WIN32 ${HDR} ${SRC} ${MOC_SRC} ${RC_SRC} ${QM}) |
| 158 |
|
| 159 |
set(COMMON_LIBS |
| 160 |
MiniCore |
| 161 |
MTFH |
| 162 |
STFH |
| 163 |
${OPENAL_LIBRARY} |
| 164 |
${VORBISFILE_LIBRARIES} |
| 165 |
${VORBISFILE_LIB} # Valid only with MSVC |
| 166 |
${VORBIS_LIB} # Valid only with MSVC |
| 167 |
${OGG_LIB}) # Valid only with MSVC |
| 168 |
|
| 169 |
target_link_libraries(${GAME_BINARY_NAME} ${COMMON_LIBS} Qt6::OpenGL Qt6::Sql Qt6::Xml ${DUSTRAC_OPENGL_LIBS} SimpleLogger_static Argengine_static) |
| 170 |
set_property(TARGET ${GAME_BINARY_NAME} PROPERTY CXX_STANDARD 17) |
| 171 |
|
| 172 |
if(BUILD_TESTING) |
| 173 |
add_subdirectory(unittests) |
| 174 |
endif() |