CMakeLists.txt (view raw)
1cmake_minimum_required(VERSION 2.6)
2project(mGBA C)
3set(BINARY_NAME mgba CACHE INTERNAL "Name of output binaries")
4if(NOT MSVC)
5 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99")
6else()
7 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146")
8endif()
9set(USE_CLI_DEBUGGER ON CACHE BOOL "Whether or not to enable the CLI-mode ARM debugger")
10set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger")
11set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support")
12set(USE_ZLIB ON CACHE BOOL "Whether or not to enable zlib support")
13set(USE_MINIZIP ON CACHE BOOL "Whether or not to enable external minizip support")
14set(USE_PNG ON CACHE BOOL "Whether or not to enable PNG support")
15set(USE_LIBZIP ON CACHE BOOL "Whether or not to enable LIBZIP support")
16set(USE_MAGICK ON CACHE BOOL "Whether or not to enable ImageMagick support")
17set(M_CORE_GBA ON CACHE BOOL "Build Game Boy Advance core")
18set(M_CORE_GB ON CACHE BOOL "Build Game Boy core")
19set(USE_LZMA ON CACHE BOOL "Whether or not to enable 7-Zip support")
20set(BUILD_QT ON CACHE BOOL "Build Qt frontend")
21set(BUILD_SDL ON CACHE BOOL "Build SDL frontend")
22set(BUILD_LIBRETRO OFF CACHE BOOL "Build libretro core")
23if(APPLE)
24 set(BUILD_OPENEMU OFF CACHE BOOL "Build OpenEmu core")
25endif()
26set(BUILD_PERF OFF CACHE BOOL "Build performance profiling tool")
27set(BUILD_TEST OFF CACHE BOOL "Build testing harness")
28set(BUILD_EXAMPLE OFF CACHE BOOL "Build example frontends")
29set(BUILD_STATIC OFF CACHE BOOL "Build a static library")
30set(BUILD_SHARED ON CACHE BOOL "Build a shared library")
31set(SKIP_LIBRARY OFF CACHE BOOL "Skip building the library (useful for only building libretro or OpenEmu cores)")
32set(BUILD_GL ON CACHE STRING "Build with OpenGL")
33set(BUILD_GLES2 OFF CACHE STRING "Build with OpenGL|ES 2")
34set(USE_EPOXY ON CACHE STRING "Build with libepoxy")
35set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies")
36file(GLOB ARM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/*.c)
37file(GLOB LR35902_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/lr35902/*.c)
38file(GLOB GBA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/*.c)
39file(GLOB GB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/*.c)
40file(GLOB GBA_CHEATS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/cheats/*.c)
41file(GLOB GBA_RR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/rr/*.c)
42file(GLOB GBA_EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/extra/*.c)
43file(GLOB UTIL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/*.[cSs] ${CMAKE_CURRENT_SOURCE_DIR}/src/core/*.c)
44file(GLOB GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/gui/*.c ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/gui/*.c)
45file(GLOB GBA_RENDERER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/renderers/*.c)
46file(GLOB SIO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/sio/lockstep.c)
47file(GLOB GB_RENDERER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/renderers/*.c)
48file(GLOB THIRD_PARTY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/inih/*.c)
49set(CLI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/commandline.c)
50set(CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-mem.c)
51set(VFS_SRC)
52source_group("ARM core" FILES ${ARM_SRC})
53source_group("LR35902 core" FILES ${LR35902_SRC})
54source_group("GBA board" FILES ${GBA_SRC} ${GBA_RENDERER_SRC} ${SIO_SRC})
55source_group("GBA extra" FILES ${GBA_CHEATS_SRC} ${GBA_EXTRA_SRC} ${GBA_RR_SRC})
56source_group("GB board" FILES ${GB_SRC})
57source_group("Utilities" FILES ${UTIL_SRC})
58include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src)
59
60if(NOT CMAKE_BUILD_TYPE)
61 set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (e.g. Release or Debug)" FORCE)
62endif()
63
64include(GNUInstallDirs)
65
66if (NOT DEFINED LIBDIR)
67 set(LIBDIR "${CMAKE_INSTALL_LIBDIR}")
68endif()
69
70set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
71
72if (NOT DEFINED MANDIR)
73 set(MANDIR ${CMAKE_INSTALL_MANDIR})
74endif()
75
76# Function definitions
77include(FindPkgConfig)
78function(find_feature FEATURE_NAME FEATURE_REQUIRES)
79 if (NOT ${FEATURE_NAME})
80 return()
81 endif()
82 if (DISABLE_DEPS)
83 set(${FEATURE_NAME} OFF PARENT_SCOPE)
84 return()
85 endif()
86 foreach(REQUIRE ${FEATURE_REQUIRES})
87 if(NOT ${REQUIRE}_FOUND)
88 find_package(${REQUIRE} QUIET)
89 if(NOT ${REQUIRE}_FOUND)
90 pkg_search_module(${REQUIRE} ${REQUIRE})
91 if (NOT ${REQUIRE}_FOUND)
92 message(WARNING "Requested module ${REQUIRE} missing for feature ${FEATURE_NAME}. Feature disabled.")
93 set(${FEATURE_NAME} OFF PARENT_SCOPE)
94 return()
95 endif()
96 endif()
97 endif()
98 string(TOUPPER ${REQUIRE} UREQUIRE)
99 set(${UREQUIRE}_CFLAGS_OTHER ${${REQUIRE}_CFLAGS_OTHER} PARENT_SCOPE)
100 set(${UREQUIRE}_FOUND ${${REQUIRE}_FOUND} PARENT_SCOPE)
101 set(${UREQUIRE}_INCLUDE_DIRS ${${REQUIRE}_INCLUDE_DIRS} PARENT_SCOPE)
102 set(${UREQUIRE}_LIBRARIES ${${REQUIRE}_LIBRARIES} PARENT_SCOPE)
103 set(${UREQUIRE}_LIBRARY_DIRS ${${REQUIRE}_LIBRARY_DIRS} PARENT_SCOPE)
104 set(${UREQUIRE}_LDFLAGS_OTHER ${${REQUIRE}_LDFLAGS_OTHER} PARENT_SCOPE)
105 endforeach()
106endfunction()
107
108# Version information
109add_custom_target(version-info ALL ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/src/core/version.c.in
110 COMMAND ${CMAKE_COMMAND}
111 -DBINARY_NAME=${BINARY_NAME}
112 -DCONFIG_FILE=${CMAKE_CURRENT_SOURCE_DIR}/src/core/version.c.in
113 -DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/version.c
114 -P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake
115 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
116
117include(${CMAKE_CURRENT_SOURCE_DIR}/version.cmake)
118configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
119list(APPEND UTIL_SRC ${CMAKE_CURRENT_BINARY_DIR}/version.c)
120source_group("Generated sources" FILES ${CMAKE_CURRENT_BINARY_DIR}/version.c)
121
122# Advanced settings
123set(BUILD_LTO ON CACHE BOOL "Build with link-time optimization")
124set(BUILD_PGO OFF CACHE BOOL "Build with profiling-guided optimization")
125set(PGO_STAGE_2 CACHE BOOL "Rebuild for profiling-guided optimization after profiles have been generated")
126set(PGO_DIR "/tmp/gba-pgo/" CACHE PATH "Profiling-guided optimization profiles path")
127mark_as_advanced(BUILD_LTO BUILD_PGO PGO_STAGE_2 PGO_DIR)
128set(PGO_PRE_FLAGS "-fprofile-generate=${PGO_DIR} -fprofile-arcs")
129set(PGO_POST_FLAGS "-fprofile-use=${PGO_DIR} -fbranch-probabilities")
130
131if(BUILD_PGO AND NOT PGO_STAGE_2)
132 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${PGO_PRE_FLAGS}")
133 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PGO_PRE_FLAGS}")
134 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PGO_PRE_FLAGS}")
135elseif(BUILD_PGO AND PGO_STAGE_2)
136 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${PGO_POST_FLAGS}")
137 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PGO_POST_FLAGS}")
138 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PGO_POST_FLAGS}")
139endif()
140
141# Platform support
142if(WIN32)
143 set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}")
144 add_definitions(-D_WIN32_WINNT=0x0600)
145 list(APPEND OS_LIB ws2_32 shlwapi)
146 list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/vfs-w32.c)
147 file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/*.c)
148 source_group("Windows-specific code" FILES ${OS_SRC})
149 if(MSVC)
150 add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
151 endif()
152elseif(UNIX)
153 add_definitions(-DUSE_PTHREADS)
154
155 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
156 add_definitions(-D_GNU_SOURCE)
157 endif()
158 if(NOT APPLE AND NOT HAIKU)
159 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
160 endif()
161
162 list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-dirent.c)
163 file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/posix/*.c)
164 source_group("POSIX-specific code" FILES ${OS_SRC})
165endif()
166
167if(APPLE)
168 add_definitions(-D_DARWIN_C_SOURCE)
169 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
170endif()
171
172if(NOT HAIKU AND NOT MSVC AND NOT PSP2)
173 set(M_LIBRARY m)
174endif()
175list(APPEND OS_LIB ${M_LIBRARY})
176
177if(APPLE OR CMAKE_C_COMPILER_ID STREQUAL "GNU" AND BUILD_LTO)
178 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
179 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
180endif()
181
182if(BUILD_BBB OR BUILD_RASPI OR BUILD_PANDORA)
183 if(NOT BUILD_EGL)
184 add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5)
185 endif()
186endif()
187
188if(BUILD_RASPI)
189 set(BUILD_GL OFF CACHE BOOL "OpenGL not supported" FORCE)
190endif()
191
192if(BUILD_PANDORA)
193 add_definitions(-DBUILD_PANDORA)
194endif()
195
196if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*")
197 enable_language(ASM)
198endif()
199
200if(PSP2 OR WII)
201 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
202endif()
203
204if(DEFINED 3DS OR DEFINED PSP2 OR DEFINED WII OR NOT M_CORE_GBA)
205 set(USE_GDB_STUB OFF)
206endif()
207
208if(WII)
209 add_definitions(-U__STRICT_ANSI__)
210endif()
211
212include(CheckFunctionExists)
213check_function_exists(strdup HAVE_STRDUP)
214check_function_exists(strndup HAVE_STRNDUP)
215check_function_exists(localtime_r HAVE_LOCALTIME_R)
216if(NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
217 check_function_exists(snprintf_l HAVE_SNPRINTF_L)
218 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
219 # The strtof_l on Linux not actually exposed nor actually strtof_l
220 set(HAVE_STRTOF_L OFF)
221 else()
222 check_function_exists(strtof_l HAVE_STRTOF_L)
223 endif()
224 check_function_exists(newlocale HAVE_NEWLOCALE)
225 check_function_exists(freelocale HAVE_FREELOCALE)
226 check_function_exists(uselocale HAVE_USELOCALE)
227 check_function_exists(setlocale HAVE_SETLOCALE)
228else()
229 if(NOT DEFINED 3DS AND NOT DEFINED PSP2 AND NOT DEFINED WII)
230 set(DISABLE_DEPS ON CACHE BOOL "This platform cannot build with dependencies" FORCE)
231 endif()
232 set(DISABLE_FRONTENDS ON)
233 set(MINIMAL_CORE ON)
234endif()
235
236check_function_exists(chmod HAVE_CHMOD)
237check_function_exists(umask HAVE_UMASK)
238
239set(FUNCTION_DEFINES)
240
241if(HAVE_STRDUP)
242 list(APPEND FUNCTION_DEFINES HAVE_STRDUP)
243endif()
244
245if(HAVE_STRNDUP)
246 list(APPEND FUNCTION_DEFINES HAVE_STRNDUP)
247endif()
248
249if(HAVE_LOCALTIME_R)
250 list(APPEND FUNCTION_DEFINES HAVE_LOCALTIME_R)
251endif()
252
253if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE OR APPLE)
254 list(APPEND FUNCTION_DEFINES HAVE_LOCALE)
255 if (HAVE_STRTOF_L)
256 list(APPEND FUNCTION_DEFINES HAVE_STRTOF_L)
257 endif()
258 if (HAVE_SNPRINTF_L)
259 list(APPEND FUNCTION_DEFINES HAVE_SNPRINTF_L)
260 endif()
261endif()
262
263if(HAVE_SETLOCALE)
264 list(APPEND FUNCTION_DEFINES HAVE_SETLOCALE)
265endif()
266
267if(HAVE_CHMOD)
268 list(APPEND FUNCTION_DEFINES HAVE_CHMOD)
269endif()
270
271if(HAVE_UMASK)
272 list(APPEND FUNCTION_DEFINES HAVE_UMASK)
273endif()
274
275# Feature dependencies
276set(FEATURES)
277if(CMAKE_SYSTEM_NAME MATCHES .*BSD)
278 set(LIBEDIT_LIBRARIES -ledit)
279 if (CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
280 list(APPEND LIBEDIT_LIBRARIES -ltermcap)
281 endif()
282else()
283 find_feature(USE_CLI_DEBUGGER "libedit")
284endif()
285if(BUILD_GL)
286 find_package(OpenGL QUIET)
287 if(NOT OPENGL_FOUND)
288 set(BUILD_GL OFF CACHE BOOL "OpenGL not found" FORCE)
289 endif()
290endif()
291if(NOT BUILD_GL)
292 set(OPENGLE_LIBRARY "" CACHE PATH "" FORCE)
293endif()
294if(BUILD_GLES2 AND NOT BUILD_RASPI)
295 find_path(OPENGLES2_INCLUDE_DIR NAMES GLES2/gl2.h)
296 find_library(OPENGLES2_LIBRARY NAMES GLESv2 GLESv2_CM)
297 if(NOT OPENGLES2_INCLUDE_DIR OR NOT OPENGLES2_LIBRARY)
298 set(BUILD_GLES2 OFF CACHE BOOL "OpenGL|ES 2 not found" FORCE)
299 endif()
300endif()
301if(NOT BUILD_GLES2)
302 set(OPENGLES2_LIBRARY "" CACHE PATH "" FORCE)
303endif()
304set(WANT_ZLIB ${USE_ZLIB})
305set(WANT_PNG ${USE_PNG})
306set(WANT_LIBZIP ${USE_LIBZIP})
307
308find_feature(USE_FFMPEG "libavcodec;libavformat;libavresample;libavutil;libswscale")
309find_feature(USE_ZLIB "ZLIB")
310find_feature(USE_MINIZIP "minizip")
311find_feature(USE_PNG "PNG")
312find_feature(USE_LIBZIP "libzip")
313find_feature(USE_MAGICK "MagickWand")
314find_feature(USE_EPOXY "epoxy")
315
316# Features
317set(DEBUGGER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/debugger.c)
318set(FEATURE_SRC)
319set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")
320
321if(DISABLE_DEPS)
322 set(USE_GDB_STUB OFF)
323endif()
324
325if(USE_CLI_DEBUGGER)
326 list(APPEND FEATURES CLI_DEBUGGER)
327 list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/cli-debugger.c)
328 list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/parser.c)
329 if(M_CORE_GBA)
330 list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/debugger/cli-debugger.c)
331 list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/extra/cli.c)
332 endif()
333 if(M_CORE_GB)
334 list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/lr35902/debugger/cli-debugger.c)
335 endif()
336 include_directories(AFTER ${LIBEDIT_INCLUDE_DIRS})
337 link_directories(${LIBEDIT_LIBRARY_DIRS})
338 set(DEBUGGER_LIB ${LIBEDIT_LIBRARIES})
339 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libedit2")
340else()
341 set(DEBUGGER_LIB "")
342endif()
343
344if(USE_GDB_STUB)
345 list(APPEND FEATURES GDB_STUB)
346 list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/gdb-stub.c)
347endif()
348source_group("Debugger" FILES ${DEBUGGER_SRC})
349
350if(USE_FFMPEG)
351 list(APPEND FEATURES FFMPEG)
352 pkg_search_module(LIBSWRESAMPLE QUIET libswresample)
353 if(NOT LIBSWRESAMPLE_FOUND)
354 list(APPEND FEATURES LIBAV)
355 endif()
356 include_directories(AFTER ${LIBAVCODEC_INCLUDE_DIRS} ${LIBAVFORMAT_INCLUDE_DIRS} ${LIBAVRESAMPLE_INCLUDE_DIRS} ${LIBAVUTIL_INCLUDE_DIRS} ${LIBSWSCALE_INCLUDE_DIRS})
357 link_directories(${LIBAVCODEC_LIBRARY_DIRS} ${LIBAVFORMAT_LIBRARY_DIRS} ${LIBAVRESAMPLE_LIBRARY_DIRS} ${LIBAVUTIL_LIBRARY_DIRS} ${LIBSWSCALE_LIBRARY_DIRS})
358 list(APPEND FEATURE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/feature/ffmpeg/ffmpeg-encoder.c")
359 string(REGEX MATCH "^[0-9]+" LIBAVCODEC_VERSION_MAJOR ${libavcodec_VERSION})
360 string(REGEX MATCH "^[0-9]+" LIBAVFORMAT_VERSION_MAJOR ${libavformat_VERSION})
361 string(REGEX MATCH "^[0-9]+" LIBAVRESAMPLE_VERSION_MAJOR ${libavresample_VERSION})
362 string(REGEX MATCH "^[0-9]+" LIBAVUTIL_VERSION_MAJOR ${libavutil_VERSION})
363 string(REGEX MATCH "^[0-9]+" LIBSWSCALE_VERSION_MAJOR ${libswscale_VERSION})
364 list(APPEND DEPENDENCY_LIB ${LIBAVCODEC_LIBRARIES} ${LIBAVFORMAT_LIBRARIES} ${LIBAVRESAMPLE_LIBRARIES} ${LIBAVUTIL_LIBRARIES} ${LIBSWSCALE_LIBRARIES})
365 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libavcodec${LIBAVCODEC_VERSION_MAJOR}|libavcodec-extra-${LIBAVCODEC_VERSION_MAJOR}|libavcodec-ffmpeg${LIBAVCODEC_VERSION_MAJOR}|libavcodec-ffmpeg-extra${LIBAVCODEC_VERSION_MAJOR}")
366 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libavformat${LIBAVFORMAT_VERSION_MAJOR}|libavformat-ffmpeg${LIBAVFORMAT_VERSION_MAJOR}")
367 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libavresample${LIBAVRESAMPLE_VERSION_MAJOR}|libavresample-ffmpeg${LIBAVRESAMPLE_VERSION_MAJOR}")
368 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libavutil${LIBAVUTIL_VERSION_MAJOR}|libavutil-ffmpeg${LIBAVUTIL_VERSION_MAJOR}")
369 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libswscale${LIBSWSCALE_VERSION_MAJOR}|libswscale-ffmpeg${LIBSWSCALE_VERSION_MAJOR}")
370 set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "libavcodec-extra|libavcodec-ffmpeg-extra${LIBAVCODEC_VERSION_MAJOR}")
371 if(APPLE)
372 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework VideoDecodeAcceleration -framework CoreVideo")
373 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework VideoDecodeAcceleration -framework CoreVideo")
374 endif()
375endif()
376
377list(APPEND THIRD_PARTY_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/blip_buf/blip_buf.c")
378
379if(USE_MAGICK)
380 list(APPEND FEATURES MAGICK)
381 include_directories(AFTER ${MAGICKWAND_INCLUDE_DIRS})
382 link_directories(${MAGICKWAND_LIBRARY_DIRS})
383 list(APPEND FEATURE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/feature/imagemagick/imagemagick-gif-encoder.c")
384 list(APPEND DEPENDENCY_LIB ${MAGICKWAND_LIBRARIES})
385 string(REGEX MATCH "^[0-9]+\\.[0-9]+" MAGICKWAND_VERSION_PARTIAL ${MagickWand_VERSION})
386 if(${MAGICKWAND_VERSION_PARTIAL} EQUAL "6.7")
387 set(MAGICKWAND_DEB_VERSION "5")
388 else()
389 set(MAGICKWAND_DEB_VERSION "-6.q16-2")
390 endif()
391 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libmagickwand${MAGICKWAND_DEB_VERSION}")
392endif()
393
394if(WANT_ZLIB AND NOT USE_ZLIB)
395 set(SKIP_INSTALL_ALL ON)
396 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib zlib)
397 set_property(TARGET zlibstatic PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/zlib;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib)
398 set_property(TARGET zlib PROPERTY EXCLUDE_FROM_ALL ON)
399 set_property(TARGET example PROPERTY EXCLUDE_FROM_ALL ON)
400 set_property(TARGET minigzip PROPERTY EXCLUDE_FROM_ALL ON)
401 set(ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
402 set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
403 set(ZLIB_LIBRARY zlibstatic)
404 list(APPEND DEPENDENCY_LIB zlibstatic)
405 set(USE_ZLIB ON)
406endif()
407
408if(USE_ZLIB)
409 list(APPEND FEATURES ZLIB)
410 include_directories(AFTER ${ZLIB_INCLUDE_DIRS})
411 list(APPEND DEPENDENCY_LIB ${ZLIB_LIBRARIES})
412 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},zlib1g")
413endif()
414
415if(WANT_PNG AND USE_ZLIB AND NOT USE_PNG)
416 set(PNG_STATIC ON CACHE BOOL "" FORCE)
417 set(PNG_SHARED OFF CACHE BOOL "" FORCE)
418 set(PNG_TESTS OFF CACHE BOOL "" FORCE)
419 set(SKIP_INSTALL_ALL ON)
420 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng libpng)
421 set_property(TARGET png16_static PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/libpng;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng;${ZLIB_INCLUDE_DIRS})
422 set(PNG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng ${CMAKE_CURRENT_BINARY_DIR}/libpng)
423 list(APPEND DEPENDENCY_LIB png16_static)
424 set(USE_PNG ON)
425endif()
426
427if(USE_PNG)
428 list(APPEND FEATURES PNG)
429 include_directories(AFTER ${PNG_INCLUDE_DIRS})
430 list(APPEND DEPENDENCY_LIB ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
431 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libpng12-0")
432endif()
433
434if(USE_LIBZIP)
435 include_directories(AFTER ${LIBZIP_INCLUDE_DIRS})
436 link_directories(${LIBZIP_LIBRARY_DIRS})
437 list(APPEND DEPENDENCY_LIB ${LIBZIP_LIBRARIES})
438 list(APPEND FEATURES LIBZIP)
439 list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c)
440 string(REGEX MATCH "^[0-9]+" LIBZIP_VERSION_MAJOR ${libzip_VERSION})
441 if (LIBZIP_VERSION_MAJOR LESS 1)
442 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip2")
443 elseif(LIBZIP_VERSION_MAJOR EQUAL 1)
444 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip4")
445 else()
446 message(AUTHOR_WARNING Unknown version of libzip detected: ${libzip_VERSION})
447 endif()
448elseif(USE_MINIZIP)
449 include_directories(AFTER ${MINIZIP_INCLUDE_DIRS})
450 link_directories(${MINIZIP_LIBRARY_DIRS})
451 list(APPEND DEPENDENCY_LIB ${MINIZIP_LIBRARIES})
452 list(APPEND FEATURES MINIZIP)
453 list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c)
454 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libminizip1")
455elseif(USE_ZLIB)
456 list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c
457 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c
458 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c)
459 set_source_files_properties(
460 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/ioapi.c
461 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib/contrib/minizip/unzip.c
462 PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter")
463endif()
464
465if (USE_LZMA)
466 include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/third-party/lzma)
467 add_definitions(-D_7ZIP_PPMD_SUPPPORT)
468 list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-lzma.c)
469 set(LZMA_SRC
470 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zAlloc.c
471 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zArcIn.c
472 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zBuf.c
473 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zBuf2.c
474 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zCrc.c
475 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zCrcOpt.c
476 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zDec.c
477 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/CpuArch.c
478 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Delta.c
479 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/LzmaDec.c
480 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Lzma2Dec.c
481 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Bra.c
482 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Bra86.c
483 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/BraIA64.c
484 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Bcj2.c
485 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Ppmd7.c
486 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/Ppmd7Dec.c
487 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zFile.c
488 ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma/7zStream.c)
489 list(APPEND VFS_SRC ${LZMA_SRC})
490 list(APPEND FEATURES LZMA)
491endif()
492
493if(USE_EPOXY)
494 add_definitions(-DBUILD_GL -DBUILD_GLES2)
495 list(APPEND FEATURES EPOXY)
496 include_directories(AFTER ${EPOXY_INCLUDE_DIRS})
497 set(OPENGLES2_LIBRARY ${EPOXY_LIBRARIES})
498 set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libepoxy0")
499endif()
500
501
502set(FEATURE_DEFINES)
503foreach(FEATURE IN LISTS FEATURES)
504 list(APPEND FEATURE_DEFINES "USE_${FEATURE}")
505endforeach()
506
507set(CORE_SRC)
508if(M_CORE_GB)
509 add_definitions(-DM_CORE_GB)
510 list(APPEND CORE_SRC
511 ${LR35902_SRC}
512 ${CMAKE_CURRENT_SOURCE_DIR}/src/lr35902/debugger/debugger.c
513 ${GB_SRC}
514 ${GB_RENDERER_SRC})
515endif()
516
517if(M_CORE_GBA)
518 add_definitions(-DM_CORE_GBA)
519 list(APPEND CORE_SRC
520 ${ARM_SRC}
521 ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/debugger/debugger.c
522 ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/debugger/memory-debugger.c
523 ${GBA_SRC}
524 ${GBA_CHEATS_SRC}
525 ${GBA_RENDERER_SRC})
526 if(NOT M_CORE_GB)
527 list(APPEND CORE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/audio.c)
528 endif()
529endif()
530
531source_group("Virtual files" FILES ${CORE_VFS_SRC} ${VFS_SRC})
532source_group("Extra features" FILES ${FEATURE_SRC})
533source_group("Third-party code" FILES ${THIRD_PARTY_SRC})
534
535# Platform binaries
536if(3DS)
537 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/3ds ${CMAKE_CURRENT_BINARY_DIR}/3ds)
538endif()
539
540if(WII)
541 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/wii ${CMAKE_CURRENT_BINARY_DIR}/wii)
542endif()
543
544if(PSP2)
545 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/psp2 ${CMAKE_CURRENT_BINARY_DIR}/psp2)
546endif()
547
548# Binaries
549list(APPEND CORE_SRC
550 ${UTIL_SRC}
551 ${CORE_VFS_SRC}
552 ${DEBUGGER_SRC}
553 ${OS_SRC}
554 ${THIRD_PARTY_SRC})
555
556set(SRC ${CORE_SRC} ${VFS_SRC})
557if(NOT MINIMAL_CORE)
558 if(M_CORE_GBA)
559 list(APPEND SRC
560 ${GBA_RR_SRC}
561 ${GBA_EXTRA_SRC}
562 ${SIO_SRC})
563 endif()
564 list(APPEND SRC
565 ${FEATURE_SRC}
566 ${CLI_SRC})
567endif()
568
569if(NOT SKIP_LIBRARY)
570 if(NOT BUILD_STATIC AND NOT BUILD_SHARED)
571 set(BUILD_SHARED ON)
572 endif()
573
574 if(BUILD_SHARED)
575 add_library(${BINARY_NAME} SHARED ${SRC} ${VFS_SRC})
576 if(BUILD_STATIC)
577 add_library(${BINARY_NAME}-static STATIC ${SRC})
578 set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
579 install(TARGETS ${BINARY_NAME}-static DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
580 add_dependencies(${BINARY_NAME}-static version-info)
581 endif()
582 else()
583 add_library(${BINARY_NAME} STATIC ${SRC})
584 endif()
585
586 add_dependencies(${BINARY_NAME} version-info)
587 set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
588
589 target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB})
590 install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
591 if(UNIX AND NOT APPLE)
592 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
593 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
594 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
595 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
596 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
597 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
598 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
599 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
600 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
601 endif()
602else()
603 set(BUILD_SHARED OFF)
604 set(BUILD_STATIC OFF)
605 find_library(${BINARY_NAME} ${BINARY_NAME})
606 if(NOT ${BINARY_NAME}_FOUND)
607 set(DISABLE_FRONTENDS ON)
608 set(BUILD_PERF OFF)
609 set(BUILD_TEST OFF)
610 endif()
611endif()
612
613if(BUILD_GL)
614 add_definitions(-DBUILD_GL)
615endif()
616
617if(BUILD_GLES2)
618 add_definitions(-DBUILD_GLES2)
619endif()
620
621if(DISABLE_FRONTENDS)
622 set(BUILD_SDL OFF)
623 set(BUILD_QT OFF)
624endif()
625
626if(BUILD_LIBRETRO)
627 file(GLOB RETRO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/libretro/*.c)
628 add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC})
629 set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=2")
630 target_link_libraries(${BINARY_NAME}_libretro ${OS_LIB})
631 install(TARGETS ${BINARY_NAME}_libretro LIBRARY DESTINATION ${LIBDIR} COMPONENT ${BINARY_NAME}_libretro NAMELINK_SKIP)
632endif()
633
634if(BUILD_OPENEMU)
635 find_library(FOUNDATION Foundation)
636 find_library(OPENEMUBASE OpenEmuBase)
637 file(GLOB OE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/openemu/*.m)
638 add_library(${BINARY_NAME}-openemu MODULE ${CORE_SRC} ${OE_SRC})
639 set_target_properties(${BINARY_NAME}-openemu PROPERTIES
640 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/openemu/Info.plist.in
641 BUNDLE TRUE
642 BUNDLE_EXTENSION oecoreplugin
643 OUTPUT_NAME ${PROJECT_NAME}
644 COMPILE_DEFINITIONS "DISABLE_THREADING;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=1")
645 target_link_libraries(${BINARY_NAME}-openemu ${OS_LIB} ${FOUNDATION} ${OPENEMUBASE})
646 install(TARGETS ${BINARY_NAME}-openemu LIBRARY DESTINATION ${LIBDIR} COMPONENT ${BINARY_NAME}.oecoreplugin NAMELINK_SKIP)
647endif()
648
649if(BUILD_SDL)
650 add_definitions(-DBUILD_SDL)
651 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl)
652endif()
653
654if(BUILD_QT)
655 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/qt ${CMAKE_CURRENT_BINARY_DIR}/qt)
656endif()
657
658if(BUILD_PERF)
659 set(PERF_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/test/perf-main.c ${CLI_SRC})
660 if(UNIX AND NOT APPLE)
661 list(APPEND PERF_LIB rt)
662 endif()
663
664 add_executable(${BINARY_NAME}-perf ${PERF_SRC})
665 target_link_libraries(${BINARY_NAME}-perf ${BINARY_NAME} ${PERF_LIB} ${OS_LIB})
666 set_target_properties(${BINARY_NAME}-perf PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
667 install(TARGETS ${BINARY_NAME}-perf DESTINATION bin COMPONENT ${BINARY_NAME}-perf)
668 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tools/perf.py DESTINATION "${CMAKE_INSTALL_LIBDIR}/${BINARY_NAME}" COMPONENT ${BINARY_NAME}-perf)
669endif()
670
671if(BUILD_TEST)
672 add_executable(${BINARY_NAME}-fuzz ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/test/fuzz-main.c)
673 target_link_libraries(${BINARY_NAME}-fuzz ${BINARY_NAME})
674 set_target_properties(${BINARY_NAME}-fuzz PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
675 install(TARGETS ${BINARY_NAME}-fuzz DESTINATION bin COMPONENT ${BINARY_NAME}-test)
676endif()
677
678if(BUILD_EXAMPLE)
679 add_executable(${BINARY_NAME}-example-server ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/example/client-server/server.c)
680 target_link_libraries(${BINARY_NAME}-example-server ${BINARY_NAME})
681 set_target_properties(${BINARY_NAME}-example-server PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
682
683 if(BUILD_SDL)
684 add_executable(${BINARY_NAME}-example-client ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/example/client-server/client.c)
685 target_link_libraries(${BINARY_NAME}-example-client ${BINARY_NAME} ${SDL_LIBRARY} ${SDLMAIN_LIBRARY} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
686 set_target_properties(${BINARY_NAME}-example-client PROPERTIES
687 COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}"
688 INCLUDE_DIRECTORIES "${SDL_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/src")
689 endif()
690endif()
691
692# Packaging
693set(CPACK_PACKAGE_VERSION ${VERSION_STRING})
694set(CPACK_PACKAGE_VERSION_MAJOR ${LIB_VERSION_MAJOR})
695set(CPACK_PACKAGE_VERSION_MINOR ${LIB_VERSION_MINOR})
696set(CPACK_PACKAGE_VERSION_PATCH ${LIB_VERSION_PATCH})
697set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
698set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
699
700set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mGBA Game Boy Advance Emulator")
701set(CPACK_PACKAGE_VENDOR "Jeffrey Pfau")
702set(CPACK_PACKAGE_CONTACT "Jeffrey Pfau <jeffrey@endrift.com>")
703set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
704set(CPACK_DEBIAN_PACKAGE_SECTION "games")
705
706SET(CPACK_DEB_COMPONENT_INSTALL ON)
707
708set(CPACK_STRIP_FILES ${BINARY_NAME})
709
710install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/CHANGES DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib${BINARY_NAME})
711
712include(CPack)
713
714# Summaries
715set(SUMMARY_GL_LIST)
716if(USE_EPOXY)
717 set(SUMMARY_GL_LIST "libepoxy")
718else()
719 if(BUILD_GL)
720 list(APPEND SUMMARY_GL_LIST "OpenGL")
721 endif()
722 if(BUILD_GLES2)
723 list(APPEND SUMMARY_GL_LIST "OpenGL|ES 2")
724 endif()
725endif()
726if(NOT SUMMARY_GL_LIST)
727 set(SUMMARY_GL OFF)
728else()
729 string(REPLACE ";" ", " SUMMARY_GL "${SUMMARY_GL_LIST}")
730endif()
731if(USE_LIBZIP)
732 set(SUMMARY_ZIP libzip)
733elseif(USE_MINIZIP)
734 set(SUMMARY_ZIP "minizip (external)")
735elseif(USE_ZLIB)
736 set(SUMMARY_ZIP "minizip (included)")
737else()
738 set(SUMMARY_ZIP OFF)
739endif()
740
741if(NOT QUIET)
742 message(STATUS "Platforms:")
743 message(STATUS " Game Boy Advance: ${M_CORE_GBA}")
744 message(STATUS " Game Boy: ${M_CORE_GB}")
745 message(STATUS "Features:")
746 message(STATUS " CLI debugger: ${USE_CLI_DEBUGGER}")
747 message(STATUS " GDB stub: ${USE_GDB_STUB}")
748 message(STATUS " Video recording: ${USE_FFMPEG}")
749 message(STATUS " GIF recording: ${USE_MAGICK}")
750 message(STATUS " Screenshot/advanced savestate support: ${USE_PNG}")
751 message(STATUS " ZIP support: ${SUMMARY_ZIP}")
752 message(STATUS " 7-Zip support: ${USE_LZMA}")
753 message(STATUS " OpenGL support: ${SUMMARY_GL}")
754 message(STATUS "Frontends:")
755 message(STATUS " Qt: ${BUILD_QT}")
756 message(STATUS " SDL (${SDL_VERSION}): ${BUILD_SDL}")
757 message(STATUS " Profiling: ${BUILD_PERF}")
758 message(STATUS " Test harness: ${BUILD_TEST}")
759 message(STATUS " Examples: ${BUILD_EXAMPLE}")
760 message(STATUS "Cores:")
761 message(STATUS " Libretro core: ${BUILD_LIBRETRO}")
762 if(APPLE)
763 message(STATUS " OpenEmu core: ${BUILD_OPENEMU}")
764 endif()
765 message(STATUS "Libraries:")
766 message(STATUS " Static: ${BUILD_STATIC}")
767 message(STATUS " Shared: ${BUILD_SHARED}")
768endif()