-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
518 lines (349 loc) · 14.7 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
cmake_minimum_required(VERSION 3.15)
option(ACCURATE_FPU "Build mupen64plus-core with accurate FPU behavior" ON)
option(NO_ASM "Build mupen64plus-core without assembly" OFF)
option(USE_PARALLEL_RSP "Build mupen64plus-rsp-parallel" ON)
option(USE_RAPHNETRAW "Build mupen64plus-input-raphnetraw" ON)
option(USE_GCA "Build mupen64plus-input-gca" ON)
option(USE_ANGRYLION "Build mupen64plus-video-angrylion-plus" ON)
option(USE_PARALLEL_RDP "Build mupen64plus-video-parallel" ON)
option(USE_RICE "Build mupen64plus-video-rice" ON)
option(USE_GLIDE64MK2 "Build mupen64plus-video-glide64mk2" ON)
project(EMG)
if(APPLE)
set(INSTALL_PATH ${CMAKE_SOURCE_DIR}/build/EMG/EMG.app/Contents/Resources/m64p)
else()
set(INSTALL_PATH ${CMAKE_SOURCE_DIR}/build/EMG/resources/m64p)
endif()
add_custom_target(bundle_dependencies
COMMAND bash "${CMAKE_SOURCE_DIR}/dependencies.sh" "${INSTALL_PATH}/mupen64plus.exe" "${INSTALL_PATH}" "/mingw64/bin"
)
include(ExternalProject)
if(WIN32)
set(LIB_EXT ".dll")
set(BIN_EXT ".exe")
set(GCA_LIB "mupen64plus_input_gca.dll")
elseif(APPLE)
set(LIB_EXT ".dylib")
set(BIN_EXT "")
set(GCA_LIB "libmupen64plus_input_gca.dylib")
else()
set(LIB_EXT ".so")
set(BIN_EXT "")
set(GCA_LIB "libmupen64plus_input_gca.so")
endif()
set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source)
set(APIDIR ${SOURCEDIR}/mupen64plus-core/src/api)
set(GLIDEN64_DIR ${CMAKE_BINARY_DIR}/mupen64plus-video-GLideN64)
set(GLIDEN64_BUILD_DIR ${GLIDEN64_DIR}/projects/cmake)
if(WIN32)
set(GLIDEN64_LIB ${GLIDEN64_BUILD_DIR}/mupen64plus-video-GLideN64${LIB_EXT})
else()
set(GLIDEN64_LIB ${GLIDEN64_BUILD_DIR}/plugin/Release/mupen64plus-video-GLideN64${LIB_EXT})
endif()
ExternalProject_Add(mupen64plus-core
SOURCE_DIR ${SOURCEDIR}/mupen64plus-core/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-core/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-core/src
SUBDIR=${SOURCEDIR}/mupen64plus-core/subprojects
ACCURATE_FPU=$<BOOL:${ACCURATE_FPU}> NEW_DYNAREC=0 NO_ASM=$<BOOL:${NO_ASM}> OSD=0 TARGET=mupen64plus${LIB_EXT}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-core/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-core/projects/unix/mupen64plus${LIB_EXT}
)
ExternalProject_Add(mupen64plus-core-nd
SOURCE_DIR ${SOURCEDIR}/mupen64plus-core/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-core/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-core/src
SUBDIR=${SOURCEDIR}/mupen64plus-core/subprojects
ACCURATE_FPU=$<BOOL:${ACCURATE_FPU}> NEW_DYNAREC=1 NO_ASM=$<BOOL:${NO_ASM}> OSD=0 TARGET=mupen64plus-nd${LIB_EXT}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-core-nd/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-core-nd/projects/unix/mupen64plus-nd${LIB_EXT}
)
ExternalProject_Add(mupen64plus-ui-console
SOURCE_DIR ${SOURCEDIR}/mupen64plus-ui-console/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-ui-console/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-ui-console/src
APIDIR=${APIDIR}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-ui-console/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-ui-console/projects/unix/mupen64plus${BIN_EXT}
)
ExternalProject_Add(mupen64plus-rsp-cxd4
SOURCE_DIR ${SOURCEDIR}/mupen64plus-rsp-cxd4/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-rsp-cxd4/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-rsp-cxd4
APIDIR=${APIDIR} POSTFIX=
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-rsp-cxd4/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-rsp-cxd4/projects/unix/mupen64plus-rsp-cxd4${LIB_EXT}
)
ExternalProject_Add(mupen64plus-rsp-hle
SOURCE_DIR ${SOURCEDIR}/mupen64plus-rsp-hle/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-rsp-hle/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-rsp-hle/src
APIDIR=${APIDIR} POSTFIX=
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-rsp-hle/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-rsp-hle/projects/unix/mupen64plus-rsp-hle${LIB_EXT}
)
if(USE_PARALLEL_RSP)
ExternalProject_Add(mupen64plus-rsp-parallel
SOURCE_DIR ${SOURCEDIR}/mupen64plus-rsp-parallel
INSTALL_COMMAND ""
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-rsp-parallel
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-rsp-parallel/mupen64plus-rsp-parallel${LIB_EXT}
)
endif()
ExternalProject_Add(mupen64plus-input-sdl
SOURCE_DIR ${SOURCEDIR}/mupen64plus-input-sdl/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-input-sdl/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-input-sdl/src
APIDIR=${APIDIR}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-input-sdl/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-input-sdl/projects/unix/mupen64plus-input-sdl${LIB_EXT}
)
if(USE_RAPHNETRAW)
ExternalProject_Add(mupen64plus-input-raphnetraw
SOURCE_DIR ${SOURCEDIR}/mupen64plus-input-raphnetraw/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-input-raphnetraw/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-input-raphnetraw/src
APIDIR=${APIDIR}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-input-raphnetraw/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-input-raphnetraw/projects/unix/mupen64plus-input-raphnetraw${LIB_EXT}
)
endif()
if(USE_GCA)
ExternalProject_Add(mupen64plus-input-gca
SOURCE_DIR ${SOURCEDIR}/mupen64plus-input-gca/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND cargo build --manifest-path ${SOURCEDIR}/mupen64plus-input-gca/Cargo.toml --release --features "m64p_compat" --target-dir=${CMAKE_BINARY_DIR}/mupen64plus-input-gca/target
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-input-gca/target/release
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-input-gca/target/release/${GCA_LIB}
)
endif()
if(USE_ANGRYLION)
ExternalProject_Add(mupen64plus-video-angrylion-plus
SOURCE_DIR ${SOURCEDIR}/mupen64plus-video-angrylion-plus
INSTALL_COMMAND ""
BUILD_IN_SOURCE False
CMAKE_ARGS -DBUILD_PROJECT64=OFF
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-video-angrylion-plus
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-video-angrylion-plus/mupen64plus-video-angrylion-plus${LIB_EXT}
)
endif()
ExternalProject_Add(mupen64plus-video-GLideN64
SOURCE_DIR ${SOURCEDIR}/mupen64plus-video-GLideN64
INSTALL_COMMAND ""
BUILD_IN_SOURCE False
CMAKE_ARGS -DMUPENPLUSAPI=ON -DUSE_SYSTEM_LIBS=ON
SOURCE_SUBDIR ./src/
BINARY_DIR ${GLIDEN64_BUILD_DIR}
BUILD_BYPRODUCTS ${GLIDEN64_LIB}
BUILD_BYPRODUCTS ${SOURCEDIR}/mupen64plus-video-GLideN64/ini/GLideN64.custom.ini
)
if(USE_PARALLEL_RDP)
ExternalProject_Add(mupen64plus-video-parallel
SOURCE_DIR ${SOURCEDIR}/mupen64plus-video-parallel
INSTALL_COMMAND ""
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-video-parallel
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-video-parallel/mupen64plus-video-parallel${LIB_EXT}
)
endif()
if(USE_RICE)
ExternalProject_Add(mupen64plus-video-rice
SOURCE_DIR ${SOURCEDIR}/mupen64plus-video-rice/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-video-rice/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-video-rice/src
APIDIR=${APIDIR}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-video-rice/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-video-rice/projects/unix/mupen64plus-video-rice${LIB_EXT}
)
endif()
if(USE_GLIDE64MK2)
ExternalProject_Add(mupen64plus-video-glide64mk2
SOURCE_DIR ${SOURCEDIR}/mupen64plus-video-glide64mk2/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-video-glide64mk2/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-video-glide64mk2/src
APIDIR=${APIDIR}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-video-glide64mk2/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-video-glide64mk2/projects/unix/mupen64plus-video-glide64mk2${LIB_EXT}
)
endif()
ExternalProject_Add(mupen64plus-audio-sdl
SOURCE_DIR ${SOURCEDIR}/mupen64plus-audio-sdl/
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
BUILD_COMMAND make all -f ${SOURCEDIR}/mupen64plus-audio-sdl/projects/unix/Makefile
SRCDIR=${SOURCEDIR}/mupen64plus-audio-sdl/src
APIDIR=${APIDIR}
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/mupen64plus-audio-sdl/projects/unix
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mupen64plus-audio-sdl/projects/unix/mupen64plus-audio-sdl${LIB_EXT}
)
ExternalProject_Add(sdl-jstest
SOURCE_DIR ${SOURCEDIR}/sdl-jstest/
INSTALL_COMMAND ""
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/sdl-jstest
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/sdl-jstest/sdl2-jstest${BIN_EXT}
)
if(APPLE)
ExternalProject_Add(macdylibbundler
SOURCE_DIR ${SOURCEDIR}/macdylibbundler/
INSTALL_COMMAND ""
BUILD_IN_SOURCE False
BINARY_DIR ${CMAKE_BINARY_DIR}/macdylibbundler
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/macdylibbundler/dylibbundler${BIN_EXT}
)
endif()
ExternalProject_Get_property(mupen64plus-core BUILD_BYPRODUCTS)
set(MUPEN64PLUSCORE_LIB ${BUILD_BYPRODUCTS})
set(MUPEN64PLUSCORE_INI ${SOURCEDIR}/mupen64plus-core/data/mupen64plus.ini)
set(MUPEN64PLUSCORE_CHT ${SOURCEDIR}/mupen64plus-core/data/mupencheat.txt)
ExternalProject_Get_property(mupen64plus-core-nd BUILD_BYPRODUCTS)
set(MUPEN64PLUSCORE_ND_LIB ${BUILD_BYPRODUCTS})
ExternalProject_Get_property(mupen64plus-ui-console BUILD_BYPRODUCTS)
set(MUPEN64PLUS_UI ${BUILD_BYPRODUCTS})
ExternalProject_Get_property(mupen64plus-rsp-cxd4 BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_RSP_CXD4 ${BUILD_BYPRODUCTS})
ExternalProject_Get_property(mupen64plus-rsp-hle BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_RSP_HLE ${BUILD_BYPRODUCTS})
if(USE_PARALLEL_RSP)
ExternalProject_Get_property(mupen64plus-rsp-parallel BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_RSP_PARALLEL ${BUILD_BYPRODUCTS})
endif()
ExternalProject_Get_property(mupen64plus-input-sdl BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_INPUT_SDL ${BUILD_BYPRODUCTS})
if(USE_RAPHNETRAW)
ExternalProject_Get_property(mupen64plus-input-raphnetraw BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_INPUT_RAPHNET ${BUILD_BYPRODUCTS})
endif()
if(USE_GCA)
ExternalProject_Get_property(mupen64plus-input-gca BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_INPUT_GCA ${BUILD_BYPRODUCTS})
endif()
if(USE_ANGRYLION)
ExternalProject_Get_property(mupen64plus-video-angrylion-plus BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_GFX_ANGRYLION ${BUILD_BYPRODUCTS})
endif()
ExternalProject_Get_property(mupen64plus-video-GLideN64 BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_GFX_GLIDEN64 ${BUILD_BYPRODUCTS})
if(USE_PARALLEL_RDP)
ExternalProject_Get_property(mupen64plus-video-parallel BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_GFX_PARALLEL ${BUILD_BYPRODUCTS})
endif()
if(USE_RICE)
ExternalProject_Get_property(mupen64plus-video-rice BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_GFX_RICE ${BUILD_BYPRODUCTS})
endif()
set(RICE_INI ${SOURCEDIR}/mupen64plus-video-rice/data/RiceVideoLinux.ini)
if(USE_GLIDE64MK2)
ExternalProject_Get_property(mupen64plus-video-glide64mk2 BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_GFX_GLIDE ${BUILD_BYPRODUCTS})
endif()
set(GLIDE_INI ${SOURCEDIR}/mupen64plus-video-glide64mk2/data/Glide64mk2.ini)
ExternalProject_Get_property(mupen64plus-audio-sdl BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_AUDIO_SDL ${BUILD_BYPRODUCTS})
ExternalProject_Get_property(sdl-jstest BUILD_BYPRODUCTS)
set(SDL_JSTEST ${BUILD_BYPRODUCTS})
if(APPLE)
ExternalProject_Get_property(macdylibbundler BUILD_BYPRODUCTS)
set(DYLIBBUNDLER ${BUILD_BYPRODUCTS})
endif()
install(FILES ${MUPEN64PLUS_UI}
DESTINATION ${INSTALL_PATH}
)
install(FILES ${SDL_JSTEST}
DESTINATION ${INSTALL_PATH}
)
if(APPLE)
install(FILES ${DYLIBBUNDLER}
DESTINATION ${INSTALL_PATH}
)
endif()
install(FILES ${MUPEN64PLUSCORE_LIB}
DESTINATION ${INSTALL_PATH}
)
install(FILES ${MUPEN64PLUSCORE_ND_LIB}
DESTINATION ${INSTALL_PATH}
)
install(FILES ${MUPEN64PLUSCORE_INI} ${MUPEN64PLUSCORE_CHT} ${RICE_INI} ${GLIDE_INI}
DESTINATION ${INSTALL_PATH}/data
)
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_CXD4}
DESTINATION ${INSTALL_PATH}/plugin
)
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_HLE}
DESTINATION ${INSTALL_PATH}/plugin
)
if(USE_PARALLEL_RSP)
install(FILES ${MUPEN64PLUS_PLUGIN_RSP_PARALLEL}
DESTINATION ${INSTALL_PATH}/plugin
)
endif()
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_SDL}
DESTINATION ${INSTALL_PATH}/plugin
)
if(USE_RAPHNETRAW)
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_RAPHNET}
DESTINATION ${INSTALL_PATH}/plugin
)
endif()
if(USE_GCA)
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_GCA}
DESTINATION ${INSTALL_PATH}/plugin
)
endif()
if(USE_ANGRYLION)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_ANGRYLION}
DESTINATION ${INSTALL_PATH}/plugin
)
endif()
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_GLIDEN64}
DESTINATION ${INSTALL_PATH}/plugin
)
if(USE_PARALLEL_RDP)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_PARALLEL}
DESTINATION ${INSTALL_PATH}/plugin
)
endif()
if(USE_RICE)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_RICE}
DESTINATION ${INSTALL_PATH}/plugin
)
endif()
if(USE_GLIDE64MK2)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_GLIDE}
DESTINATION ${INSTALL_PATH}/plugin
)
endif()
install(FILES ${MUPEN64PLUS_PLUGIN_AUDIO_SDL}
DESTINATION ${INSTALL_PATH}/plugin
)