-
Notifications
You must be signed in to change notification settings - Fork 142
/
CMakeLists.txt
186 lines (154 loc) · 5.81 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
cmake_minimum_required(VERSION 3.7)
project(RetroEngine)
set(DECOMP_VERSION 1.1.0-a)
set(RETRO_REVISION 3 CACHE STRING "What revision to compile for. Defaults to v5U = 3")
option(RETRO_DISABLE_PLUS "Disable plus. Should be set on for any public releases." OFF)
option(RETRO_MOD_LOADER "Enables or disables the mod loader." ON)
set(RETRO_MOD_LOADER_VER 2 CACHE STRING "Sets the mod loader version. Defaults to latest")
set(RETRO_NAME "RSDKv5")
if(RETRO_REVISION STREQUAL "3")
set(RETRO_NAME "RSDKv5U")
endif()
set(RETRO_OUTPUT_NAME ${RETRO_NAME} CACHE STRING "The exported name of the executable.")
set(RETRO_FILES
RSDKv5/main.cpp
RSDKv5/RSDK/Core/RetroEngine.cpp
RSDKv5/RSDK/Core/Math.cpp
RSDKv5/RSDK/Core/Reader.cpp
RSDKv5/RSDK/Core/Link.cpp
RSDKv5/RSDK/Core/ModAPI.cpp
RSDKv5/RSDK/Dev/Debug.cpp
RSDKv5/RSDK/Storage/Storage.cpp
RSDKv5/RSDK/Storage/Text.cpp
RSDKv5/RSDK/Graphics/Drawing.cpp
RSDKv5/RSDK/Graphics/Scene3D.cpp
RSDKv5/RSDK/Graphics/Animation.cpp
RSDKv5/RSDK/Graphics/Sprite.cpp
RSDKv5/RSDK/Graphics/Palette.cpp
RSDKv5/RSDK/Graphics/Video.cpp
RSDKv5/RSDK/Audio/Audio.cpp
RSDKv5/RSDK/Input/Input.cpp
RSDKv5/RSDK/Scene/Scene.cpp
RSDKv5/RSDK/Scene/Collision.cpp
RSDKv5/RSDK/Scene/Object.cpp
RSDKv5/RSDK/Scene/Objects/DefaultObject.cpp
RSDKv5/RSDK/Scene/Objects/DevOutput.cpp
RSDKv5/RSDK/User/Core/UserAchievements.cpp
RSDKv5/RSDK/User/Core/UserCore.cpp
RSDKv5/RSDK/User/Core/UserLeaderboards.cpp
RSDKv5/RSDK/User/Core/UserPresence.cpp
RSDKv5/RSDK/User/Core/UserStats.cpp
RSDKv5/RSDK/User/Core/UserStorage.cpp
dependencies/all/tinyxml2/tinyxml2.cpp
dependencies/all/iniparser/iniparser.cpp
dependencies/all/iniparser/dictionary.cpp
dependencies/all/miniz/miniz.c
)
if(NOT PLATFORM)
if(WIN32) # THIS ASSUMES VCPKG OR SOURCES !!!!!!!
set(PLATFORM "Windows" CACHE STRING "The platform to compile for.")
elseif(ANDROID)
set(PLATFORM "Android" CACHE STRING "The platform to compile for.")
else()
set(PLATFORM ${CMAKE_SYSTEM_NAME} CACHE STRING "The platform to compile for.")
endif()
endif()
include(platforms/${PLATFORM}.cmake)
# Set C++ standard after including the platform file since they could override mod loader support
# which relies on C++17. Otherwise the engine is mostly C++11.
if(RETRO_MOD_LOADER)
set_target_properties(RetroEngine PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
else()
set_target_properties(RetroEngine PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
endif()
set_target_properties(RetroEngine PROPERTIES OUTPUT_NAME ${RETRO_OUTPUT_NAME})
if(COMPILE_OGG)
set(OGG_DIR dependencies/${DEP_PATH}/libogg)
add_library(
libogg
STATIC
${OGG_DIR}/src/bitwise.c
${OGG_DIR}/src/framing.c
)
target_compile_options(libogg PRIVATE ${OGG_FLAGS})
target_include_directories(libogg PRIVATE ${OGG_DIR}/include)
target_include_directories(RetroEngine PRIVATE ${OGG_DIR}/include)
target_link_libraries(RetroEngine libogg)
endif()
if(COMPILE_THEORA)
set(THEORA_DIR dependencies/android/libtheora)
add_library(libtheora STATIC
${THEORA_DIR}/lib/analyze.c
${THEORA_DIR}/lib/apiwrapper.c
${THEORA_DIR}/lib/bitpack.c
${THEORA_DIR}/lib/cpu.c
${THEORA_DIR}/lib/decapiwrapper.c
${THEORA_DIR}/lib/decinfo.c
${THEORA_DIR}/lib/decode.c
${THEORA_DIR}/lib/dequant.c
${THEORA_DIR}/lib/encapiwrapper.c
${THEORA_DIR}/lib/encfrag.c
${THEORA_DIR}/lib/encinfo.c
${THEORA_DIR}/lib/encode.c
${THEORA_DIR}/lib/encoder_disabled.c
${THEORA_DIR}/lib/enquant.c
${THEORA_DIR}/lib/fdct.c
${THEORA_DIR}/lib/fragment.c
${THEORA_DIR}/lib/huffdec.c
${THEORA_DIR}/lib/huffenc.c
${THEORA_DIR}/lib/idct.c
${THEORA_DIR}/lib/info.c
${THEORA_DIR}/lib/internal.c
${THEORA_DIR}/lib/mathops.c
${THEORA_DIR}/lib/mcenc.c
${THEORA_DIR}/lib/quant.c
${THEORA_DIR}/lib/rate.c
${THEORA_DIR}/lib/state.c
${THEORA_DIR}/lib/tokenize.c
)
target_compile_options(libtheora PRIVATE ${THEORA_FLAGS})
target_include_directories(libtheora PRIVATE ${THEORA_DIR}/include ${OGG_DIR}/include)
target_include_directories(RetroEngine PRIVATE ${THEORA_DIR}/include)
target_link_libraries(RetroEngine libtheora)
endif()
target_include_directories(RetroEngine PRIVATE
RSDKv5/
dependencies/all/
dependencies/all/tinyxml2/
dependencies/all/iniparser/
)
if(DEFINED DEP_PATH)
target_include_directories(RetroEngine PRIVATE
dependencies/${DEP_PATH}/
)
endif()
if(NOT DEFINED GAME_STATIC)
set(GAME_STATIC OFF)
endif()
target_compile_definitions(RetroEngine PRIVATE
RETRO_REVISION=${RETRO_REVISION}
RSDK_USE_${RETRO_SUBSYSTEM}=1
RETRO_USE_MOD_LOADER=$<BOOL:${RETRO_MOD_LOADER}>
RETRO_MOD_LOADER_VER=${RETRO_MOD_LOADER_VER}
RETRO_STANDALONE=$<NOT:$<BOOL:${GAME_STATIC}>>
RSDK_AUTOBUILD=$<BOOL:${RETRO_DISABLE_PLUS}>
RETRO_DEV_EXTRA="${PLATFORM} - ${RETRO_SUBSYSTEM} - ${CMAKE_CXX_COMPILER_ID}"
DECOMP_VERSION="${DECOMP_VERSION}"
)
if(WITH_RSDK)
if(NOT GAME_STATIC)
add_custom_command(TARGET RetroEngine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:${GAME_NAME}>
$<TARGET_FILE_DIR:RetroEngine>)
endif()
target_compile_definitions(${GAME_NAME} PRIVATE
RETRO_REVISION=${RETRO_REVISION}
RETRO_USE_MOD_LOADER=$<BOOL:${RETRO_MOD_LOADER}>
RETRO_MOD_LOADER_VER=${RETRO_MOD_LOADER_VER}
GAME_INCLUDE_EDITOR=$<BOOL:${GAME_INCLUDE_EDITOR}>
MANIA_PREPLUS=$<BOOL:${MANIA_PREPLUS}>
MANIA_FIRST_RELEASE=$<BOOL:${MANIA_FIRST_RELEASE}>
GAME_VERSION=${GAME_VERSION}
)
endif()