Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.96 KB | None | 0 0
  1. ########################################
  2. # General setup
  3. #
  4. cmake_minimum_required(VERSION 2.8.8)
  5. project(dolphin-emu)
  6.  
  7. option(USE_EGL "Enables EGL OpenGL Interface" OFF)
  8. option(TRY_X11 "Enables X11 Support" ON)
  9. option(USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF)
  10. option(USE_SHARED_GTEST "Use shared gtest library if found" OFF)
  11. option(USE_UPNP "Enables UPnP port mapping support" ON)
  12. option(DISABLE_WX "Disable wxWidgets (use Qt or CLI interface)" OFF)
  13. option(ENABLE_QT2 "Enable Qt2 (use the other experimental Qt interface)" OFF)
  14. option(ENABLE_PCH "Use PCH to speed up compilation" ON)
  15. option(ENABLE_LTO "Enables Link Time Optimization" OFF)
  16. option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF)
  17. option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
  18.  
  19. # Maintainers: if you consider blanket disabling this for your users, please
  20. # consider the following points:
  21. # * No data is being sent without explicit user approval (pop up box at first
  22. # launch).
  23. # * The Dolphin team relies on the data in order to understand the behavior
  24. # of our software in the wild.
  25. option(ENABLE_ANALYTICS "Enables opt-in Analytics collection" ON)
  26.  
  27. # Name of the Dolphin distributor. If you redistribute Dolphin builds (forks,
  28. # unofficial builds) please consider identifying your distribution with a
  29. # unique name here.
  30. set(DISTRIBUTOR "None" CACHE STRING "Name of the distributor.")
  31.  
  32. # Enable SDL for default on operating systems that aren't OSX, Android, Linux or Windows.
  33. if(NOT APPLE AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT MSVC)
  34. option(ENABLE_SDL "Enables SDL as a generic controller backend" ON)
  35. else()
  36. option(ENABLE_SDL "Enables SDL as a generic controller backend" OFF)
  37. endif()
  38.  
  39. if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT ANDROID)
  40. option(ENABLE_EVDEV "Enables the evdev controller backend" ON)
  41. endif()
  42.  
  43. if(APPLE)
  44. option(OSX_USE_DEFAULT_SEARCH_PATH "Don't prioritize system library paths" OFF)
  45. endif()
  46.  
  47. option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON)
  48.  
  49. option(FASTLOG "Enable all logs" OFF)
  50. option(OPROFILING "Enable profiling" OFF)
  51. option(GDBSTUB "Enable gdb stub for remote debugging." OFF)
  52. if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
  53. option(VTUNE "Enable Intel VTune integration for JIT symbols." OFF)
  54. endif()
  55.  
  56. if(APPLE)
  57. option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF)
  58. endif()
  59. ########################################
  60. # Optional Targets
  61. # TODO: Add DSPSpy
  62. option(DSPTOOL "Build dsptool" OFF)
  63.  
  64. # Update compiler before calling project()
  65. if (APPLE)
  66. # Use clang compiler
  67. if (NOT DEFINED CMAKE_CXX_COMPILER)
  68. set(CMAKE_CXX_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++")
  69. if (NOT EXISTS "${CMAKE_CXX_COMPILER}")
  70. set(CMAKE_CXX_COMPILER "clang++")
  71. endif()
  72. endif()
  73. if (NOT DEFINED CMAKE_C_COMPILER)
  74. set(CMAKE_C_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang")
  75. if (NOT EXISTS "${CMAKE_C_COMPILER}")
  76. set(CMAKE_C_COMPILER "clang")
  77. endif()
  78. endif()
  79. endif()
  80. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
  81. # Libraries to link
  82. set(LIBS)
  83.  
  84. # Set up paths
  85. if(APPLE)
  86. # The gettext module will install the translations unconditionally.
  87. # Redirect the installation to a build directory where it does no harm.
  88. set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install-dummy)
  89. else()
  90. set(bindir ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bindir")
  91. set(datadir ${CMAKE_INSTALL_PREFIX}/share/dolphin-emu CACHE PATH "datadir")
  92. set(mandir ${CMAKE_INSTALL_PREFIX}/share/man CACHE PATH "mandir")
  93. add_definitions(-DDATA_DIR="${datadir}/")
  94. endif()
  95.  
  96. # Set where the binary files will be built. The program will not execute from
  97. # here. You must run "make install" to install these to the proper location
  98. # as defined above.
  99. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
  100.  
  101. # Precompiled header support for MSVC:
  102. # Call this after setting the source list (and don't add the source file used
  103. # to generate the pch file, this will be done here automatically)
  104. function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_FILE SOURCE_VARIABLE_NAME)
  105. if(MSVC)
  106. set(files ${${SOURCE_VARIABLE_NAME}})
  107.  
  108. # Generate precompiled header translation unit
  109. get_filename_component(pch_basename ${PRECOMPILED_HEADER} NAME_WE)
  110. set(pch_abs ${CMAKE_CURRENT_SOURCE_DIR}/${PRECOMPILED_HEADER})
  111. set(pch_unity ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
  112. set_source_files_properties(${pch_unity} PROPERTIES COMPILE_FLAGS
  113. "/Yc\"${pch_abs}\"")
  114.  
  115. # Update properties of source files to use the precompiled header.
  116. # Additionally, force the inclusion of the precompiled header at
  117. # beginning of each source file.
  118. foreach(source_file ${files} )
  119. set_source_files_properties(${source_file} PROPERTIES COMPILE_FLAGS
  120. "/Yu\"${pch_abs}\" /FI\"${pch_abs}\"")
  121. endforeach(source_file)
  122.  
  123. # Finally, update the source file collection to contain the
  124. # precompiled header translation unit
  125. set(${SOURCE_VARIABLE_NAME} ${pch_unity} ${${SOURCE_VARIABLE_NAME}} PARENT_SCOPE)
  126. endif(MSVC)
  127. endfunction(enable_precompiled_headers)
  128.  
  129. # for revision info
  130. include(FindGit OPTIONAL)
  131. if(GIT_FOUND AND NOT DOLPHIN_WC_REVISION)
  132. # defines DOLPHIN_WC_REVISION
  133. EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
  134. OUTPUT_VARIABLE DOLPHIN_WC_REVISION
  135. OUTPUT_STRIP_TRAILING_WHITESPACE)
  136. # defines DOLPHIN_WC_DESCRIBE
  137. EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --always --long --dirty
  138. OUTPUT_VARIABLE DOLPHIN_WC_DESCRIBE
  139. OUTPUT_STRIP_TRAILING_WHITESPACE)
  140.  
  141. # remove hash (and trailing "-0" if needed) from description
  142. STRING(REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" DOLPHIN_WC_DESCRIBE "${DOLPHIN_WC_DESCRIBE}")
  143.  
  144. # defines DOLPHIN_WC_BRANCH
  145. EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
  146. OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
  147. OUTPUT_STRIP_TRAILING_WHITESPACE)
  148. endif()
  149.  
  150. # version number
  151. set(DOLPHIN_VERSION_MAJOR "5")
  152. set(DOLPHIN_VERSION_MINOR "0")
  153. if(DOLPHIN_WC_BRANCH STREQUAL "stable")
  154. set(DOLPHIN_VERSION_PATCH "0")
  155. else()
  156. set(DOLPHIN_VERSION_PATCH ${DOLPHIN_WC_REVISION})
  157. endif()
  158.  
  159. # If Dolphin is not built from a Git repository, default the version info to
  160. # reasonable values.
  161. if(NOT DOLPHIN_WC_REVISION)
  162. set(DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}")
  163. set(DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)")
  164. set(DOLPHIN_WC_BRANCH "master")
  165. endif()
  166.  
  167. # Architecture detection and arch specific settings
  168. message(${CMAKE_SYSTEM_PROCESSOR})
  169.  
  170. # Detect 64bit or 32bit
  171. # CMake doesn't provide a simple way to determine 32bit or 64bit
  172. # If we ever support a architecture that is 64bit with 32bit pointers then this'll break
  173. # Of course the chances of that are slim(x32?) so who cares
  174. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  175. set(_ARCH_64 1)
  176. add_definitions(-D_ARCH_64=1)
  177. else()
  178. set(_ARCH_32 1)
  179. add_definitions(-D_ARCH_32=1)
  180. endif()
  181.  
  182. if(NOT ENABLE_GENERIC)
  183. if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
  184. ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
  185. ${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64" OR
  186. APPLE)
  187. if(_ARCH_64)
  188. set(_M_X86 1)
  189. set(_M_X86_64 1)
  190. add_definitions(-D_M_X86=1 -D_M_X86_64=1 -msse2)
  191. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie")
  192. else()
  193. message(FATAL_ERROR "x86_32 is an unsupported platform. Enable generic build if you really want a JIT-less binary.")
  194. endif()
  195. elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
  196. message(FATAL_ERROR "ARMv7 is an unsupported platform. Enable generic build if you really want a JIT-less binary.")
  197. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
  198. # This option only applies to 64bit ARM
  199. set(_M_ARM 1)
  200. set(_M_ARM_64 1)
  201. add_definitions(-D_M_ARM=1 -D_M_ARM_64=1)
  202. add_definitions(-march=armv8-a+crc)
  203. else()
  204. set(ENABLE_GENERIC 1)
  205. endif()
  206. endif()
  207.  
  208. if(ENABLE_GENERIC)
  209. message("Warning! Building generic build!")
  210. set(_M_GENERIC 1)
  211. add_definitions(-D_M_GENERIC=1)
  212. endif()
  213.  
  214. include(CheckCXXCompilerFlag)
  215. macro(check_and_add_flag var flag)
  216. CHECK_CXX_COMPILER_FLAG(${flag} FLAG_${var})
  217. if(FLAG_${var})
  218. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
  219. endif()
  220. endmacro()
  221.  
  222. # Enabling all warnings in MSVC spams too much
  223. if(NOT MSVC)
  224. add_definitions(-Wall)
  225. add_definitions(-D_DEFAULT_SOURCE)
  226. # TODO: would like these but they produce overwhelming amounts of warnings
  227. #check_and_add_flag(EXTRA -Wextra)
  228. #check_and_add_flag(MISSING_FIELD_INITIALIZERS -Wmissing-field-initializers)
  229. #check_and_add_flag(SWITCH_DEFAULT -Wswitch-default)
  230. #check_and_add_flag(FLOAT_EQUAL -Wfloat-equal)
  231. #check_and_add_flag(CONVERSION -Wconversion)
  232. #check_and_add_flag(ZERO_AS_NULL_POINTER_CONSTANT -Wzero-as-null-pointer-constant)
  233. check_and_add_flag(TYPE_LIMITS -Wtype-limits)
  234. check_and_add_flag(SIGN_COMPARE -Wsign-compare)
  235. check_and_add_flag(IGNORED_QUALIFIERS -Wignored-qualifiers)
  236. check_and_add_flag(UNINITIALIZED -Wuninitialized)
  237. check_and_add_flag(LOGICAL_OP -Wlogical-op)
  238. check_and_add_flag(SHADOW -Wshadow)
  239. check_and_add_flag(INIT_SELF -Winit-self)
  240. check_and_add_flag(MISSING_DECLARATIONS -Wmissing-declarations)
  241. check_and_add_flag(MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations)
  242. endif(NOT MSVC)
  243.  
  244. # gcc uses some optimizations which might break stuff without this flag
  245. add_definitions(-fno-strict-aliasing -fno-exceptions)
  246.  
  247. check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden)
  248.  
  249. if(UNIX AND NOT APPLE)
  250. check_and_add_flag(VISIBILITY_HIDDEN -fvisibility=hidden)
  251. endif()
  252.  
  253. if(ENABLE_LTO)
  254. check_and_add_flag(LTO -flto)
  255. if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
  256. set(CMAKE_AR gcc-ar)
  257. set(CMAKE_RANLIB gcc-ranlib)
  258. endif()
  259. endif()
  260.  
  261. if(APPLE)
  262. if(NOT OSX_USE_DEFAULT_SEARCH_PATH)
  263. # Hack up the path to prioritize the path to built-in OS libraries to
  264. # increase the chance of not depending on a bunch of copies of them
  265. # installed by MacPorts, Fink, Homebrew, etc, and ending up copying
  266. # them into the bundle. Since we optionally depend on libraries which
  267. # are not part of OS X (ffmpeg, libusb, etc.), however, don't remove
  268. # the default path entirely as was done in a previous version of this
  269. # file. This is still kinda evil, since it defeats the user's path
  270. # settings...
  271. # See http://www.cmake.org/cmake/help/v3.0/command/find_program.html
  272. set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr")
  273. endif()
  274.  
  275. # Identify the target system:
  276. # Ask for 64-bit binary.
  277. set(TARGET_FLAGS "-arch x86_64")
  278. # Minimum OS X version.
  279. # This is inserted into the Info.plist as well.
  280. # Note that the SDK determines the maximum version of which optional
  281. # features can be used, not the minimum required version to run.
  282. set(OSX_MIN_VERSION "10.9")
  283. set(TARGET_FLAGS "${TARGET_FLAGS} -mmacosx-version-min=${OSX_MIN_VERSION}")
  284. set(SYSROOT_LEGACY_PATH "/Developer/SDKs/MacOSX10.9.sdk")
  285. set(SYSROOT_PATH "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
  286. if(EXISTS "${SYSROOT_PATH}/")
  287. set(TARGET_SYSROOT ${SYSROOT_PATH})
  288. elseif(EXISTS "${SYSROOT_LEGACY_PATH}/")
  289. set(TARGET_SYSROOT ${SYSROOT_LEGACY_PATH})
  290. endif()
  291. if(${TARGET_SYSROOT})
  292. set(TARGET_FLAGS "${TARGET_FLAGS} -isysroot ${TARGET_SYSROOT}")
  293. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-syslibroot,${TARGET_SYSROOT}")
  294. endif()
  295. # Do not warn about frameworks that are not available on all architectures.
  296. # This avoids a warning when linking with QuickTime.
  297. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_arch_warnings")
  298. # Specify target CPUs.
  299. set(TARGET_FLAGS "${TARGET_FLAGS} -mssse3")
  300. set(TARGET_FLAGS "${TARGET_FLAGS} -march=core2")
  301. # Target flags apply to both C and C++ compilation.
  302. # CMake passes these to the compiler on the link command line as well.
  303. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
  304. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_FLAGS}")
  305.  
  306. # Linker flags.
  307. # Drop unreachable code and data.
  308. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs")
  309. # Reserve the minimum size for the zero page.
  310. # Our JIT requires virtual memory space below 2GB, while the default zero
  311. # page on x86_64 is 4GB in size.
  312. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-pagezero_size,0x1000")
  313.  
  314. find_library(APPKIT_LIBRARY AppKit)
  315. find_library(APPSERV_LIBRARY ApplicationServices)
  316. find_library(ATB_LIBRARY AudioToolbox)
  317. find_library(AU_LIBRARY AudioUnit)
  318. find_library(CARBON_LIBRARY Carbon)
  319. find_library(COCOA_LIBRARY Cocoa)
  320. find_library(COREAUDIO_LIBRARY CoreAudio)
  321. find_library(COREFUND_LIBRARY CoreFoundation)
  322. find_library(CORESERV_LIBRARY CoreServices)
  323. find_library(FOUNDATION_LIBRARY foundation)
  324. find_library(IOB_LIBRARY IOBluetooth)
  325. find_library(IOK_LIBRARY IOKit)
  326. find_library(QUICKTIME_LIBRARY QuickTime)
  327. find_library(WEBKIT_LIBRARY WebKit)
  328. find_library(FORCEFEEDBACK ForceFeedback)
  329. find_library(OPENGL_LIBRARY OpenGL)
  330. endif()
  331.  
  332. if(WIN32)
  333. add_definitions(-D_SECURE_SCL=0)
  334. add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  335. add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
  336. endif(WIN32)
  337.  
  338. # Add an option to build relocatable binaries on Linux
  339. # The Sys folder will need to be copied to the Binaries folder.
  340. if(UNIX)
  341. option(LINUX_LOCAL_DEV "Enable relocatable binary" OFF)
  342. if(LINUX_LOCAL_DEV)
  343. add_definitions('-DLINUX_LOCAL_DEV')
  344. endif(LINUX_LOCAL_DEV)
  345. endif(UNIX)
  346.  
  347. # Dolphin requires threads.
  348. # The Apple build may not need an explicit flag because one of the
  349. # frameworks may already provide it.
  350. # But for non-OSX systems, we will use the CMake Threads package.
  351. IF(NOT APPLE)
  352. FIND_PACKAGE(Threads)
  353. ENDIF(NOT APPLE)
  354.  
  355. if(NOT CMAKE_BUILD_TYPE)
  356. set(CMAKE_BUILD_TYPE "Release" CACHE STRING
  357. "Build type (Release/Debug/RelWithDebInfo/MinSizeRe)" FORCE)
  358. endif(NOT CMAKE_BUILD_TYPE)
  359.  
  360.  
  361. if(CMAKE_BUILD_TYPE STREQUAL Debug)
  362. add_definitions(-D_DEBUG -ggdb)
  363. set(wxWidgets_USE_DEBUG ON CACHE BOOL "Use wxWidgets Debugging")
  364.  
  365. option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF)
  366. if(ENABLE_GPROF)
  367. add_definitions(-pg)
  368. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
  369. endif()
  370. endif(CMAKE_BUILD_TYPE STREQUAL Debug)
  371.  
  372. if(CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE)
  373. add_definitions(-fomit-frame-pointer)
  374. endif()
  375.  
  376. if(FASTLOG)
  377. add_definitions(-DDEBUGFAST)
  378. endif()
  379.  
  380. if(GDBSTUB)
  381. add_definitions(-DUSE_GDBSTUB)
  382. endif(GDBSTUB)
  383.  
  384. if(VTUNE)
  385. if(EXISTS "$ENV{VTUNE_AMPLIFIER_XE_2015_DIR}")
  386. set(VTUNE_DIR "$ENV{VTUNE_AMPLIFIER_XE_2015_DIR}")
  387. elseif(EXISTS "$ENV{VTUNE_AMPLIFIER_XE_2013_DIR}")
  388. set(VTUNE_DIR "$ENV{VTUNE_AMPLIFIER_XE_2013_DIR}")
  389. else()
  390. message(ERROR "Could find neither VTUNE_AMPLIFIER_XE_2015_DIR nor VTUNE_AMPLIFIER_XE_2013_DIR.")
  391. endif()
  392. add_definitions(-DUSE_VTUNE)
  393. include_directories("${VTUNE_DIR}/include")
  394. set(VTUNE_LIBRARIES
  395. "${VTUNE_DIR}/lib64/libjitprofiling.a"
  396. "${VTUNE_DIR}/lib64/libittnotify.a"
  397. )
  398. endif(VTUNE)
  399.  
  400. if(ANDROID)
  401. message("Building for Android")
  402. if(NOT ENABLE_HEADLESS)
  403. add_definitions(-DANDROID)
  404. else()
  405. # Lie to cmake a bit. We are cross compiling to Android
  406. # but not as a shared library. We want an executable.
  407. set(ANDROID 0)
  408. endif()
  409. set(USE_X11 0)
  410. set(USE_UPNP 0)
  411. set(USE_EGL 1)
  412. set(DISABLE_WX 1)
  413. set(ENABLE_QT2 0)
  414.  
  415. # We are cross compiling, search only the toolchain for libraries and includes
  416. SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  417. SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  418. elseif(NOT APPLE)
  419. list(APPEND LIBS rt)
  420. endif()
  421.  
  422. if(ENABLE_HEADLESS)
  423. message("Enabling Headless! Disabling GUI, force enabling EGL!")
  424. set(USE_X11 0)
  425. set(USE_EGL 1)
  426. set(DISABLE_WX 1)
  427. set(ENABLE_QT2 0)
  428. add_definitions(-DUSE_HEADLESS)
  429. endif()
  430.  
  431. add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
  432.  
  433. ########################################
  434. # Dependency checking
  435. #
  436. # TODO: We should have options for dependencies included in the externals to
  437. # override autodetection of system libraries and force the usage of the
  438. # externals.
  439. include(CheckLib)
  440. include(CheckCXXSourceRuns)
  441.  
  442. include(FindOpenGL)
  443. if (OPENGL_GL)
  444. include_directories(${OPENGL_INCLUDE_DIR})
  445. endif()
  446.  
  447. include(FindALSA OPTIONAL)
  448. if(ALSA_FOUND)
  449. add_definitions(-DHAVE_ALSA=1)
  450. message("ALSA found, enabling ALSA sound backend")
  451. else()
  452. add_definitions(-DHAVE_ALSA=0)
  453. message("ALSA NOT found, disabling ALSA sound backend")
  454. endif(ALSA_FOUND)
  455.  
  456. check_lib(AO ao ao QUIET)
  457. if(AO_FOUND)
  458. add_definitions(-DHAVE_AO=1)
  459. message("ao found, enabling ao sound backend")
  460. else()
  461. add_definitions(-DHAVE_AO=0)
  462. message("ao NOT found, disabling ao sound backend")
  463. endif(AO_FOUND)
  464.  
  465. check_lib(BLUEZ bluez bluez QUIET)
  466. if(BLUEZ_FOUND)
  467. add_definitions(-DHAVE_BLUEZ=1)
  468. message("bluez found, enabling bluetooth support")
  469. else()
  470. add_definitions(-DHAVE_BLUEZ=0)
  471. message("bluez NOT found, disabling bluetooth support")
  472. endif(BLUEZ_FOUND)
  473.  
  474. check_lib(PULSEAUDIO libpulse pulse QUIET)
  475. if(PULSEAUDIO_FOUND)
  476. add_definitions(-DHAVE_PULSEAUDIO=1)
  477. message("PulseAudio found, enabling PulseAudio sound backend")
  478. else()
  479. add_definitions(-DHAVE_PULSEAUDIO=0)
  480. message("PulseAudio NOT found, disabling PulseAudio sound backend")
  481. endif(PULSEAUDIO_FOUND)
  482.  
  483. include(FindOpenAL OPTIONAL)
  484. if(OPENAL_FOUND)
  485. add_definitions(-DHAVE_OPENAL=1)
  486. include_directories(${OPENAL_INCLUDE_DIR})
  487. message("OpenAL found, enabling OpenAL sound backend")
  488. else()
  489. add_definitions(-DHAVE_OPENAL=0)
  490. message("OpenAL NOT found, disabling OpenAL sound backend")
  491. endif(OPENAL_FOUND)
  492.  
  493. include(FindLLVM OPTIONAL)
  494. if (LLVM_FOUND)
  495. add_definitions(-DHAS_LLVM=1)
  496. set(HAS_LLVM 1)
  497.  
  498. include_directories(${LLVM_INCLUDE_DIRS})
  499. list(APPEND LIBS ${LLVM_LIBRARIES})
  500.  
  501. message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
  502. endif()
  503.  
  504. set(USE_X11 0)
  505.  
  506. if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT ENABLE_HEADLESS)
  507. include(FindX11)
  508. if(TRY_X11 AND X11_FOUND)
  509. set(USE_X11 1)
  510. add_definitions(-DHAVE_X11=1)
  511. include_directories(${X11_INCLUDE_DIR})
  512. message("X11 support enabled")
  513. else()
  514. set(USE_X11 0)
  515. SET(X11_FOUND "")
  516. message("X11 support disabled")
  517. add_definitions(-DHAVE_X11=0)
  518. endif(TRY_X11 AND X11_FOUND)
  519.  
  520. if (NOT USE_X11)
  521. message(FATAL_ERROR "\n"
  522. "No suitable display platform found\n"
  523. "Requires x11 to run")
  524. endif()
  525. endif()
  526.  
  527. if(USE_X11)
  528. check_lib(XRANDR xrandr Xrandr)
  529. if(XRANDR_FOUND)
  530. add_definitions(-DHAVE_XRANDR=1)
  531. else()
  532. add_definitions(-DHAVE_XRANDR=0)
  533. endif(XRANDR_FOUND)
  534.  
  535. pkg_check_modules(XINPUT2 xi>=1.5.0)
  536. if(XINPUT2_FOUND)
  537. add_definitions(-DHAVE_X11_XINPUT2=1)
  538. else()
  539. add_definitions(-DHAVE_X11_XINPUT2=0)
  540. endif(XINPUT2_FOUND)
  541. endif()
  542. if(ENCODE_FRAMEDUMPS)
  543. check_libav()
  544. if(LIBAV_FOUND)
  545. LIST(APPEND LIBS ${LIBAV_LDFLAGS})
  546. endif()
  547.  
  548. endif()
  549.  
  550. set(CMAKE_REQUIRED_LIBRARIES portaudio)
  551. CHECK_CXX_SOURCE_RUNS(
  552. "#include <portaudio.h>
  553. int main(int argc, char **argv)
  554. { if(Pa_GetVersion() >= 1890) return 0; else return 1; }"
  555. PORTAUDIO)
  556. unset(CMAKE_REQUIRED_LIBRARIES)
  557. if(PORTAUDIO)
  558. message("PortAudio found, enabling mic support")
  559. add_definitions(-DHAVE_PORTAUDIO=1)
  560. set(PORTAUDIO_FOUND TRUE)
  561. else()
  562. message("PortAudio not found, disabling mic support")
  563. add_definitions(-DHAVE_PORTAUDIO=0)
  564. set(PORTAUDIO_FOUND FALSE)
  565. endif(PORTAUDIO)
  566.  
  567. if(OPROFILING)
  568. include(FindOProfile)
  569. if(OPROFILE_FOUND)
  570. message("OProfile found, enabling profiling support")
  571. add_definitions(-DUSE_OPROFILE=1)
  572. include_directories(${OPROFILE_INCLUDE_DIRS})
  573. else()
  574. message(FATAL_ERROR "OProfile not found. Can't build profiling support.")
  575. endif()
  576. endif()
  577.  
  578. if(USE_EGL)
  579. message("EGL OpenGL interface enabled")
  580. add_definitions(-DUSE_EGL=1)
  581. endif()
  582.  
  583. if(ENABLE_EVDEV)
  584. include(FindLibudev REQUIRED)
  585. include(FindLibevdev REQUIRED)
  586. if(LIBUDEV_FOUND AND LIBEVDEV_FOUND)
  587. message("libevdev/libudev found, enabling evdev controller backend")
  588. add_definitions(-DHAVE_LIBUDEV=1)
  589. add_definitions(-DHAVE_LIBEVDEV=1)
  590. include_directories(${LIBUDEV_INCLUDE_DIR} ${LIBEVDEV_INCLUDE_DIR})
  591. else()
  592. message(FATAL_ERROR "Couldn't find libevdev and/or libudev. Can't build evdev controller backend.\nDisable ENABLE_EVDEV if you wish to build without controller support")
  593. endif()
  594. endif()
  595.  
  596. if(UNIX)
  597. message("Using named pipes as controller inputs")
  598. add_definitions(-DUSE_PIPES=1)
  599. message("Watching game memory for changes")
  600. add_definitions(-DUSE_MEMORYWATCHER=1)
  601. endif()
  602.  
  603. if(ENABLE_ANALYTICS)
  604. message("Enabling analytics collection (subject to end-user opt-in)")
  605. add_definitions(-DUSE_ANALYTICS=1)
  606. endif()
  607.  
  608. ########################################
  609. # Setup include directories (and make sure they are preferred over the Externals)
  610. #
  611. include_directories(Source/Core)
  612. if(ANDROID)
  613. include_directories(Source/Android)
  614. endif()
  615.  
  616. ########################################
  617. # Process externals and setup their include directories
  618. #
  619. # NOTES about adding Externals:
  620. # - add the include directory here
  621. # - make sure to tell cmake to link them statically or dynamically (most
  622. # should be linked statically)
  623. # - place the CMakeLists.txt in the first-level subdirectory, e.g.
  624. # Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory)
  625. #
  626. add_subdirectory(Externals/Bochs_disasm)
  627. include_directories(Externals/Bochs_disasm)
  628.  
  629. if(USE_SHARED_ENET)
  630. check_lib(ENET libenet enet enet/enet.h QUIET)
  631. include(CheckSymbolExists)
  632. if (ENET_FOUND)
  633. set(CMAKE_REQUIRED_INCLUDES ${ENET_INCLUDE_DIRS})
  634. # hack: LDFLAGS already contains -lenet but all flags but the first are
  635. # dropped; ugh, cmake
  636. set(CMAKE_REQUIRED_FLAGS ${ENET_LDFLAGS})
  637. set(CMAKE_REQUIRED_LIBRARIES ${ENET_LIBRARIES})
  638. CHECK_SYMBOL_EXISTS(enet_socket_get_address enet/enet.h ENET_HAVE_SGA)
  639. set(CMAKE_REQUIRED_INCLUDES)
  640. set(CMAKE_REQUIRED_FLAGS)
  641. set(CMAKE_REQUIRED_LIBRARIES)
  642. if (NOT ENET_HAVE_SGA)
  643. # enet is too old
  644. set(ENET_FOUND FALSE)
  645. endif()
  646. endif()
  647. endif()
  648. if (ENET_FOUND)
  649. message("Using shared enet")
  650. else()
  651. message("Using static enet from Externals")
  652. include_directories(Externals/enet/include)
  653. add_subdirectory(Externals/enet)
  654. endif()
  655. LIST(APPEND LIBS enet)
  656.  
  657. if(NOT XXHASH_FOUND)
  658. message("Using static xxhash from Externals")
  659. add_subdirectory(Externals/xxhash)
  660. include_directories(Externals/xxhash)
  661. endif()
  662. LIST(APPEND LIBS xxhash)
  663.  
  664. # If zlib has already been found on a previous run of cmake don't check again
  665. # as the check seems to take a long time.
  666. if(NOT ZLIB_FOUND)
  667. include(FindZLIB OPTIONAL)
  668. endif()
  669. if(ZLIB_FOUND)
  670. set(ZLIB_FOUND 1 CACHE INTERNAL "")
  671. message("Using shared zlib")
  672. include_directories(${ZLIB_INCLUDE_DIRS})
  673. else(ZLIB_FOUND)
  674. message("Shared zlib not found, falling back to the static library")
  675. add_subdirectory(Externals/zlib)
  676. include_directories(Externals/zlib)
  677. endif(ZLIB_FOUND)
  678.  
  679. if(NOT APPLE)
  680. check_lib(LZO "(no .pc for lzo2)" lzo2 lzo/lzo1x.h QUIET)
  681. endif()
  682. if(LZO_FOUND)
  683. message("Using shared lzo")
  684. else()
  685. message("Using static lzo from Externals")
  686. add_subdirectory(Externals/LZO)
  687. include_directories(Externals/LZO)
  688. set(LZO lzo2)
  689. endif()
  690. list(APPEND LIBS ${LZO})
  691.  
  692. if(NOT APPLE)
  693. check_lib(PNG libpng png png.h QUIET)
  694. endif()
  695. if (PNG_FOUND)
  696. message("Using shared libpng")
  697. else()
  698. message("Using static libpng from Externals")
  699. add_subdirectory(Externals/libpng)
  700. include_directories(Externals/libpng)
  701. set(PNG png)
  702. endif()
  703.  
  704. if(OPENAL_FOUND)
  705. if(NOT APPLE)
  706. check_lib(SOUNDTOUCH soundtouch SoundTouch soundtouch/SoundTouch.h QUIET)
  707. endif()
  708. if (SOUNDTOUCH_FOUND)
  709. message("Using shared soundtouch")
  710. else()
  711. message("Using static soundtouch from Externals")
  712. add_subdirectory(Externals/soundtouch)
  713. include_directories(Externals)
  714. endif()
  715. endif()
  716.  
  717. if(ENABLE_SDL)
  718. include(FindSDL2 OPTIONAL)
  719. if(SDL2_FOUND)
  720. message("Using shared SDL2")
  721. add_definitions(-DHAVE_SDL=1)
  722. include_directories(${SDL2_INCLUDE_DIR})
  723. else(SDL2_FOUND)
  724. # SDL2 not found, try SDL
  725. include(FindSDL OPTIONAL)
  726. if(SDL_FOUND)
  727. message("Using shared SDL")
  728. add_definitions(-DHAVE_SDL=1)
  729. include_directories(${SDL_INCLUDE_DIR})
  730. else(SDL_FOUND)
  731. message("SDL NOT found, disabling SDL input")
  732. endif(SDL_FOUND)
  733. endif(SDL2_FOUND)
  734. endif()
  735.  
  736. include(FindLibUSB OPTIONAL)
  737. if(LIBUSB_FOUND)
  738. message("Using shared LibUSB")
  739. add_definitions(-D__LIBUSB__)
  740. include_directories(${LIBUSB_INCLUDE_DIR})
  741. endif(LIBUSB_FOUND)
  742.  
  743. set(SFML_REQD_VERSION 2.1)
  744. if(NOT APPLE)
  745. find_package(SFML ${SFML_REQD_VERSION} COMPONENTS network system)
  746. endif()
  747. if(SFML_FOUND)
  748. message("Using shared SFML")
  749. else()
  750. message("Using static SFML ${SFML_REQD_VERSION} from Externals")
  751. add_definitions(-DSFML_STATIC)
  752. add_subdirectory(Externals/SFML)
  753. include_directories(BEFORE Externals/SFML/include)
  754. endif()
  755.  
  756. if(USE_UPNP)
  757. if(NOT APPLE)
  758. include(FindMiniupnpc)
  759. endif()
  760. if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
  761. message("Using shared miniupnpc")
  762. else()
  763. message("Using static miniupnpc from Externals")
  764. add_subdirectory(Externals/miniupnpc)
  765. set(MINIUPNPC_INCLUDE_DIRS Externals/miniupnpc/src)
  766. set(MINIUPNPC_LIBRARIES miniupnpc)
  767. endif()
  768. add_definitions(-DUSE_UPNP)
  769. include_directories(${MINIUPNPC_INCLUDE_DIRS})
  770. list(APPEND LIBS ${MINIUPNPC_LIBRARIES})
  771. endif()
  772.  
  773. if(NOT APPLE)
  774. include(FindMbedTLS)
  775. endif()
  776. if(MBEDTLS_FOUND)
  777. message("Using shared mbed TLS")
  778. include_directories(${MBEDTLS_INCLUDE_DIRS})
  779. else()
  780. message("Using static mbed TLS from Externals")
  781. set(MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509)
  782. add_subdirectory(Externals/mbedtls/)
  783. include_directories(Externals/mbedtls/include)
  784. endif()
  785.  
  786. include(FindCURL OPTIONAL)
  787. if(CURL_FOUND)
  788. message("Using shared libcurl")
  789. include_directories(${CURL_INCLUDE_DIRS})
  790. else()
  791. message("Using static libcurl from Externals")
  792. add_subdirectory(Externals/curl)
  793. set(CURL_LIBRARIES curl)
  794. include_directories(BEFORE Externals/curl/include)
  795. endif()
  796.  
  797. if(NOT APPLE)
  798. check_lib(SOIL "(no .pc for SOIL)" SOIL SOIL/SOIL.h QUIET)
  799. endif()
  800. if(SOIL_FOUND)
  801. message("Using shared SOIL")
  802. else()
  803. message("Using static SOIL from Externals")
  804. add_subdirectory(Externals/SOIL)
  805. include_directories(Externals/SOIL)
  806. endif()
  807.  
  808. find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
  809. find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
  810.  
  811. if (ICONV_LIBRARIES AND ICONV_INCLUDE_DIR)
  812. mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARIES)
  813. else()
  814. message("Using static iconv from Externals")
  815. include_directories(Externals/libiconv-1.14/include)
  816. add_subdirectory(Externals/libiconv-1.14)
  817. set(ICONV_LIBRARIES iconv)
  818. endif()
  819. list(APPEND LIBS ${ICONV_LIBRARIES})
  820.  
  821. find_library(OPENSLES_LIBRARIES NAMES OpenSLES)
  822. find_path(OPENSLES_INCLUDE_DIR NAMES SLES/OpenSLES.h)
  823.  
  824. if (OPENSLES_LIBRARIES AND OPENSLES_INCLUDE_DIR)
  825. set(OPENSLES_FOUND 1)
  826. add_definitions(-DHAVE_OPENSLES=1)
  827. include_directories(${OPENSLES_INCLUDE_DIR})
  828. message("OpenSLES found, enabling OpenSLES sound backend")
  829. endif()
  830.  
  831. if(ENABLE_QT2)
  832. find_package(Qt5Widgets REQUIRED)
  833. message("Found Qt version ${Qt5Core_VERSION}, enabling the Qt backend")
  834. endif()
  835.  
  836. if(NOT DISABLE_WX)
  837. include(FindwxWidgets OPTIONAL)
  838. FIND_PACKAGE(wxWidgets COMPONENTS core aui adv)
  839.  
  840. if(wxWidgets_FOUND)
  841. EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  842. COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
  843. ${wxWidgets_CONFIG_OPTIONS} --version
  844. OUTPUT_VARIABLE wxWidgets_VERSION
  845. OUTPUT_STRIP_TRAILING_WHITESPACE
  846. ERROR_QUIET
  847. )
  848. message("Found wxWidgets version ${wxWidgets_VERSION}")
  849. set(wxMIN_VERSION "3.0.1")
  850. if(${wxWidgets_VERSION} VERSION_LESS ${wxMIN_VERSION})
  851. message("At least ${wxMIN_VERSION} is required; ignoring found version")
  852. unset(wxWidgets_FOUND)
  853. endif()
  854. endif(wxWidgets_FOUND)
  855.  
  856. if(UNIX AND NOT APPLE)
  857. # There is a bug in the FindGTK module in cmake version 2.8.2 that
  858. # does not find gdk-pixbuf-2.0. On the other hand some 2.8.3
  859. # users have complained that pkg-config does not find
  860. # gdk-pixbuf-2.0. On yet another hand, cmake version 2.8.3 in
  861. # Ubuntu Natty does not find the glib libraries correctly.
  862. # Ugly!!!
  863. execute_process(COMMAND lsb_release -c -s
  864. OUTPUT_VARIABLE DIST_NAME
  865. ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
  866. if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}
  867. VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty")
  868. check_lib(GTK2 gtk+-2.0 gtk+-2.0 gtk.h REQUIRED)
  869. else()
  870. include(FindGTK2)
  871. if(GTK2_FOUND)
  872. include_directories(${GTK2_INCLUDE_DIRS})
  873. list(APPEND LIBS ${GTK2_LIBRARIES})
  874. else()
  875. message(FATAL_ERROR "GTK is required to build the WX UI. Please install the GTK development libraries.")
  876. endif()
  877. endif()
  878. endif()
  879. set(wxWidgets_FOUND FALSE)
  880. if(wxWidgets_FOUND)
  881. include(${wxWidgets_USE_FILE})
  882. message("wxWidgets found, enabling GUI build")
  883. set(wxWidgets_FOUND FALSE)
  884. else(wxWidgets_FOUND)
  885. message("Using static wxWidgets from Externals")
  886.  
  887. # These definitions and includes are used when building dolphin against wx,
  888. # not when building wx itself (see wxw3 CMakeLists.txt for that)
  889. if(APPLE)
  890. add_definitions(-D__WXOSX_COCOA__)
  891. elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
  892. add_definitions(-D__WXGTK__)
  893.  
  894. # Check for required libs
  895. check_lib(GTHREAD2 gthread-2.0 gthread-2.0 glib/gthread.h REQUIRED)
  896. check_lib(PANGOCAIRO pangocairo pangocairo pango/pangocairo.h REQUIRED)
  897. elseif(WIN32)
  898. add_definitions(-D__WXMSW__)
  899. else()
  900. message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform")
  901. endif()
  902.  
  903. include_directories(SYSTEM
  904. Externals/wxWidgets3
  905. Externals/wxWidgets3/include)
  906. add_subdirectory(Externals/wxWidgets3)
  907. set(wxWidgets_FOUND FALSE)
  908. set(wxWidgets_LIBRARIES "wx")
  909. endif(wxWidgets_FOUND)
  910. add_definitions(-DHAVE_WX=1)
  911. endif(NOT DISABLE_WX)
  912. set(wxWidgets_FOUND FALSE)
  913. if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD")
  914. set(LIBS ${LIBS} usbhid)
  915. endif()
  916.  
  917. if(APPLE)
  918. # Link against OS X system frameworks.
  919. list(APPEND LIBS
  920. ${APPKIT_LIBRARY}
  921. ${AU_LIBRARY}
  922. ${COREAUDIO_LIBRARY}
  923. ${COREFUND_LIBRARY}
  924. ${CORESERV_LIBRARY}
  925. ${IOK_LIBRARY}
  926. ${FORCEFEEDBACK}
  927. )
  928. endif()
  929.  
  930. ########################################
  931. # Pre-build events: Define configuration variables and write SCM info header
  932. #
  933. if(DOLPHIN_WC_BRANCH STREQUAL "master" OR DOLPHIN_WC_BRANCH STREQUAL "stable")
  934. set(DOLPHIN_WC_IS_STABLE "1")
  935. else()
  936. set(DOLPHIN_WC_IS_STABLE "0")
  937. endif()
  938.  
  939. file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h
  940. "#define SCM_REV_STR \"" ${DOLPHIN_WC_REVISION} "\"\n"
  941. "#define SCM_DESC_STR \"" ${DOLPHIN_WC_DESCRIBE} "\"\n"
  942. "#define SCM_BRANCH_STR \"" ${DOLPHIN_WC_BRANCH} "\"\n"
  943. "#define SCM_IS_MASTER " ${DOLPHIN_WC_IS_STABLE} "\n"
  944. "#define SCM_DISTRIBUTOR_STR \"" ${DISTRIBUTOR} "\"\n"
  945. )
  946. include_directories("${PROJECT_BINARY_DIR}/Source/Core/Common")
  947.  
  948. ########################################
  949. # Unit testing.
  950. #
  951. include(FindGTest)
  952. if(GTEST_FOUND AND USE_SHARED_GTEST)
  953. message("Using shared gtest")
  954. include_directories(${GTEST_INCLUDE_DIRS})
  955. else()
  956. message("Using static gtest from Externals")
  957. include_directories(Externals/gtest/include)
  958. add_subdirectory(Externals/gtest)
  959. endif()
  960.  
  961. enable_testing()
  962. add_custom_target(unittests)
  963. add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND})
  964.  
  965.  
  966. ########################################
  967. # Start compiling our code
  968. #
  969. add_definitions(-std=c++1y)
  970.  
  971. # These aren't actually needed for C11/C++11
  972. # but some dependencies require them (LLVM, libav).
  973. add_definitions(-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS)
  974.  
  975. # Do this at the last minute because try_compile ignores linker flags. Yay...
  976. if(APPLE)
  977. # Some of our code contains Objective C constructs.
  978. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c -stdlib=libc++")
  979. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++ -stdlib=libc++")
  980. # Avoid mistaking an object file for a source file on the link command line.
  981. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none")
  982. endif()
  983.  
  984. add_subdirectory(Source)
  985.  
  986.  
  987. ########################################
  988. # Install shared data files
  989. #
  990. if(NOT APPLE)
  991. install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN)
  992. endif()
  993. if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")
  994. install(FILES Data/license.txt DESTINATION ${datadir})
  995. endif()
  996. if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
  997. # Install the application icon and menu item
  998. install(FILES Data/dolphin-emu.svg
  999. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)
  1000. install(FILES Data/dolphin-emu.png
  1001. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps)
  1002. install(FILES Data/dolphin-emu.desktop
  1003. DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
  1004. # Install manpages
  1005. install(FILES Data/dolphin-emu.6
  1006. DESTINATION ${mandir}/man6)
  1007. install(FILES Data/dolphin-emu-nogui.6
  1008. DESTINATION ${mandir}/man6)
  1009. endif()
  1010.  
  1011. # packaging information
  1012. set(CPACK_PACKAGE_NAME "dolphin-emu")
  1013. set(CPACK_PACKAGE_VENDOR "Dolphin Team")
  1014. set(CPACK_PACKAGE_VERSION_MAJOR ${DOLPHIN_VERSION_MAJOR})
  1015. set(CPACK_PACKAGE_VERSION_MINOR ${DOLPHIN_VERSION_MINOR})
  1016. set(CPACK_PACKAGE_VERSION_PATCH ${DOLPHIN_VERSION_PATCH})
  1017. set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/Data/cpack_package_description.txt)
  1018. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A GameCube, Wii and Triforce emulator")
  1019.  
  1020. set(CPACK_RPM_PACKAGE_GROUP System/Emulators/Other)
  1021. set(CPACK_RPM_PACKAGE_LICENSE GPL-2.0)
  1022. # TODO: CPACK_RESOURCE_FILE_README
  1023. # TODO: CPACK_RESOURCE_FILE_WELCOME
  1024. # TODO: CPACK_PACKAGE_ICON
  1025. # TODO: CPACK_NSIS_*
  1026. # TODO: Use CPack components for DSPSpy, etc => cpack_add_component
  1027.  
  1028. set(CPACK_SET_DESTDIR ON)
  1029. set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP")
  1030. set(CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~;\\\\.swp;/\\\\.git")
  1031. list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}")
  1032.  
  1033. # CPack must be included after the CPACK_* variables are set in order for those
  1034. # variables to take effect.
  1035. Include(CPack)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement