-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathCMakeLists.txt
238 lines (215 loc) · 7.72 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#
# Rosalie's Mupen GUI CMakeLists.txt
#
cmake_minimum_required(VERSION 3.15)
option(PORTABLE_INSTALL "Portable Installation" ON)
option(UPDATER "Enables updater" ${WIN32})
option(APPIMAGE_UPDATER "Enables AppImage updater" OFF)
option(DISCORD_RPC "Enables Discord Rich Presence" ON)
option(DRAG_DROP "Enables drag and drop" ON)
option(NETPLAY "Enables netplay" ON)
option(VRU "Enables VRU support in RMG-Input" ON)
option(USE_CCACHE "Enables usage of ccache when ccache has been found" ON)
option(USE_LTO "Enables building with LTO/IPO when compiler supports it" ON)
option(NO_ASM "Disables the usage of assembly in the mupen64plus-core" OFF)
option(NO_RUST "Disables the building of rust subprojects" OFF)
option(USE_LIBFMT "Enables usage of libfmt instead of detecting whether std::format is supported" OFF)
option(USE_ANGRYLION "Enables building angrylion-rdp-plus which uses a non-GPL compliant license" OFF)
project(RMG)
find_package(Git)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE GIT_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(GIT_FOUND)
if (NOT GIT_FOUND OR NOT ${GIT_RESULT} EQUAL 0)
if (NOT ${GIT_RESULT} EQUAL 0)
message(WARNING "git failed to retrieve the current revision, falling back to VERSION file!")
endif()
file(STRINGS "VERSION" GIT_VERSION)
endif()
if (USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
else(CCACHE_FOUND)
set(USE_CCACHE OFF)
endif(CCACHE_FOUND)
endif(USE_CCACHE)
if (USE_LTO)
include(CheckIPOSupported)
check_ipo_supported(RESULT ENABLE_IPO)
# ensure we don't enable LTO on Debug builds
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
if(ENABLE_IPO)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif(ENABLE_IPO)
endif()
endif(USE_LTO)
if (NOT USE_LIBFMT)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <format>
int main(void)
{
std::string str = std::format(\"number: {}\", 10);
return 0;
}" HAVE_STDFORMAT)
# fallback to libfmt if std::format
# isn't supported in the compiler
if (NOT HAVE_STDFORMAT)
set(USE_LIBFMT ON)
endif(NOT HAVE_STDFORMAT)
endif(NOT USE_LIBFMT)
if (NOT PORTABLE_INSTALL AND WIN32)
message(WARNING "Not-Portable build not supported on windows, re-enabling PORTABLE_INSTALL!")
set(PORTABLE_INSTALL ON)
endif()
if (NOT PORTABLE_INSTALL AND UPDATER AND NOT APPIMAGE_UPDATER)
message(WARNING "Not-Portable builds don't support the updater, disabling UPDATER")
set(UPDATER OFF)
endif()
if (APPIMAGE_UPDATER AND WIN32)
message(WARNING "AppImage updater not supported on windows, disabling APPIMAGE_UPDATER!")
set(APPIMAGE_UPDATER OFF)
endif()
if (UPDATER AND NOT WIN32 AND NOT APPIMAGE_UPDATER)
message(WARNING "Only AppImage updater is supported on linux, disabling UPDATER!")
set(UPDATER OFF)
endif()
if (FORCE_XCB AND WIN32)
message(WARNING "XCB Qt platform not supported on windows, disabling FORCE_XCB!")
set(FORCE_XCB OFF)
endif()
if (PORTABLE_INSTALL)
set(CMAKE_INSTALL_PREFIX "")
set(INSTALL_PATH "Bin/${CMAKE_BUILD_TYPE}")
set(RMG_INSTALL_PATH "${INSTALL_PATH}")
set(SYSTEM_LIB_INSTALL_PATH "${INSTALL_PATH}")
set(LIB_INSTALL_PATH "${INSTALL_PATH}")
set(CORE_INSTALL_PATH "${INSTALL_PATH}/Core")
set(PLUGIN_INSTALL_PATH "${INSTALL_PATH}/Plugin")
set(DATA_INSTALL_PATH "${INSTALL_PATH}/Data")
set(INSTALL_DESKTOP_FILE OFF)
else()
include(GNUInstallDirs)
set(RMG_INSTALL_PATH "${CMAKE_INSTALL_BINDIR}")
set(SYSTEM_LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}")
set(LIB_INSTALL_PATH "${SYSTEM_LIB_INSTALL_PATH}/RMG")
set(CORE_INSTALL_PATH "${SYSTEM_LIB_INSTALL_PATH}/RMG/Core")
set(PLUGIN_INSTALL_PATH "${SYSTEM_LIB_INSTALL_PATH}/RMG/Plugin")
set(DATA_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/RMG")
set(INSTALL_DESKTOP_FILE ON)
set(METAINFO_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/metainfo/")
set(DESKTOP_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/applications")
set(ICON_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps/")
endif()
add_subdirectory(Source/3rdParty)
add_subdirectory(Source/3rdParty/lzma)
if (VRU)
add_subdirectory(Source/3rdParty/vosk-api)
endif(VRU)
add_subdirectory(Source/RMG-Core)
add_subdirectory(Source/RMG)
add_subdirectory(Source/RMG-Audio)
add_subdirectory(Source/RMG-Input)
install(TARGETS RMG-Core
DESTINATION ${SYSTEM_LIB_INSTALL_PATH}
)
install(TARGETS RMG
DESTINATION ${RMG_INSTALL_PATH}
)
install(TARGETS RMG-Audio
DESTINATION ${PLUGIN_INSTALL_PATH}/Audio
)
install(TARGETS RMG-Input
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
)
if (WIN32)
add_subdirectory(Source/Installer)
add_custom_target(bundle_dependencies
COMMAND bash "${CMAKE_SOURCE_DIR}/Source/Script/BundleDependencies.sh" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}/RMG.exe" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}" "/mingw64/bin"
)
endif(WIN32)
set(LIB_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
install(FILES ${MUPEN64PLUSCORE_LIB}
DESTINATION ${CORE_INSTALL_PATH}
PERMISSIONS ${LIB_PERMISSIONS}
)
install(FILES ${MUPEN64PLUSCORE_INI} Data/font.ttf
DESTINATION ${DATA_INSTALL_PATH}
)
if (VRU)
install(FILES ${VOSK_API_LIBRARY}
DESTINATION ${LIB_INSTALL_PATH}
PERMISSIONS ${LIB_PERMISSIONS}
)
install(FILES ${VOSK_API_MODEL}
DESTINATION ${DATA_INSTALL_PATH}
)
endif(VRU)
install(FILES ${SDL_GAMECONTROLLERDB}
DESTINATION ${DATA_INSTALL_PATH}
)
file(GLOB GENERATED_CHEAT_FILES ${CMAKE_SOURCE_DIR}/Data/Cheats/Generated/*.cht)
file(GLOB CUSTOM_CHEAT_FILES ${CMAKE_SOURCE_DIR}/Data/Cheats/Custom/*.cht)
install(FILES ${GENERATED_CHEAT_FILES} ${CUSTOM_CHEAT_FILES}
DESTINATION ${DATA_INSTALL_PATH}/Cheats
)
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_CXD4}
DESTINATION ${PLUGIN_INSTALL_PATH}/RSP
PERMISSIONS ${LIB_PERMISSIONS}
)
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_HLE}
DESTINATION ${PLUGIN_INSTALL_PATH}/RSP
PERMISSIONS ${LIB_PERMISSIONS}
)
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_PARALLEL}
DESTINATION ${PLUGIN_INSTALL_PATH}/RSP
PERMISSIONS ${LIB_PERMISSIONS}
)
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_RAPHNET}
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
PERMISSIONS ${LIB_PERMISSIONS}
)
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_GCA}
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
PERMISSIONS ${LIB_PERMISSIONS}
)
if (USE_ANGRYLION)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_ANGRYLION}
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
PERMISSIONS ${LIB_PERMISSIONS}
)
endif(USE_ANGRYLION)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_GLIDEN64}
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
PERMISSIONS ${LIB_PERMISSIONS}
)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_GLIDEN64_DATA}
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_PARALLEL}
DESTINATION ${PLUGIN_INSTALL_PATH}/GFX
PERMISSIONS ${LIB_PERMISSIONS}
)
if (INSTALL_DESKTOP_FILE)
install(FILES Package/com.github.Rosalie241.RMG.desktop
DESTINATION ${DESKTOP_INSTALL_PATH}
)
install(FILES Package/com.github.Rosalie241.RMG.svg
DESTINATION ${ICON_INSTALL_PATH}
)
install(FILES Package/com.github.Rosalie241.RMG.metainfo.xml
DESTINATION ${METAINFO_INSTALL_PATH}
)
endif(INSTALL_DESKTOP_FILE)