2010-11-01 09:47:02 -06:00
########################################
# General setup
#
2017-01-16 19:40:57 -07:00
cmake_minimum_required ( VERSION 3.5.0 )
2017-01-24 00:44:15 -07:00
set ( CMAKE_OSX_ARCHITECTURES "x86_64" )
2017-01-24 00:45:54 -07:00
# Minimum OS X version.
# This is inserted into the Info.plist as well.
# Note that the SDK determines the maximum version of which optional
# features can be used, not the minimum required version to run.
set ( CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE string "" )
2012-03-13 18:14:00 -06:00
2017-01-24 00:44:15 -07:00
project ( dolphin-emu )
2013-02-11 12:08:41 -07:00
option ( USE_EGL "Enables EGL OpenGL Interface" OFF )
2014-08-06 17:08:24 -06:00
option ( TRY_X11 "Enables X11 Support" ON )
2015-06-02 16:30:09 -06:00
option ( USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF )
2013-07-08 18:13:02 -06:00
option ( USE_UPNP "Enables UPnP port mapping support" ON )
2014-09-14 13:03:07 -06:00
option ( DISABLE_WX "Disable wxWidgets (use Qt or CLI interface)" OFF )
2015-11-27 01:33:07 -07:00
option ( ENABLE_QT2 "Enable Qt2 (use the other experimental Qt interface)" OFF )
2014-04-23 03:15:25 -06:00
option ( ENABLE_LTO "Enables Link Time Optimization" OFF )
2014-05-25 19:52:52 -06:00
option ( ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF )
2016-01-26 06:35:17 -07:00
option ( ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF )
2016-12-03 11:36:34 -07:00
option ( ENABLE_ALSA "Enables ALSA sound backend" ON )
option ( ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON )
2016-12-03 11:37:02 -07:00
option ( ENABLE_LLVM "Enables LLVM support, for disassembly" ON )
2015-06-28 19:09:24 -06:00
2016-06-16 18:28:34 -06:00
# Maintainers: if you consider blanket disabling this for your users, please
# consider the following points:
# * No data is being sent without explicit user approval (pop up box at first
# launch).
# * The Dolphin team relies on the data in order to understand the behavior
# of our software in the wild.
option ( ENABLE_ANALYTICS "Enables opt-in Analytics collection" ON )
2016-06-17 16:13:37 -06:00
# Name of the Dolphin distributor. If you redistribute Dolphin builds (forks,
# unofficial builds) please consider identifying your distribution with a
# unique name here.
set ( DISTRIBUTOR "None" CACHE STRING "Name of the distributor." )
2015-06-28 19:09:24 -06:00
# Enable SDL for default on operating systems that aren't OSX, Android, Linux or Windows.
if ( NOT APPLE AND NOT ANDROID AND NOT ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" AND NOT MSVC )
2017-03-01 05:43:43 -07:00
option ( ENABLE_SDL "Enables SDL as a generic controller backend" ON )
2015-06-28 19:09:24 -06:00
else ( )
2017-03-01 05:43:43 -07:00
option ( ENABLE_SDL "Enables SDL as a generic controller backend" OFF )
2015-06-28 19:09:24 -06:00
endif ( )
2015-06-30 05:57:54 -06:00
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" AND NOT ANDROID )
2017-03-01 05:43:43 -07:00
option ( ENABLE_EVDEV "Enables the evdev controller backend" ON )
2015-06-30 05:57:54 -06:00
endif ( )
2014-10-28 22:11:57 -06:00
if ( APPLE )
2017-03-01 05:43:43 -07:00
option ( OSX_USE_DEFAULT_SEARCH_PATH "Don't prioritize system library paths" OFF )
2014-10-28 22:11:57 -06:00
endif ( )
2013-01-25 12:55:05 -07:00
option ( ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON )
2014-04-23 03:11:41 -06:00
option ( FASTLOG "Enable all logs" OFF )
option ( OPROFILING "Enable profiling" OFF )
option ( GDBSTUB "Enable gdb stub for remote debugging." OFF )
2015-02-11 17:36:29 -07:00
if ( ${ CMAKE_SYSTEM_NAME } STREQUAL "Linux" )
2017-03-01 05:43:43 -07:00
option ( VTUNE "Enable Intel VTune integration for JIT symbols." OFF )
2015-02-11 17:36:29 -07:00
endif ( )
2014-11-05 18:53:34 -07:00
2015-01-03 05:17:57 -07:00
if ( APPLE )
2017-03-01 05:43:43 -07:00
option ( SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF )
2014-11-05 18:53:34 -07:00
endif ( )
2013-01-25 12:55:05 -07:00
########################################
# Optional Targets
2014-02-23 08:21:01 -07:00
# TODO: Add DSPSpy
2013-01-25 12:55:05 -07:00
option ( DSPTOOL "Build dsptool" OFF )
2017-01-24 17:48:16 -07:00
list ( APPEND CMAKE_MODULE_PATH
2017-03-01 05:43:43 -07:00
$ { C M A K E _ S O U R C E _ D I R } / C M a k e
2017-01-24 17:48:16 -07:00
)
# Support functions
include ( CheckAndAddFlag )
2017-01-24 21:23:06 -07:00
include ( CheckCCompilerFlag )
2017-01-25 08:20:03 -07:00
include ( DolphinCompileDefinitions )
2017-01-24 17:48:16 -07:00
2017-02-02 20:19:23 -07:00
# Enable folders for IDE
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
2014-11-19 17:55:52 -07:00
# Libraries to link
set ( LIBS )
2010-11-04 07:47:17 -06:00
# Set up paths
2017-02-05 12:16:27 -07:00
set ( bindir ${ CMAKE_INSTALL_PREFIX } /bin CACHE PATH "bindir" )
2017-02-22 10:21:10 -07:00
if ( HAIKU )
set ( datadir ${ CMAKE_INSTALL_PREFIX } /data/dolphin-emu CACHE PATH "datadir" )
set ( mandir ${ CMAKE_INSTALL_PREFIX } /documentation/man CACHE PATH "mandir" )
else ( )
set ( datadir ${ CMAKE_INSTALL_PREFIX } /share/dolphin-emu CACHE PATH "datadir" )
set ( mandir ${ CMAKE_INSTALL_PREFIX } /share/man CACHE PATH "mandir" )
endif ( )
2017-02-05 12:16:27 -07:00
add_definitions ( -DDATA_DIR= "${datadir}/" )
2010-11-04 07:47:17 -06:00
2017-01-17 13:34:18 -07:00
if ( CMAKE_SYSROOT )
2017-03-01 05:43:43 -07:00
# If we should use a sysroot, tell pkg-config to search for packages in there, not on the host
set ( ENV{PKG_CONFIG_LIBDIR} "${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig" )
set ( ENV{PKG_CONFIG_SYSROOT_DIR} "${CMAKE_SYSROOT}" )
2017-01-17 13:34:18 -07:00
endif ( )
2011-02-10 19:38:23 -07:00
# Set where the binary files will be built. The program will not execute from
# here. You must run "make install" to install these to the proper location
# as defined above.
2010-11-04 07:47:17 -06:00
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ CMAKE_BINARY_DIR } /Binaries )
2010-11-01 09:47:02 -06:00
2017-01-17 14:38:02 -07:00
# setup CCache
include ( CCache )
2011-08-14 14:17:57 -06:00
# for revision info
2017-01-17 13:32:55 -07:00
find_package ( Git )
2017-02-06 18:14:15 -07:00
if ( GIT_FOUND )
2017-03-01 05:43:43 -07:00
# make sure version information gets re-run when the current Git HEAD changes
execute_process ( WORKING_DIRECTORY ${ PROJECT_SOURCE_DIR } COMMAND ${ GIT_EXECUTABLE } rev-parse --git-path HEAD
O U T P U T _ V A R I A B L E d o l p h i n _ g i t _ h e a d _ f i l e n a m e
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
set_property ( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dolphin_git_head_filename}" )
execute_process ( WORKING_DIRECTORY ${ PROJECT_SOURCE_DIR } COMMAND ${ GIT_EXECUTABLE } rev-parse --symbolic-full-name HEAD
O U T P U T _ V A R I A B L E d o l p h i n _ g i t _ h e a d _ s y m b o l i c
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
execute_process ( WORKING_DIRECTORY ${ PROJECT_SOURCE_DIR }
C O M M A N D $ { G I T _ E X E C U T A B L E } r e v - p a r s e - - g i t - p a t h $ { d o l p h i n _ g i t _ h e a d _ s y m b o l i c }
O U T P U T _ V A R I A B L E d o l p h i n _ g i t _ h e a d _ s y m b o l i c _ f i l e n a m e
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
set_property ( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${dolphin_git_head_symbolic_filename}" )
# defines DOLPHIN_WC_REVISION
EXECUTE_PROCESS ( WORKING_DIRECTORY ${ PROJECT_SOURCE_DIR } COMMAND ${ GIT_EXECUTABLE } rev-parse HEAD
O U T P U T _ V A R I A B L E D O L P H I N _ W C _ R E V I S I O N
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
# defines DOLPHIN_WC_DESCRIBE
EXECUTE_PROCESS ( WORKING_DIRECTORY ${ PROJECT_SOURCE_DIR } COMMAND ${ GIT_EXECUTABLE } describe --always --long --dirty
O U T P U T _ V A R I A B L E D O L P H I N _ W C _ D E S C R I B E
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
# remove hash (and trailing "-0" if needed) from description
STRING ( REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" DOLPHIN_WC_DESCRIBE "${DOLPHIN_WC_DESCRIBE}" )
# defines DOLPHIN_WC_BRANCH
EXECUTE_PROCESS ( WORKING_DIRECTORY ${ PROJECT_SOURCE_DIR } COMMAND ${ GIT_EXECUTABLE } rev-parse --abbrev-ref HEAD
O U T P U T _ V A R I A B L E D O L P H I N _ W C _ B R A N C H
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2011-08-20 15:05:43 -06:00
endif ( )
2011-12-11 08:21:17 -07:00
# version number
2016-06-24 02:09:07 -06:00
set ( DOLPHIN_VERSION_MAJOR "5" )
2013-09-20 23:29:41 -06:00
set ( DOLPHIN_VERSION_MINOR "0" )
2015-06-09 13:06:28 -06:00
if ( DOLPHIN_WC_BRANCH STREQUAL "stable" )
2017-03-01 05:43:43 -07:00
set ( DOLPHIN_VERSION_PATCH "0" )
2011-12-11 08:21:17 -07:00
else ( )
2017-03-01 05:43:43 -07:00
set ( DOLPHIN_VERSION_PATCH ${ DOLPHIN_WC_REVISION } )
2011-12-11 08:21:17 -07:00
endif ( )
2014-03-02 04:21:50 -07:00
2016-05-29 10:26:53 -06:00
# If Dolphin is not built from a Git repository, default the version info to
# reasonable values.
if ( NOT DOLPHIN_WC_REVISION )
2017-03-01 05:43:43 -07:00
set ( DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}" )
set ( DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)" )
set ( DOLPHIN_WC_BRANCH "master" )
2016-05-29 10:26:53 -06:00
endif ( )
2014-03-02 04:21:50 -07:00
# Architecture detection and arch specific settings
2017-01-17 13:47:24 -07:00
message ( STATUS "Detected architecture: ${CMAKE_SYSTEM_PROCESSOR}" )
2014-03-02 04:21:50 -07:00
# Detect 64bit or 32bit
# CMake doesn't provide a simple way to determine 32bit or 64bit
# If we ever support a architecture that is 64bit with 32bit pointers then this'll break
# Of course the chances of that are slim(x32?) so who cares
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
2017-03-01 05:43:43 -07:00
set ( _ARCH_64 1 )
add_definitions ( -D_ARCH_64=1 )
2014-03-02 04:21:50 -07:00
else ( )
2017-03-01 05:43:43 -07:00
set ( _ARCH_32 1 )
add_definitions ( -D_ARCH_32=1 )
2014-03-02 04:21:50 -07:00
endif ( )
2014-05-25 19:52:52 -06:00
if ( ENABLE_GENERIC )
2017-03-01 05:43:43 -07:00
message ( STATUS "Warning! Building generic build!" )
set ( _M_GENERIC 1 )
add_definitions ( -D_M_GENERIC=1 )
2017-01-27 01:56:38 -07:00
elseif ( _ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64" )
2017-03-01 05:43:43 -07:00
set ( _M_X86 1 )
set ( _M_X86_64 1 )
add_definitions ( -D_M_X86=1 )
add_definitions ( -D_M_X86_64=1 )
check_and_add_flag ( HAVE_SSE2 -msse2 )
2017-01-24 22:03:44 -07:00
elseif ( CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" )
2017-03-01 05:43:43 -07:00
set ( _M_ARM 1 )
set ( _M_ARM_64 1 )
add_definitions ( -D_M_ARM=1 )
add_definitions ( -D_M_ARM_64=1 )
# CRC instruction set is used in the CRC32 hash function
check_and_add_flag ( HAVE_ARCH_ARMV8 -march=armv8-a+crc )
2016-06-08 11:49:46 -06:00
else ( )
2017-03-01 05:43:43 -07:00
message ( FATAL_ERROR "You're building on an unsupported platform: "
" ' $ { C M A K E _ S Y S T E M _ P R O C E S S O R } ' w i t h $ { C M A K E _ S I Z E O F _ V O I D _ P } - b y t e p o i n t e r s . "
" E n a b l e g e n e r i c b u i l d i f y o u r e a l l y w a n t a J I T - l e s s b i n a r y . " )
2013-02-26 12:49:00 -07:00
endif ( )
2011-01-09 09:36:19 -07:00
2013-01-29 20:28:55 -07:00
2017-01-17 12:00:56 -07:00
# Enforce minimum GCC version
if ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 )
2017-03-01 05:43:43 -07:00
message ( FATAL_ERROR "Dolphin requires at least GCC 5.0 (found ${CMAKE_CXX_COMPILER_VERSION})" )
2017-01-17 12:00:56 -07:00
endif ( )
2017-04-11 18:49:35 -06:00
if ( CMAKE_GENERATOR MATCHES "Ninja" )
check_and_add_flag ( DIAGNOSTICS_COLOR -fdiagnostics-color )
elseif ( CMAKE_GENERATOR MATCHES "Visual Studio" )
# Only MSBuild needs this, other generators will compile one file at a time
add_compile_options ( "/MP" )
endif ( )
2017-01-24 22:06:25 -07:00
if ( CMAKE_C_COMPILER_ID MATCHES "MSVC" )
2017-03-01 05:43:43 -07:00
check_and_add_flag ( EXCEPTIONS /EHsc )
2017-03-07 22:31:02 -07:00
dolphin_compile_definitions ( _DEBUG DEBUG_ONLY )
2017-03-01 05:43:43 -07:00
2017-06-06 00:22:01 -06:00
# Enforce C++ standard conforming conversion rules to catch possible bugs
add_compile_options ( /permissive- )
# Remove unreferenced inline functions/data to reduce link time and catch bugs
add_compile_options ( /Zc:inline )
# Assume `new` (w/o std::nothrow) throws to reduce binary size
add_compile_options ( /Zc:throwingNew )
# Enforce strict volatile semantics as per ISO C++
add_compile_options ( /volatile:iso )
2017-03-01 05:43:43 -07:00
string ( APPEND CMAKE_EXE_LINKER_FLAGS " /NXCOMPAT" )
2017-01-24 22:06:25 -07:00
else ( )
2017-03-01 05:43:43 -07:00
add_definitions ( -D_DEFAULT_SOURCE )
check_and_add_flag ( HAVE_WALL -Wall )
# TODO: would like these but they produce overwhelming amounts of warnings
#check_and_add_flag(EXTRA -Wextra)
#check_and_add_flag(MISSING_FIELD_INITIALIZERS -Wmissing-field-initializers)
#check_and_add_flag(SWITCH_DEFAULT -Wswitch-default)
#check_and_add_flag(FLOAT_EQUAL -Wfloat-equal)
#check_and_add_flag(CONVERSION -Wconversion)
#check_and_add_flag(ZERO_AS_NULL_POINTER_CONSTANT -Wzero-as-null-pointer-constant)
check_and_add_flag ( TYPE_LIMITS -Wtype-limits )
check_and_add_flag ( SIGN_COMPARE -Wsign-compare )
check_and_add_flag ( IGNORED_QUALIFIERS -Wignored-qualifiers )
check_and_add_flag ( UNINITIALIZED -Wuninitialized )
check_and_add_flag ( LOGICAL_OP -Wlogical-op )
check_and_add_flag ( SHADOW -Wshadow )
check_and_add_flag ( INIT_SELF -Winit-self )
check_and_add_flag ( MISSING_DECLARATIONS -Wmissing-declarations )
check_and_add_flag ( MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations )
# gcc uses some optimizations which might break stuff without this flag
check_and_add_flag ( NO_STRICT_ALIASING -fno-strict-aliasing )
check_and_add_flag ( NO_EXCEPTIONS -fno-exceptions )
check_and_add_flag ( VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden )
check_and_add_flag ( VISIBILITY_HIDDEN -fvisibility=hidden )
check_and_add_flag ( FOMIT_FRAME_POINTER -fomit-frame-pointer RELEASE_ONLY )
dolphin_compile_definitions ( _DEBUG DEBUG_ONLY )
check_and_add_flag ( GGDB -ggdb DEBUG_ONLY )
2017-01-24 22:06:25 -07:00
endif ( )
2010-11-01 09:47:02 -06:00
2017-01-27 01:58:21 -07:00
if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
2017-03-01 05:43:43 -07:00
if ( NOT OSX_USE_DEFAULT_SEARCH_PATH )
# Hack up the path to prioritize the path to built-in OS libraries to
# increase the chance of not depending on a bunch of copies of them
# installed by MacPorts, Fink, Homebrew, etc, and ending up copying
# them into the bundle. Since we optionally depend on libraries which
# are not part of OS X (ffmpeg, etc.), however, don't remove the default
# path entirely as was done in a previous version of this file. This is
# still kinda evil, since it defeats the user's path settings...
# See http://www.cmake.org/cmake/help/v3.0/command/find_program.html
list ( APPEND CMAKE_PREFIX_PATH "/usr" )
endif ( )
# Specify target CPUs.
check_and_add_flag ( HAVE_MSSSE3 -mssse3 )
check_and_add_flag ( HAVE_ARCH_CORE2 -march=core2 )
# Linker flags.
# Drop unreachable code and data.
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs" )
find_library ( APPKIT_LIBRARY AppKit )
find_library ( APPSERV_LIBRARY ApplicationServices )
find_library ( AU_LIBRARY AudioUnit )
find_library ( CARBON_LIBRARY Carbon )
find_library ( COCOA_LIBRARY Cocoa )
find_library ( COREAUDIO_LIBRARY CoreAudio )
find_library ( COREFUND_LIBRARY CoreFoundation )
find_library ( CORESERV_LIBRARY CoreServices )
find_library ( FOUNDATION_LIBRARY Foundation )
find_library ( IOB_LIBRARY IOBluetooth )
find_library ( IOK_LIBRARY IOKit )
find_library ( FORCEFEEDBACK ForceFeedback )
find_library ( OPENGL_LIBRARY OpenGL )
# Link against OS X system frameworks.
list ( APPEND LIBS
$ { A P P K I T _ L I B R A R Y }
$ { A U _ L I B R A R Y }
$ { C O R E A U D I O _ L I B R A R Y }
$ { C O R E F U N D _ L I B R A R Y }
$ { C O R E S E R V _ L I B R A R Y }
$ { I O K _ L I B R A R Y }
$ { F O R C E F E E D B A C K }
)
2011-02-07 08:51:38 -07:00
endif ( )
2011-12-07 00:26:44 -07:00
2017-01-24 21:51:09 -07:00
if ( ENABLE_LTO )
2017-03-01 05:43:43 -07:00
check_and_add_flag ( LTO -flto )
if ( CMAKE_CXX_COMPILER_ID STREQUAL GNU )
set ( CMAKE_AR gcc-ar )
set ( CMAKE_RANLIB gcc-ranlib )
endif ( )
2017-01-24 21:51:09 -07:00
endif ( )
2015-11-07 11:50:47 -07:00
# Add an option to build relocatable binaries on Linux
# The Sys folder will need to be copied to the Binaries folder.
if ( UNIX )
2017-03-01 05:43:43 -07:00
option ( LINUX_LOCAL_DEV "Enable relocatable binary" OFF )
if ( LINUX_LOCAL_DEV )
add_definitions ( -DLINUX_LOCAL_DEV )
endif ( )
2017-01-24 22:25:52 -07:00
endif ( )
2015-11-07 11:50:47 -07:00
2017-01-16 21:41:53 -07:00
# BSDs put packages in /usr/local instead of /usr, so we need to
# force CMake to look in those directories by default, too.
# All commands and submodule commands also need to see these
# changes, so just setting them in the project scope via
# include_directories and link_directories is not sufficient
2017-01-24 22:03:44 -07:00
if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD|NetBSD" )
2017-03-01 05:43:43 -07:00
set ( CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr/local" )
set ( CMAKE_REQUIRED_INCLUDES "/usr/local/include" )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib" )
2017-01-16 21:41:53 -07:00
endif ( )
2015-06-28 19:57:30 -06:00
# Dolphin requires threads.
2017-01-24 01:09:32 -07:00
find_package ( Threads )
2015-06-28 19:57:30 -06:00
2010-11-04 22:19:22 -06:00
if ( NOT CMAKE_BUILD_TYPE )
2017-03-01 05:43:43 -07:00
set ( CMAKE_BUILD_TYPE "Release" CACHE STRING
" B u i l d type ( Release/Debug/RelWithDebInfo/MinSizeRel ) " F O R C E )
2017-01-24 22:25:52 -07:00
endif ( )
2010-11-04 22:19:22 -06:00
2017-01-25 15:32:13 -07:00
option ( ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF )
if ( ENABLE_GPROF )
2017-03-01 05:43:43 -07:00
check_and_add_flag ( HAVE_PG -pg )
if ( NOT FLAG_C_HAVE_PG )
message ( FATAL_ERROR "Compiler option -pg is not supported" )
endif ( )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg" )
2017-01-24 22:02:01 -07:00
endif ( )
2010-11-04 20:23:24 -06:00
2010-12-12 22:29:13 -07:00
if ( FASTLOG )
2017-03-01 05:43:43 -07:00
add_definitions ( -DDEBUGFAST )
2010-12-12 22:29:13 -07:00
endif ( )
2013-01-06 03:28:27 -07:00
if ( GDBSTUB )
2017-03-01 05:43:43 -07:00
add_definitions ( -DUSE_GDBSTUB )
2017-01-24 22:25:52 -07:00
endif ( )
2013-01-06 03:28:27 -07:00
2015-02-11 17:36:29 -07:00
if ( VTUNE )
2017-03-01 05:43:43 -07:00
if ( EXISTS "$ENV{VTUNE_AMPLIFIER_XE_2015_DIR}" )
set ( VTUNE_DIR "$ENV{VTUNE_AMPLIFIER_XE_2015_DIR}" )
elseif ( EXISTS "$ENV{VTUNE_AMPLIFIER_XE_2013_DIR}" )
set ( VTUNE_DIR "$ENV{VTUNE_AMPLIFIER_XE_2013_DIR}" )
else ( )
message ( ERROR "Could find neither VTUNE_AMPLIFIER_XE_2015_DIR nor VTUNE_AMPLIFIER_XE_2013_DIR." )
endif ( )
add_definitions ( -DUSE_VTUNE )
include_directories ( "${VTUNE_DIR}/include" )
set ( VTUNE_LIBRARIES
" $ { V T U N E _ D I R } / l i b 6 4 / l i b j i t p r o f i l i n g . a "
" $ { V T U N E _ D I R } / l i b 6 4 / l i b i t t n o t i f y . a "
)
2017-01-24 22:25:52 -07:00
endif ( )
2015-02-11 17:36:29 -07:00
2013-07-13 17:42:04 -06:00
if ( ANDROID )
2017-03-01 05:43:43 -07:00
message ( STATUS "Building for Android" )
if ( NOT ENABLE_HEADLESS )
add_definitions ( -DANDROID )
else ( )
# Lie to cmake a bit. We are cross compiling to Android
# but not as a shared library. We want an executable.
set ( ANDROID 0 )
endif ( )
set ( USE_X11 0 )
set ( USE_UPNP 0 )
set ( USE_EGL 1 )
set ( DISABLE_WX 1 )
set ( ENABLE_QT2 0 )
# We are cross compiling, search only the toolchain for libraries and includes
SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
SET ( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
2017-02-22 10:21:10 -07:00
elseif ( HAIKU )
set ( USE_X11 0 )
set ( USE_UPNP 0 )
set ( USE_EGL 0 )
2017-01-20 14:55:20 -07:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
2017-03-01 05:43:43 -07:00
list ( APPEND LIBS rt )
2013-07-13 17:42:04 -06:00
endif ( )
2016-01-26 06:35:17 -07:00
if ( ENABLE_HEADLESS )
2017-04-15 20:23:19 -06:00
if ( APPLE )
message ( STATUS "Enabling Headless! Disabling GUI." )
else ( )
message ( STATUS "Enabling Headless! Disabling GUI, force enabling EGL!" )
set ( USE_EGL 1 )
endif ( )
2017-03-01 05:43:43 -07:00
set ( USE_X11 0 )
set ( DISABLE_WX 1 )
set ( ENABLE_QT2 0 )
add_definitions ( -DUSE_HEADLESS )
2016-01-26 06:35:17 -07:00
endif ( )
2017-01-24 19:51:17 -07:00
# Set file offset size to 64 bits.
#
# On modern Unixes, this is typically already the case. The lone exception is
# glibc, which may default to 32 bits. glibc allows this to be configured
# by setting _FILE_OFFSET_BITS.
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
2017-03-01 05:43:43 -07:00
add_definitions ( -D_FILE_OFFSET_BITS=64 )
add_definitions ( -D_LARGEFILE_SOURCE )
2017-01-24 19:51:17 -07:00
endif ( )
2010-12-12 22:29:13 -07:00
2010-11-01 09:47:02 -06:00
########################################
# Dependency checking
#
2011-02-10 19:38:23 -07:00
# TODO: We should have options for dependencies included in the externals to
# override autodetection of system libraries and force the usage of the
# externals.
2013-08-29 04:40:16 -06:00
include ( CheckLib )
include ( CheckCXXSourceRuns )
2013-11-24 15:28:20 -07:00
2017-01-17 13:32:55 -07:00
find_package ( OpenGL )
2016-02-05 09:54:59 -07:00
if ( OPENGL_GL )
2017-03-01 05:43:43 -07:00
include_directories ( ${ OPENGL_INCLUDE_DIR } )
2016-02-05 09:54:59 -07:00
endif ( )
2014-01-17 21:11:59 -07:00
2016-02-05 09:54:59 -07:00
set ( USE_X11 0 )
2017-02-22 10:21:10 -07:00
if ( UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAIKU AND NOT ENABLE_HEADLESS )
2017-03-01 05:43:43 -07:00
find_package ( X11 )
if ( TRY_X11 AND X11_FOUND )
set ( USE_X11 1 )
add_definitions ( -DHAVE_X11=1 )
include_directories ( ${ X11_INCLUDE_DIR } )
message ( STATUS "X11 support enabled" )
else ( )
set ( USE_X11 0 )
SET ( X11_FOUND "" )
message ( STATUS "X11 support disabled" )
add_definitions ( -DHAVE_X11=0 )
endif ( )
if ( NOT USE_X11 )
message ( FATAL_ERROR "\n"
" N o s u i t a b l e d i s p l a y p l a t f o r m f o u n d \ n "
" R e q u i r e s x 1 1 t o r u n " )
endif ( )
2016-02-05 09:54:59 -07:00
endif ( )
2010-11-01 09:47:02 -06:00
2016-02-05 09:54:59 -07:00
if ( USE_X11 )
2017-03-01 05:43:43 -07:00
check_lib ( XRANDR xrandr Xrandr )
if ( XRANDR_FOUND )
add_definitions ( -DHAVE_XRANDR=1 )
else ( )
add_definitions ( -DHAVE_XRANDR=0 )
endif ( )
2013-07-20 22:43:48 -06:00
2017-03-01 05:43:43 -07:00
pkg_check_modules ( X11_INPUT REQUIRED xi>=1.5.0 )
2016-02-05 09:54:59 -07:00
endif ( )
2017-05-22 13:13:19 -06:00
2016-02-05 09:54:59 -07:00
if ( ENCODE_FRAMEDUMPS )
2017-05-22 13:13:19 -06:00
if ( WIN32 )
set ( FFMPEG_DIR Externals/ffmpeg )
endif ( )
find_package ( FFmpeg COMPONENTS avcodec avformat avutil swscale )
if ( FFmpeg_FOUND )
message ( STATUS "libav/ffmpeg found, enabling AVI frame dumps" )
2017-05-26 01:32:35 -06:00
add_definitions ( -DHAVE_FFMPEG )
2017-05-22 13:13:19 -06:00
else ( )
message ( STATUS "libav/ffmpeg not found, disabling AVI frame dumps" )
2017-03-01 05:43:43 -07:00
endif ( )
2016-02-05 09:54:59 -07:00
endif ( )
2010-11-14 14:14:26 -07:00
2016-02-05 09:54:59 -07:00
if ( OPROFILING )
2017-03-01 05:43:43 -07:00
find_package ( OProfile )
if ( OPROFILE_FOUND )
message ( STATUS "OProfile found, enabling profiling support" )
add_definitions ( -DUSE_OPROFILE=1 )
include_directories ( ${ OPROFILE_INCLUDE_DIRS } )
else ( )
message ( FATAL_ERROR "OProfile not found. Can't build profiling support." )
endif ( )
2011-01-07 22:27:18 -07:00
endif ( )
2012-02-18 01:46:58 -07:00
2014-08-06 17:08:24 -06:00
if ( USE_EGL )
2017-03-01 05:43:43 -07:00
message ( STATUS "EGL OpenGL interface enabled" )
add_definitions ( -DUSE_EGL=1 )
2014-08-06 17:08:24 -06:00
endif ( )
2015-06-30 05:57:54 -06:00
if ( ENABLE_EVDEV )
2017-03-01 05:43:43 -07:00
find_package ( Libudev REQUIRED )
find_package ( Libevdev REQUIRED )
if ( LIBUDEV_FOUND AND LIBEVDEV_FOUND )
message ( STATUS "libevdev/libudev found, enabling evdev controller backend" )
add_definitions ( -DHAVE_LIBUDEV=1 )
add_definitions ( -DHAVE_LIBEVDEV=1 )
include_directories ( ${ LIBUDEV_INCLUDE_DIR } ${ LIBEVDEV_INCLUDE_DIR } )
else ( )
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" )
endif ( )
2015-06-28 18:17:35 -06:00
endif ( )
2015-10-24 21:20:03 -06:00
if ( UNIX )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using named pipes as controller inputs" )
add_definitions ( -DUSE_PIPES=1 )
message ( STATUS "Watching game memory for changes" )
add_definitions ( -DUSE_MEMORYWATCHER=1 )
2015-10-24 21:20:03 -06:00
endif ( )
2016-06-16 18:28:34 -06:00
if ( ENABLE_ANALYTICS )
2017-03-01 05:43:43 -07:00
message ( STATUS "Enabling analytics collection (subject to end-user opt-in)" )
add_definitions ( -DUSE_ANALYTICS=1 )
2016-06-16 18:28:34 -06:00
endif ( )
2010-11-01 09:47:02 -06:00
########################################
# Setup include directories (and make sure they are preferred over the Externals)
#
2014-02-18 04:09:38 -07:00
include_directories ( Source/Core )
2016-01-06 14:35:15 -07:00
if ( ANDROID )
2017-03-01 05:43:43 -07:00
include_directories ( Source/Android )
2016-01-06 14:35:15 -07:00
endif ( )
2014-02-18 04:09:38 -07:00
2010-11-01 09:47:02 -06:00
########################################
# Process externals and setup their include directories
#
# NOTES about adding Externals:
2010-11-04 22:19:22 -06:00
# - add the include directory here
# - make sure to tell cmake to link them statically or dynamically (most
# should be linked statically)
# - place the CMakeLists.txt in the first-level subdirectory, e.g.
2013-12-11 14:15:55 -07:00
# Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory)
2010-11-01 09:47:02 -06:00
#
add_subdirectory ( Externals/Bochs_disasm )
include_directories ( Externals/Bochs_disasm )
2015-02-15 05:34:44 -07:00
2016-06-25 23:06:20 -06:00
add_subdirectory ( Externals/glslang )
2017-06-12 04:24:54 -06:00
add_subdirectory ( Externals/pugixml )
2016-01-17 04:09:58 -07:00
add_subdirectory ( Externals/cpp-optparse )
2016-02-05 09:54:59 -07:00
if ( USE_SHARED_ENET )
2017-03-01 05:43:43 -07:00
check_lib ( ENET libenet enet enet/enet.h QUIET )
include ( CheckSymbolExists )
if ( ENET_FOUND )
set ( CMAKE_REQUIRED_INCLUDES ${ ENET_INCLUDE_DIRS } )
# hack: LDFLAGS already contains -lenet but all flags but the first are
# dropped; ugh, cmake
set ( CMAKE_REQUIRED_FLAGS ${ ENET_LDFLAGS } )
set ( CMAKE_REQUIRED_LIBRARIES ${ ENET_LIBRARIES } )
CHECK_SYMBOL_EXISTS ( enet_socket_get_address enet/enet.h ENET_HAVE_SGA )
set ( CMAKE_REQUIRED_INCLUDES )
set ( CMAKE_REQUIRED_FLAGS )
set ( CMAKE_REQUIRED_LIBRARIES )
if ( NOT ENET_HAVE_SGA )
# enet is too old
set ( ENET_FOUND FALSE )
endif ( )
endif ( )
2015-02-28 18:45:04 -07:00
endif ( )
if ( ENET_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared enet" )
2015-02-28 18:45:04 -07:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static enet from Externals" )
include_directories ( Externals/enet/include )
add_subdirectory ( Externals/enet )
2015-02-15 05:34:44 -07:00
endif ( )
LIST ( APPEND LIBS enet )
2010-11-01 09:47:02 -06:00
2015-01-20 14:43:26 -07:00
if ( NOT XXHASH_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static xxhash from Externals" )
add_subdirectory ( Externals/xxhash )
include_directories ( Externals/xxhash )
2015-01-20 14:43:26 -07:00
endif ( )
LIST ( APPEND LIBS xxhash )
2017-01-17 13:32:55 -07:00
find_package ( ZLIB )
2013-12-23 16:01:34 -07:00
if ( ZLIB_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared zlib" )
include_directories ( ${ ZLIB_INCLUDE_DIRS } )
2017-01-24 22:27:05 -07:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Shared zlib not found, falling back to the static library" )
add_subdirectory ( Externals/zlib )
include_directories ( Externals/zlib )
2017-01-24 22:25:52 -07:00
endif ( )
2013-12-23 16:01:34 -07:00
2016-02-05 09:54:59 -07:00
if ( NOT APPLE )
2017-03-01 05:43:43 -07:00
check_lib ( LZO "(no .pc for lzo2)" lzo2 lzo/lzo1x.h QUIET )
2011-12-18 16:54:45 -07:00
endif ( )
2010-11-18 16:27:27 -07:00
if ( LZO_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared lzo" )
2010-11-03 20:01:07 -06:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static lzo from Externals" )
add_subdirectory ( Externals/LZO )
include_directories ( Externals/LZO )
set ( LZO lzo2 )
2010-11-18 16:27:27 -07:00
endif ( )
2014-11-19 17:55:52 -07:00
list ( APPEND LIBS ${ LZO } )
2010-11-01 09:47:02 -06:00
2016-02-05 09:54:59 -07:00
if ( NOT APPLE )
2017-03-01 05:43:43 -07:00
check_lib ( PNG libpng png png.h QUIET )
2013-11-14 18:09:38 -07:00
endif ( )
if ( PNG_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared libpng" )
2013-11-14 18:09:38 -07:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static libpng from Externals" )
add_subdirectory ( Externals/libpng )
include_directories ( Externals/libpng )
set ( PNG png )
2013-04-13 14:09:05 -06:00
endif ( )
2017-04-10 10:44:17 -06:00
# Using static soundtouch from Externals
# Unable to use system soundtouch library: We require shorts, not floats.
add_subdirectory ( Externals/soundtouch )
include_directories ( Externals )
2013-01-09 09:26:12 -07:00
2017-03-22 17:09:04 -06:00
add_subdirectory ( Externals/cubeb EXCLUDE_FROM_ALL )
2016-09-28 11:32:17 -06:00
if ( NOT ANDROID )
2017-03-01 05:43:43 -07:00
add_definitions ( -D__LIBUSB__ )
if ( NOT APPLE )
find_package ( LibUSB )
endif ( )
if ( LIBUSB_FOUND AND NOT APPLE )
message ( STATUS "Using shared LibUSB" )
include_directories ( ${ LIBUSB_INCLUDE_DIR } )
else ( )
message ( STATUS "Using static LibUSB from Externals" )
add_subdirectory ( Externals/libusb )
set ( LIBUSB_LIBRARIES usb )
endif ( )
set ( LIBUSB_FOUND true )
2016-09-28 11:32:07 -06:00
endif ( )
2012-12-23 16:58:11 -07:00
2014-11-09 15:30:06 -07:00
set ( SFML_REQD_VERSION 2.1 )
2016-02-05 09:54:59 -07:00
if ( NOT APPLE )
2017-03-01 05:43:43 -07:00
find_package ( SFML ${ SFML_REQD_VERSION } COMPONENTS network system )
2011-12-18 16:54:45 -07:00
endif ( )
2014-11-09 15:30:06 -07:00
if ( SFML_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared SFML" )
2010-11-03 20:01:07 -06:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static SFML ${SFML_REQD_VERSION} from Externals" )
add_definitions ( -DSFML_STATIC )
add_subdirectory ( Externals/SFML )
include_directories ( BEFORE Externals/SFML/include )
2010-11-18 16:27:27 -07:00
endif ( )
2010-11-03 20:01:07 -06:00
2013-07-08 18:13:02 -06:00
if ( USE_UPNP )
2017-03-01 05:43:43 -07:00
if ( NOT APPLE )
find_package ( Miniupnpc )
endif ( )
if ( MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8 )
message ( STATUS "Using shared miniupnpc" )
else ( )
message ( STATUS "Using static miniupnpc from Externals" )
add_subdirectory ( Externals/miniupnpc )
set ( MINIUPNPC_INCLUDE_DIRS Externals/miniupnpc/src )
set ( MINIUPNPC_LIBRARIES miniupnpc )
endif ( )
add_definitions ( -DUSE_UPNP )
include_directories ( ${ MINIUPNPC_INCLUDE_DIRS } )
list ( APPEND LIBS ${ MINIUPNPC_LIBRARIES } )
2010-11-18 16:27:27 -07:00
endif ( )
2010-11-03 20:01:07 -06:00
2016-02-05 09:54:59 -07:00
if ( NOT APPLE )
2017-03-01 05:43:43 -07:00
find_package ( MbedTLS )
2013-09-02 19:07:47 -06:00
endif ( )
2015-09-25 23:09:19 -06:00
if ( MBEDTLS_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared mbed TLS" )
include_directories ( ${ MBEDTLS_INCLUDE_DIRS } )
2013-09-02 19:07:47 -06:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static mbed TLS from Externals" )
set ( MBEDTLS_LIBRARIES mbedtls mbedcrypto mbedx509 )
2017-03-19 09:45:38 -06:00
add_subdirectory ( Externals/mbedtls/ EXCLUDE_FROM_ALL )
2017-03-01 05:43:43 -07:00
include_directories ( Externals/mbedtls/include )
2013-09-02 19:07:47 -06:00
endif ( )
2013-08-15 05:36:17 -06:00
2017-01-17 13:32:55 -07:00
find_package ( CURL )
2016-06-16 18:28:34 -06:00
if ( CURL_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared libcurl" )
include_directories ( ${ CURL_INCLUDE_DIRS } )
2016-06-16 18:28:34 -06:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static libcurl from Externals" )
add_subdirectory ( Externals/curl )
set ( CURL_LIBRARIES curl )
include_directories ( BEFORE Externals/curl/include )
2016-06-16 18:28:34 -06:00
endif ( )
2016-02-05 09:54:59 -07:00
if ( NOT APPLE )
2017-03-01 05:43:43 -07:00
check_lib ( SOIL "(no .pc for SOIL)" SOIL SOIL/SOIL.h QUIET )
2011-12-18 16:54:45 -07:00
endif ( )
2010-11-18 16:27:27 -07:00
if ( SOIL_FOUND )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using shared SOIL" )
2010-11-03 20:01:07 -06:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static SOIL from Externals" )
add_subdirectory ( Externals/SOIL )
include_directories ( Externals/SOIL )
2010-11-18 16:27:27 -07:00
endif ( )
2010-11-01 09:47:02 -06:00
2016-02-05 09:54:59 -07:00
find_library ( ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c )
find_path ( ICONV_INCLUDE_DIR NAMES iconv.h )
if ( ICONV_LIBRARIES AND ICONV_INCLUDE_DIR )
2017-03-01 05:43:43 -07:00
mark_as_advanced ( ICONV_INCLUDE_DIR ICONV_LIBRARIES )
2016-02-05 09:54:59 -07:00
else ( )
2017-03-01 05:43:43 -07:00
message ( STATUS "Using static iconv from Externals" )
include_directories ( Externals/libiconv-1.14/include )
add_subdirectory ( Externals/libiconv-1.14 )
set ( ICONV_LIBRARIES iconv )
2016-02-05 09:54:59 -07:00
endif ( )
list ( APPEND LIBS ${ ICONV_LIBRARIES } )
2016-07-24 09:20:40 -06:00
if ( NOT ANDROID )
2017-03-01 05:43:43 -07:00
find_package ( HIDAPI )
2017-04-24 21:06:39 -06:00
if ( NOT HIDAPI_FOUND )
message ( STATUS "Using static HIDAPI from Externals" )
add_subdirectory ( Externals/hidapi EXCLUDE_FROM_ALL )
2017-02-28 17:16:47 -07:00
endif ( )
2016-07-24 09:20:40 -06:00
endif ( )
2016-02-05 09:54:59 -07:00
if ( NOT DISABLE_WX )
2017-04-24 15:08:30 -06:00
find_package ( wxWidgets 3.1.0 COMPONENTS core aui adv )
2017-03-01 05:43:43 -07:00
if ( _ARCH_32 )
add_definitions ( -DwxSIZE_T_IS_UINT )
endif ( )
if ( wxWidgets_FOUND )
message ( STATUS "wxWidgets found, enabling GUI build" )
2017-04-24 15:33:15 -06:00
if ( NOT TARGET wxWidgets::wxWidgets )
add_library ( wxWidgets::wxWidgets INTERFACE IMPORTED )
set_target_properties ( wxWidgets::wxWidgets PROPERTIES
I N T E R F A C E _ L I N K _ L I B R A R I E S " $ { w x W i d g e t s _ L I B R A R I E S } "
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S " $ { w x W i d g e t s _ I N C L U D E _ D I R S } "
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S " $ { w x W i d g e t s _ D E F I N I T I O N S } "
I N T E R F A C E _ C O M P I L E _ O P T I O N S " $ { w x W i d g e t s _ C X X _ F L A G S } "
)
endif ( )
2017-03-01 05:43:43 -07:00
else ( )
message ( STATUS "Using static wxWidgets from Externals" )
add_subdirectory ( Externals/wxWidgets3 )
set ( wxWidgets_FOUND TRUE )
endif ( )
2017-01-24 22:25:52 -07:00
endif ( )
2010-11-01 09:47:02 -06:00
2015-01-03 05:17:57 -07:00
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "FreeBSD|NetBSD" )
2017-03-01 05:43:43 -07:00
set ( LIBS ${ LIBS } usbhid )
2014-11-19 17:55:52 -07:00
endif ( )
2010-11-01 09:47:02 -06:00
########################################
2011-08-21 16:07:19 -06:00
# Pre-build events: Define configuration variables and write SCM info header
2010-11-01 09:47:02 -06:00
#
2013-10-19 18:14:00 -06:00
if ( DOLPHIN_WC_BRANCH STREQUAL "master" OR DOLPHIN_WC_BRANCH STREQUAL "stable" )
2017-03-01 05:43:43 -07:00
set ( DOLPHIN_WC_IS_STABLE "1" )
2011-08-21 15:30:19 -06:00
else ( )
2017-03-01 05:43:43 -07:00
set ( DOLPHIN_WC_IS_STABLE "0" )
2011-08-21 15:30:19 -06:00
endif ( )
2017-02-05 23:26:44 -07:00
configure_file (
2017-03-01 05:43:43 -07:00
" $ { P R O J E C T _ S O U R C E _ D I R } / S o u r c e / C o r e / C o m m o n / s c m r e v . h . i n "
" $ { P R O J E C T _ B I N A R Y _ D I R } / S o u r c e / C o r e / C o m m o n / s c m r e v . h "
2017-02-05 23:26:44 -07:00
)
2016-06-25 21:30:32 -06:00
include_directories ( "${PROJECT_BINARY_DIR}/Source/Core" )
2010-12-19 07:02:43 -07:00
2014-03-02 19:38:46 -07:00
########################################
# Unit testing.
#
2017-05-03 16:26:55 -06:00
message ( STATUS "Using static gtest from Externals" )
add_subdirectory ( Externals/gtest EXCLUDE_FROM_ALL )
2014-03-02 19:38:46 -07:00
2017-05-20 17:21:59 -06:00
########################################
# Process Dolphin source now that all setup is complete
#
2010-11-01 09:47:02 -06:00
add_subdirectory ( Source )
########################################
2010-11-04 07:47:17 -06:00
# Install shared data files
2010-11-01 09:47:02 -06:00
#
2017-02-05 12:16:27 -07:00
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows" )
install ( DIRECTORY Data/Sys/ DESTINATION ${ datadir } /sys PATTERN )
endif ( )
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD|Darwin" )
2017-03-01 05:43:43 -07:00
install ( FILES Data/license.txt DESTINATION ${ datadir } )
2010-12-12 08:25:03 -07:00
endif ( )
2017-02-05 12:16:27 -07:00
if ( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD" )
2017-03-01 05:43:43 -07:00
# Install the application icon and menu item
install ( FILES Data/dolphin-emu.svg
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } / s h a r e / i c o n s / h i c o l o r / s c a l a b l e / a p p s )
install ( FILES Data/dolphin-emu.png
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } / s h a r e / i c o n s / h i c o l o r / 4 8 x 4 8 / a p p s )
install ( FILES Data/dolphin-emu.desktop
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } / s h a r e / a p p l i c a t i o n s )
# Install manpages
install ( FILES Data/dolphin-emu.6
D E S T I N A T I O N $ { m a n d i r } / m a n 6 )
install ( FILES Data/dolphin-emu-nogui.6
D E S T I N A T I O N $ { m a n d i r } / m a n 6 )
2013-01-07 15:50:48 -07:00
endif ( )
2010-11-01 09:47:02 -06:00
# packaging information
set ( CPACK_PACKAGE_NAME "dolphin-emu" )
set ( CPACK_PACKAGE_VENDOR "Dolphin Team" )
2011-12-11 08:21:17 -07:00
set ( CPACK_PACKAGE_VERSION_MAJOR ${ DOLPHIN_VERSION_MAJOR } )
set ( CPACK_PACKAGE_VERSION_MINOR ${ DOLPHIN_VERSION_MINOR } )
set ( CPACK_PACKAGE_VERSION_PATCH ${ DOLPHIN_VERSION_PATCH } )
2012-12-22 04:51:01 -07:00
set ( CPACK_PACKAGE_DESCRIPTION_FILE ${ PROJECT_SOURCE_DIR } /Data/cpack_package_description.txt )
2016-08-10 11:23:21 -06:00
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "A GameCube and Wii emulator" )
2010-11-01 09:47:02 -06:00
2012-12-22 04:51:01 -07:00
set ( CPACK_RPM_PACKAGE_GROUP System/Emulators/Other )
set ( CPACK_RPM_PACKAGE_LICENSE GPL-2.0 )
2010-11-01 09:47:02 -06:00
# TODO: CPACK_RESOURCE_FILE_README
# TODO: CPACK_RESOURCE_FILE_WELCOME
# TODO: CPACK_PACKAGE_ICON
# TODO: CPACK_NSIS_*
# TODO: Use CPack components for DSPSpy, etc => cpack_add_component
2010-11-11 08:50:52 -07:00
2010-12-15 07:47:13 -07:00
set ( CPACK_SET_DESTDIR ON )
set ( CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP" )
2012-12-22 04:51:01 -07:00
set ( CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~;\\\\.swp;/\\\\.git" )
2010-12-15 07:47:13 -07:00
list ( APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}" )
2010-11-11 08:50:52 -07:00
# CPack must be included after the CPACK_* variables are set in order for those
# variables to take effect.
2013-02-26 12:49:00 -07:00
Include ( CPack )