2010-11-01 16:47:02 +01:00
|
|
|
########################################
|
|
|
|
# General setup
|
|
|
|
#
|
2014-09-14 21:03:07 +02:00
|
|
|
cmake_minimum_required(VERSION 2.8.8)
|
2012-03-14 01:14:00 +01:00
|
|
|
|
2013-03-13 17:56:23 +01:00
|
|
|
option(ANDROID "Enables a build for Android" OFF)
|
2013-02-11 20:08:41 +01:00
|
|
|
option(USE_EGL "Enables EGL OpenGL Interface" OFF)
|
2014-08-07 01:08:24 +02:00
|
|
|
option(TRY_X11 "Enables X11 Support" ON)
|
2013-07-09 02:13:02 +02:00
|
|
|
option(USE_UPNP "Enables UPnP port mapping support" ON)
|
2014-09-14 21:03:07 +02:00
|
|
|
option(DISABLE_WX "Disable wxWidgets (use Qt or CLI interface)" OFF)
|
|
|
|
option(ENABLE_QT "Enable Qt (use the experimental Qt interface)" OFF)
|
2013-10-20 22:51:25 +02:00
|
|
|
option(ENABLE_PCH "Use PCH to speed up compilation" ON)
|
2014-04-23 11:15:25 +02:00
|
|
|
option(ENABLE_LTO "Enables Link Time Optimization" OFF)
|
2014-05-26 03:52:52 +02:00
|
|
|
option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF)
|
2013-01-25 20:55:05 +01:00
|
|
|
|
|
|
|
option(OPENMP "Enable OpenMP parallelization" ON)
|
|
|
|
option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON)
|
2014-04-23 11:11:41 +02:00
|
|
|
|
|
|
|
option(FASTLOG "Enable all logs" OFF)
|
|
|
|
option(OPROFILING "Enable profiling" OFF)
|
|
|
|
option(GDBSTUB "Enable gdb stub for remote debugging." OFF)
|
2013-01-25 20:55:05 +01:00
|
|
|
########################################
|
|
|
|
# Optional Targets
|
2014-02-23 16:21:01 +01:00
|
|
|
# TODO: Add DSPSpy
|
2013-01-25 20:55:05 +01:00
|
|
|
option(DSPTOOL "Build dsptool" OFF)
|
|
|
|
|
2012-03-14 01:14:00 +01:00
|
|
|
# Update compiler before calling project()
|
|
|
|
if (APPLE)
|
|
|
|
# Use clang compiler
|
2013-09-23 06:25:41 +02:00
|
|
|
if (NOT DEFINED CMAKE_CXX_COMPILER)
|
|
|
|
set(CMAKE_CXX_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++")
|
|
|
|
if (NOT EXISTS "${CMAKE_CXX_COMPILER}")
|
|
|
|
set(CMAKE_CXX_COMPILER "clang++")
|
|
|
|
endif()
|
|
|
|
endif()
|
2014-01-05 13:18:05 +01:00
|
|
|
if (NOT DEFINED CMAKE_C_COMPILER)
|
2013-09-23 06:25:41 +02:00
|
|
|
set(CMAKE_C_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang")
|
|
|
|
if (NOT EXISTS "${CMAKE_C_COMPILER}")
|
|
|
|
set(CMAKE_C_COMPILER "clang")
|
|
|
|
endif()
|
2012-03-14 01:14:00 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
2010-11-06 04:49:18 +01:00
|
|
|
project(dolphin-emu)
|
2013-08-16 09:26:34 +02:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
|
2013-09-22 16:28:09 +02:00
|
|
|
set(DOLPHIN_IS_STABLE FALSE)
|
2010-11-04 14:47:17 +01:00
|
|
|
|
|
|
|
# Set up paths
|
2011-12-14 02:50:36 +01:00
|
|
|
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
|
|
|
|
# The gettext module will install the translations unconditionally.
|
|
|
|
# Redirect the installation to a build directory where it does no harm.
|
|
|
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install-dummy)
|
|
|
|
else()
|
|
|
|
set(bindir ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bindir")
|
|
|
|
set(datadir ${CMAKE_INSTALL_PREFIX}/share/dolphin-emu CACHE PATH "datadir")
|
|
|
|
add_definitions(-DDATA_DIR="${datadir}/")
|
|
|
|
endif()
|
2010-11-04 14:47:17 +01:00
|
|
|
set(userdir ".dolphin-emu" CACHE STRING "User directory")
|
|
|
|
add_definitions(-DUSER_DIR="${userdir}")
|
|
|
|
|
2011-02-11 03:38:23 +01: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 14:47:17 +01:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2011-01-09 17:36:19 +01:00
|
|
|
# Precompiled header support for MSVC:
|
2011-02-11 03:38:23 +01:00
|
|
|
# Call this after setting the source list (and don't add the source file used
|
|
|
|
# to generate the pch file, this will be done here automatically)
|
2011-01-09 17:36:19 +01:00
|
|
|
function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_FILE SOURCE_VARIABLE_NAME)
|
|
|
|
if(MSVC)
|
|
|
|
set(files ${${SOURCE_VARIABLE_NAME}})
|
|
|
|
|
|
|
|
# Generate precompiled header translation unit
|
|
|
|
get_filename_component(pch_basename ${PRECOMPILED_HEADER} NAME_WE)
|
|
|
|
set(pch_abs ${CMAKE_CURRENT_SOURCE_DIR}/${PRECOMPILED_HEADER})
|
|
|
|
set(pch_unity ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
|
2011-02-11 03:38:23 +01:00
|
|
|
set_source_files_properties(${pch_unity} PROPERTIES COMPILE_FLAGS
|
|
|
|
"/Yc\"${pch_abs}\"")
|
2011-01-09 17:36:19 +01:00
|
|
|
|
|
|
|
# Update properties of source files to use the precompiled header.
|
2011-02-11 03:38:23 +01:00
|
|
|
# Additionally, force the inclusion of the precompiled header at
|
|
|
|
# beginning of each source file.
|
2011-01-09 17:36:19 +01:00
|
|
|
foreach(source_file ${files} )
|
2011-02-11 03:38:23 +01:00
|
|
|
set_source_files_properties(${source_file} PROPERTIES COMPILE_FLAGS
|
|
|
|
"/Yu\"${pch_abs}\" /FI\"${pch_abs}\"")
|
2011-01-09 17:36:19 +01:00
|
|
|
endforeach(source_file)
|
|
|
|
|
2011-02-11 03:38:23 +01:00
|
|
|
# Finally, update the source file collection to contain the
|
|
|
|
# precompiled header translation unit
|
2011-01-09 17:36:19 +01:00
|
|
|
set(${SOURCE_VARIABLE_NAME} ${pch_unity} ${${SOURCE_VARIABLE_NAME}} PARENT_SCOPE)
|
|
|
|
endif(MSVC)
|
|
|
|
endfunction(enable_precompiled_headers)
|
|
|
|
|
2011-08-14 22:17:57 +02:00
|
|
|
# for revision info
|
|
|
|
include(FindGit OPTIONAL)
|
|
|
|
if(GIT_FOUND AND NOT DOLPHIN_WC_REVISION)
|
2013-07-11 04:49:13 +02:00
|
|
|
# defines DOLPHIN_WC_REVISION
|
2013-05-22 13:34:02 +02:00
|
|
|
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
2013-07-11 04:49:13 +02:00
|
|
|
OUTPUT_VARIABLE DOLPHIN_WC_REVISION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
# defines DOLPHIN_WC_DESCRIBE
|
2013-05-22 13:34:02 +02:00
|
|
|
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --always --long --dirty
|
2013-07-11 04:49:13 +02:00
|
|
|
OUTPUT_VARIABLE DOLPHIN_WC_DESCRIBE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2011-08-23 03:06:17 +02:00
|
|
|
|
2013-08-11 00:12:24 +02:00
|
|
|
# remove hash (and trailing "-0" if needed) from description
|
|
|
|
STRING(REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" DOLPHIN_WC_DESCRIBE "${DOLPHIN_WC_DESCRIBE}")
|
2011-08-23 03:06:17 +02:00
|
|
|
|
2013-07-11 04:49:13 +02:00
|
|
|
# defines DOLPHIN_WC_BRANCH
|
2013-05-22 13:34:02 +02:00
|
|
|
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
2013-07-11 04:49:13 +02:00
|
|
|
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2011-08-20 23:05:43 +02:00
|
|
|
endif()
|
|
|
|
|
2011-12-11 16:21:17 +01:00
|
|
|
# version number
|
2013-09-21 07:29:41 +02:00
|
|
|
set(DOLPHIN_VERSION_MAJOR "4")
|
|
|
|
set(DOLPHIN_VERSION_MINOR "0")
|
2011-12-11 16:21:17 +01:00
|
|
|
if(DOLPHIN_IS_STABLE)
|
|
|
|
set(DOLPHIN_VERSION_PATCH "0")
|
|
|
|
else()
|
|
|
|
set(DOLPHIN_VERSION_PATCH ${DOLPHIN_WC_REVISION})
|
|
|
|
endif()
|
2014-03-02 12:21:50 +01:00
|
|
|
|
|
|
|
# Architecture detection and arch specific settings
|
2013-02-26 20:49:00 +01:00
|
|
|
message(${CMAKE_SYSTEM_PROCESSOR})
|
2014-03-02 12:21:50 +01: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)
|
|
|
|
set(_ARCH_64 1)
|
|
|
|
add_definitions(-D_ARCH_64=1)
|
|
|
|
else()
|
|
|
|
set(_ARCH_32 1)
|
|
|
|
add_definitions(-D_ARCH_32=1)
|
|
|
|
endif()
|
|
|
|
|
2014-05-26 03:52:52 +02:00
|
|
|
if(NOT ENABLE_GENERIC)
|
|
|
|
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
|
|
|
|
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
|
|
|
|
${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
if(_ARCH_64)
|
|
|
|
set(_M_X86 1)
|
|
|
|
set(_M_X86_64 1)
|
|
|
|
add_definitions(-D_M_X86=1 -D_M_X86_64=1 -msse2)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "x86_32 is an unsupported platform. Enable generic build if you really want a JIT-less binary.")
|
|
|
|
endif()
|
|
|
|
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
|
|
|
|
# This option only applies to 32bit ARM
|
|
|
|
set(_M_ARM 1)
|
|
|
|
set(_M_ARM_32 1)
|
|
|
|
add_definitions(-D_M_ARM=1 -D_M_ARM_32=1)
|
|
|
|
if(${ANDROID_NDK_ABI_NAME} MATCHES "armeabi-v7a")
|
|
|
|
add_definitions(-marm -march=armv7-a)
|
|
|
|
endif()
|
|
|
|
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
|
|
|
|
# This option only applies to 64bit ARM
|
|
|
|
set(_M_ARM 1)
|
|
|
|
set(_M_ARM_64 1)
|
|
|
|
add_definitions(-D_M_ARM=1 -D_M_ARM_64=1)
|
|
|
|
set(ENABLE_GENERIC 1)
|
2014-03-02 12:21:50 +01:00
|
|
|
else()
|
2014-05-26 03:52:52 +02:00
|
|
|
set(ENABLE_GENERIC 1)
|
2013-11-30 19:25:01 +01:00
|
|
|
endif()
|
2014-05-26 03:52:52 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GENERIC)
|
2014-03-17 17:36:27 +01:00
|
|
|
message("Warning! Building generic build!")
|
2014-03-02 12:21:50 +01:00
|
|
|
set(_M_GENERIC 1)
|
|
|
|
add_definitions(-D_M_GENERIC=1)
|
2013-02-26 20:49:00 +01:00
|
|
|
endif()
|
2011-01-09 17:36:19 +01:00
|
|
|
|
2013-01-30 04:28:55 +01:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
macro(check_and_add_flag var flag)
|
|
|
|
CHECK_CXX_COMPILER_FLAG(${flag} FLAG_${var})
|
|
|
|
if(FLAG_${var})
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2011-01-09 17:36:19 +01:00
|
|
|
# Enabling all warnings in MSVC spams too much
|
|
|
|
if(NOT MSVC)
|
|
|
|
add_definitions(-Wall)
|
2013-01-30 04:28:55 +01:00
|
|
|
|
|
|
|
# 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)
|
2014-07-08 14:01:59 +02:00
|
|
|
check_and_add_flag(MISSING_DECLARATIONS -Wmissing-declarations)
|
2014-07-08 14:51:14 +02:00
|
|
|
check_and_add_flag(MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations)
|
2011-01-09 17:36:19 +01:00
|
|
|
endif(NOT MSVC)
|
2010-11-01 16:47:02 +01:00
|
|
|
|
|
|
|
# gcc uses some optimizations which might break stuff without this flag
|
2013-01-30 04:48:26 +01:00
|
|
|
add_definitions(-fno-strict-aliasing -fno-exceptions)
|
2010-11-13 23:07:27 +01:00
|
|
|
|
2013-01-30 04:28:55 +01:00
|
|
|
check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden)
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2010-12-04 16:19:04 +01:00
|
|
|
if(UNIX AND NOT APPLE)
|
2013-01-30 04:28:55 +01:00
|
|
|
check_and_add_flag(VISIBILITY_HIDDEN -fvisibility=hidden)
|
2010-11-17 02:03:39 +01:00
|
|
|
endif()
|
2010-11-14 16:13:04 +01:00
|
|
|
|
2014-04-23 11:15:25 +02:00
|
|
|
if(ENABLE_LTO)
|
|
|
|
check_and_add_flag(LTO -flto)
|
2014-05-03 11:54:31 +02:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
|
|
|
set(CMAKE_AR gcc-ar)
|
|
|
|
set(CMAKE_RANLIB gcc-ranlib)
|
|
|
|
endif()
|
2014-04-23 11:15:25 +02:00
|
|
|
endif()
|
|
|
|
|
2012-03-26 05:27:18 +02:00
|
|
|
if(APPLE)
|
2011-12-05 05:42:02 +01:00
|
|
|
# Ignore MacPorts and Fink and any other locally installed packages that
|
|
|
|
# might prevent building a distributable binary.
|
|
|
|
set(CMAKE_SYSTEM_PREFIX_PATH /usr)
|
2011-12-19 02:57:00 +01:00
|
|
|
set(ENV{PATH} /usr/bin:/bin:/usr/sbin:/sbin)
|
2011-12-05 05:42:02 +01:00
|
|
|
|
2011-12-11 21:27:06 +01:00
|
|
|
# Some of our code contains Objective C constructs.
|
2013-03-29 15:31:15 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c -stdlib=libc++")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++ -stdlib=libc++")
|
2011-12-11 21:27:06 +01:00
|
|
|
# Avoid mistaking an object file for a source file on the link command line.
|
2011-12-05 00:57:51 +01:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none")
|
2011-12-11 21:27:06 +01:00
|
|
|
|
|
|
|
# Identify the target system:
|
2013-03-19 14:50:56 +01:00
|
|
|
# Ask for 64-bit binary.
|
|
|
|
set(TARGET_FLAGS "-arch x86_64")
|
2011-12-11 21:27:06 +01: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.
|
2013-03-29 15:31:15 +01:00
|
|
|
set(OSX_MIN_VERSION "10.7")
|
2011-12-11 21:27:06 +01:00
|
|
|
set(TARGET_FLAGS "${TARGET_FLAGS} -mmacosx-version-min=${OSX_MIN_VERSION}")
|
2013-03-29 15:31:15 +01:00
|
|
|
set(SYSROOT_LEGACY_PATH "/Developer/SDKs/MacOSX10.7.sdk")
|
|
|
|
set(SYSROOT_PATH "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk")
|
2012-03-26 05:27:18 +02:00
|
|
|
if(EXISTS "${SYSROOT_PATH}/")
|
2013-07-11 04:49:13 +02:00
|
|
|
set(TARGET_SYSROOT ${SYSROOT_PATH})
|
2012-03-26 05:27:18 +02:00
|
|
|
elseif(EXISTS "${SYSROOT_LEGACY_PATH}/")
|
2013-07-11 04:49:13 +02:00
|
|
|
set(TARGET_SYSROOT ${SYSROOT_LEGACY_PATH})
|
2012-03-23 02:11:45 +01:00
|
|
|
endif()
|
2012-03-26 05:27:18 +02:00
|
|
|
if(${TARGET_SYSROOT})
|
2013-07-11 04:49:13 +02:00
|
|
|
set(TARGET_FLAGS "${TARGET_FLAGS} -isysroot ${TARGET_SYSROOT}")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-syslibroot,${TARGET_SYSROOT}")
|
2012-03-14 01:14:00 +01:00
|
|
|
endif()
|
2011-12-15 06:41:39 +01:00
|
|
|
# Do not warn about frameworks that are not available on all architectures.
|
|
|
|
# This avoids a warning when linking with QuickTime.
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_arch_warnings")
|
2011-12-11 21:27:06 +01:00
|
|
|
# Specify target CPUs.
|
2013-03-29 15:31:15 +01:00
|
|
|
set(TARGET_FLAGS "${TARGET_FLAGS} -mssse3")
|
|
|
|
set(TARGET_FLAGS "${TARGET_FLAGS} -march=core2")
|
2011-12-11 21:27:06 +01:00
|
|
|
# Target flags apply to both C and C++ compilation.
|
2011-12-17 15:31:36 +01:00
|
|
|
# CMake passes these to the compiler on the link command line as well.
|
2011-12-11 21:27:06 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_FLAGS}")
|
|
|
|
|
|
|
|
# Linker flags.
|
|
|
|
# Drop unreachable code and data.
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs")
|
|
|
|
# Reserve the minimum size for the zero page.
|
|
|
|
# Our JIT requires virtual memory space below 2GB, while the default zero
|
|
|
|
# page on x86_64 is 4GB in size.
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-pagezero_size,0x1000")
|
|
|
|
|
2011-12-07 08:26:44 +01:00
|
|
|
find_library(APPKIT_LIBRARY AppKit)
|
|
|
|
find_library(APPSERV_LIBRARY ApplicationServices)
|
|
|
|
find_library(ATB_LIBRARY AudioToolbox)
|
|
|
|
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(IOB_LIBRARY IOBluetooth)
|
|
|
|
find_library(IOK_LIBRARY IOKit)
|
2011-12-11 21:24:40 +01:00
|
|
|
find_library(QUICKTIME_LIBRARY QuickTime)
|
2011-12-07 08:26:44 +01:00
|
|
|
find_library(WEBKIT_LIBRARY WebKit)
|
2014-01-29 00:11:51 +01:00
|
|
|
find_library(FORCEFEEDBACK ForceFeedback)
|
2011-02-07 16:51:38 +01:00
|
|
|
endif()
|
2011-12-07 08:26:44 +01:00
|
|
|
|
2010-11-08 15:04:56 +01:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-D_SECURE_SCL=0)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
|
|
endif(WIN32)
|
|
|
|
|
2010-11-05 05:19:22 +01:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2010-11-06 00:38:37 +01:00
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
|
2010-11-05 05:19:22 +01:00
|
|
|
"Build type (Release/Debug/RelWithDebInfo/MinSizeRe)" FORCE)
|
2010-11-06 00:38:37 +01:00
|
|
|
endif(NOT CMAKE_BUILD_TYPE)
|
2010-11-05 05:19:22 +01:00
|
|
|
|
2012-12-30 05:48:22 +01:00
|
|
|
|
2010-11-05 03:23:24 +01:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
add_definitions(-D_DEBUG -ggdb)
|
|
|
|
set(wxWidgets_USE_DEBUG ON CACHE BOOL "Use wxWidgets Debugging")
|
2012-12-30 05:48:22 +01:00
|
|
|
|
|
|
|
option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF)
|
|
|
|
if(ENABLE_GPROF)
|
|
|
|
add_definitions(-pg)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
|
|
|
endif()
|
2010-11-05 03:23:24 +01:00
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
|
2013-03-29 17:58:30 +01:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE)
|
2010-11-05 03:23:24 +01:00
|
|
|
add_definitions(-fomit-frame-pointer)
|
2013-04-01 22:07:45 +02:00
|
|
|
endif()
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2010-12-13 06:29:13 +01:00
|
|
|
if(FASTLOG)
|
|
|
|
add_definitions(-DDEBUGFAST)
|
|
|
|
endif()
|
|
|
|
|
2013-01-06 11:28:27 +01:00
|
|
|
if(GDBSTUB)
|
|
|
|
add_definitions(-DUSE_GDBSTUB)
|
|
|
|
endif(GDBSTUB)
|
|
|
|
|
2013-07-14 01:42:04 +02:00
|
|
|
if(ANDROID)
|
|
|
|
message("Building for Android")
|
|
|
|
add_definitions(-DANDROID)
|
|
|
|
set(USE_X11 0)
|
|
|
|
set(USE_UPNP 0)
|
2014-08-07 01:08:24 +02:00
|
|
|
set(USE_EGL 1)
|
2013-07-14 01:42:04 +02:00
|
|
|
endif()
|
|
|
|
|
2014-01-13 10:33:33 +01:00
|
|
|
include_directories(Externals/GL)
|
|
|
|
|
2012-05-17 00:11:55 +02:00
|
|
|
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
|
2010-12-13 06:29:13 +01:00
|
|
|
|
2010-11-01 16:47:02 +01:00
|
|
|
########################################
|
|
|
|
# Dependency checking
|
|
|
|
#
|
2011-02-11 03:38:23 +01: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 12:40:16 +02:00
|
|
|
include(CheckLib)
|
|
|
|
include(CheckCXXSourceRuns)
|
2013-11-24 23:28:20 +01:00
|
|
|
|
|
|
|
if(OPENMP)
|
|
|
|
include(FindOpenMP OPTIONAL)
|
|
|
|
if(OPENMP_FOUND)
|
|
|
|
message("OpenMP parallelization enabled")
|
|
|
|
add_definitions("${OpenMP_CXX_FLAGS}")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(NOT OPENMP_FOUND)
|
|
|
|
add_definitions(-Wno-unknown-pragmas)
|
|
|
|
message("OpenMP parallelization disabled")
|
|
|
|
endif()
|
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
if(NOT ANDROID)
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2014-01-18 05:11:59 +01:00
|
|
|
include(FindOpenGL)
|
|
|
|
include_directories(${OPENGL_INCLUDE_DIR})
|
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
include(FindALSA OPTIONAL)
|
|
|
|
if(ALSA_FOUND)
|
|
|
|
add_definitions(-DHAVE_ALSA=1)
|
|
|
|
message("ALSA found, enabling ALSA sound backend")
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_ALSA=0)
|
|
|
|
message("ALSA NOT found, disabling ALSA sound backend")
|
|
|
|
endif(ALSA_FOUND)
|
|
|
|
|
|
|
|
check_lib(AO ao QUIET)
|
|
|
|
if(AO_FOUND)
|
|
|
|
add_definitions(-DHAVE_AO=1)
|
|
|
|
message("ao found, enabling ao sound backend")
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_AO=0)
|
|
|
|
message("ao NOT found, disabling ao sound backend")
|
|
|
|
endif(AO_FOUND)
|
|
|
|
|
|
|
|
check_lib(BLUEZ bluez QUIET)
|
|
|
|
if(BLUEZ_FOUND)
|
|
|
|
add_definitions(-DHAVE_BLUEZ=1)
|
|
|
|
message("bluez found, enabling bluetooth support")
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_BLUEZ=0)
|
|
|
|
message("bluez NOT found, disabling bluetooth support")
|
|
|
|
endif(BLUEZ_FOUND)
|
|
|
|
|
2014-01-31 22:00:33 +01:00
|
|
|
check_lib(PULSEAUDIO libpulse QUIET)
|
2013-02-26 20:49:00 +01:00
|
|
|
if(PULSEAUDIO_FOUND)
|
|
|
|
add_definitions(-DHAVE_PULSEAUDIO=1)
|
|
|
|
message("PulseAudio found, enabling PulseAudio sound backend")
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_PULSEAUDIO=0)
|
|
|
|
message("PulseAudio NOT found, disabling PulseAudio sound backend")
|
|
|
|
endif(PULSEAUDIO_FOUND)
|
|
|
|
|
|
|
|
include(FindOpenAL OPTIONAL)
|
|
|
|
if(OPENAL_FOUND)
|
|
|
|
add_definitions(-DHAVE_OPENAL=1)
|
|
|
|
include_directories(${OPENAL_INCLUDE_DIR})
|
|
|
|
message("OpenAL found, enabling OpenAL sound backend")
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_OPENAL=0)
|
|
|
|
message("OpenAL NOT found, disabling OpenAL sound backend")
|
|
|
|
endif(OPENAL_FOUND)
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2014-08-07 01:08:24 +02:00
|
|
|
set(USE_X11 0)
|
|
|
|
|
2013-03-25 03:06:34 +01:00
|
|
|
if(UNIX AND NOT APPLE)
|
2013-07-11 04:49:13 +02:00
|
|
|
# Note: We do not need to explicitly check for X11 as it is done in the cmake
|
|
|
|
# FindOpenGL module on linux.
|
2014-08-07 01:08:24 +02:00
|
|
|
if(TRY_X11 AND X11_FOUND)
|
2013-03-25 03:06:34 +01:00
|
|
|
set(USE_X11 1)
|
2013-02-26 20:49:00 +01:00
|
|
|
add_definitions(-DHAVE_X11=1)
|
|
|
|
include_directories(${X11_INCLUDE_DIR})
|
2013-03-25 03:06:34 +01:00
|
|
|
message("X11 support enabled")
|
2013-02-26 20:49:00 +01:00
|
|
|
else()
|
2013-03-25 03:06:34 +01:00
|
|
|
set(USE_X11 0)
|
|
|
|
SET(X11_FOUND "")
|
|
|
|
message("X11 support disabled")
|
|
|
|
add_definitions(-DHAVE_X11=0)
|
2014-08-07 01:08:24 +02:00
|
|
|
endif(TRY_X11 AND X11_FOUND)
|
2013-07-11 04:49:13 +02:00
|
|
|
|
2014-08-06 02:33:50 +02:00
|
|
|
if (NOT USE_X11)
|
2013-03-25 03:06:34 +01:00
|
|
|
message(FATAL_ERROR "\n"
|
2013-07-11 04:49:13 +02:00
|
|
|
"No suitable display platform found\n"
|
2014-08-06 02:33:50 +02:00
|
|
|
"Requires x11 to run")
|
2013-03-25 03:06:34 +01:00
|
|
|
endif()
|
2013-02-26 20:49:00 +01:00
|
|
|
endif()
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2013-03-25 03:06:34 +01:00
|
|
|
if(USE_X11)
|
2013-02-26 20:49:00 +01:00
|
|
|
check_lib(XRANDR Xrandr)
|
2013-03-25 03:06:34 +01:00
|
|
|
if(XRANDR_FOUND)
|
|
|
|
add_definitions(-DHAVE_XRANDR=1)
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_XRANDR=0)
|
|
|
|
endif(XRANDR_FOUND)
|
2013-07-21 06:43:48 +02:00
|
|
|
|
|
|
|
pkg_check_modules(XINPUT2 xi>=1.5.0)
|
|
|
|
if(XINPUT2_FOUND)
|
2013-07-10 08:49:58 +02:00
|
|
|
add_definitions(-DHAVE_X11_XINPUT2=1)
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_X11_XINPUT2=0)
|
2013-07-21 06:43:48 +02:00
|
|
|
endif(XINPUT2_FOUND)
|
2013-02-26 20:49:00 +01:00
|
|
|
endif()
|
|
|
|
if(ENCODE_FRAMEDUMPS)
|
|
|
|
check_libav()
|
|
|
|
endif()
|
2010-11-14 22:14:26 +01:00
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES portaudio)
|
|
|
|
CHECK_CXX_SOURCE_RUNS(
|
|
|
|
"#include <portaudio.h>
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{ if(Pa_GetVersion() >= 1890) return 0; else return 1; }"
|
|
|
|
PORTAUDIO)
|
|
|
|
if(PORTAUDIO)
|
|
|
|
message("PortAudio found, enabling mic support")
|
|
|
|
add_definitions(-DHAVE_PORTAUDIO=1)
|
|
|
|
set(PORTAUDIO_FOUND TRUE)
|
2011-01-08 06:27:18 +01:00
|
|
|
else()
|
2013-02-26 20:49:00 +01:00
|
|
|
message("PortAudio not found, disabling mic support")
|
|
|
|
add_definitions(-DHAVE_PORTAUDIO=0)
|
|
|
|
set(PORTAUDIO_FOUND FALSE)
|
|
|
|
endif(PORTAUDIO)
|
|
|
|
|
|
|
|
if(OPROFILING)
|
|
|
|
check_lib(OPROFILE opagent opagent.h)
|
|
|
|
check_lib(BFD bfd bfd.h)
|
|
|
|
if(OPROFILE_FOUND AND BFD_FOUND)
|
|
|
|
message("oprofile found, enabling profiling support")
|
|
|
|
add_definitions(-DUSE_OPROFILE=1)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "oprofile or bfd not found. Can't build profiling support.")
|
|
|
|
endif()
|
2011-01-08 06:27:18 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
2012-02-18 09:46:58 +01:00
|
|
|
|
2014-08-07 01:08:24 +02:00
|
|
|
if(USE_EGL)
|
|
|
|
message("EGL OpenGL interface enabled")
|
|
|
|
add_definitions(-DUSE_EGL=1)
|
|
|
|
endif()
|
|
|
|
|
2010-11-01 16:47:02 +01:00
|
|
|
########################################
|
|
|
|
# Setup include directories (and make sure they are preferred over the Externals)
|
|
|
|
#
|
2014-02-18 12:09:38 +01:00
|
|
|
include_directories(Source/Core)
|
|
|
|
|
2010-11-01 16:47:02 +01:00
|
|
|
########################################
|
|
|
|
# Process externals and setup their include directories
|
|
|
|
#
|
|
|
|
# NOTES about adding Externals:
|
2010-11-05 05:19:22 +01: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 22:15:55 +01:00
|
|
|
# Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory)
|
2010-11-01 16:47:02 +01:00
|
|
|
#
|
|
|
|
add_subdirectory(Externals/Bochs_disasm)
|
|
|
|
include_directories(Externals/Bochs_disasm)
|
|
|
|
|
2013-12-24 00:01:34 +01:00
|
|
|
# If zlib has already been found on a previous run of cmake don't check again
|
|
|
|
# as the check seems to take a long time.
|
|
|
|
if(NOT ZLIB_FOUND)
|
|
|
|
include(FindZLIB OPTIONAL)
|
|
|
|
endif()
|
|
|
|
if(ZLIB_FOUND)
|
|
|
|
set(ZLIB_FOUND 1 CACHE INTERNAL "")
|
|
|
|
message("Using shared zlib")
|
|
|
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
|
|
|
else(ZLIB_FOUND)
|
|
|
|
message("Shared zlib not found, falling back to the static library")
|
|
|
|
add_subdirectory(Externals/zlib)
|
|
|
|
include_directories(Externals/zlib)
|
|
|
|
endif(ZLIB_FOUND)
|
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
2011-12-19 00:54:45 +01:00
|
|
|
check_lib(LZO lzo2 lzo/lzo1x.h QUIET)
|
|
|
|
endif()
|
2010-11-19 00:27:27 +01:00
|
|
|
if(LZO_FOUND)
|
2010-11-04 03:01:07 +01:00
|
|
|
message("Using shared lzo")
|
|
|
|
else()
|
2011-12-19 00:54:45 +01:00
|
|
|
message("Using static lzo from Externals")
|
2010-11-04 03:01:07 +01:00
|
|
|
add_subdirectory(Externals/LZO)
|
|
|
|
include_directories(Externals/LZO)
|
2011-12-05 05:33:35 +01:00
|
|
|
set(LZO lzo2)
|
2010-11-19 00:27:27 +01:00
|
|
|
endif()
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2013-11-15 02:09:38 +01:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
|
|
|
check_lib(PNG png png.h QUIET)
|
|
|
|
endif()
|
|
|
|
if (PNG_FOUND)
|
|
|
|
message("Using shared libpng")
|
|
|
|
else()
|
2013-04-13 22:09:05 +02:00
|
|
|
message("Using static libpng from Externals")
|
|
|
|
add_subdirectory(Externals/libpng)
|
|
|
|
include_directories(Externals/libpng)
|
2013-11-15 02:09:38 +01:00
|
|
|
set(PNG png)
|
2013-04-13 22:09:05 +02:00
|
|
|
endif()
|
|
|
|
|
2013-01-09 17:26:12 +01:00
|
|
|
if(OPENAL_FOUND)
|
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2014-03-10 12:39:30 +01:00
|
|
|
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h QUIET)
|
2013-01-09 17:26:12 +01:00
|
|
|
endif()
|
|
|
|
if (SOUNDTOUCH_FOUND)
|
|
|
|
message("Using shared soundtouch")
|
|
|
|
else()
|
|
|
|
message("Using static soundtouch from Externals")
|
|
|
|
add_subdirectory(Externals/soundtouch)
|
2013-01-09 17:42:05 +01:00
|
|
|
include_directories(Externals)
|
2013-01-09 17:26:12 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
if(NOT ANDROID)
|
2012-07-13 00:38:29 +02:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2013-02-26 20:49:00 +01:00
|
|
|
include(FindSDL2 OPTIONAL)
|
|
|
|
endif()
|
|
|
|
if(SDL2_FOUND)
|
|
|
|
message("Using shared SDL2")
|
2014-05-05 02:41:02 +02:00
|
|
|
add_definitions(-DHAVE_SDL=1)
|
2013-02-26 20:49:00 +01:00
|
|
|
include_directories(${SDL2_INCLUDE_DIR})
|
|
|
|
else(SDL2_FOUND)
|
|
|
|
# SDL2 not found, try SDL
|
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2013-07-10 05:07:27 +02:00
|
|
|
include(FindSDL OPTIONAL)
|
|
|
|
endif()
|
|
|
|
if(SDL_FOUND)
|
|
|
|
message("Using shared SDL")
|
2014-05-05 02:41:02 +02:00
|
|
|
add_definitions(-DHAVE_SDL=1)
|
2013-07-10 05:07:27 +02:00
|
|
|
include_directories(${SDL_INCLUDE_DIR})
|
|
|
|
else(SDL_FOUND)
|
2014-05-05 02:41:02 +02:00
|
|
|
message("SDL NOT found, disabling SDL input")
|
|
|
|
add_definitions(-DHAVE_SDL=0)
|
2013-07-10 05:07:27 +02:00
|
|
|
endif(SDL_FOUND)
|
2013-02-26 20:49:00 +01:00
|
|
|
endif(SDL2_FOUND)
|
|
|
|
endif()
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2012-12-30 04:57:37 +01:00
|
|
|
include(FindLibUSB OPTIONAL)
|
2012-12-24 00:58:11 +01:00
|
|
|
if(LIBUSB_FOUND)
|
|
|
|
message("Using shared LibUSB")
|
2012-12-30 04:57:37 +01:00
|
|
|
add_definitions(-D__LIBUSB__)
|
2012-12-24 00:58:11 +01:00
|
|
|
include_directories(${LIBUSB_INCLUDE_DIR})
|
|
|
|
endif(LIBUSB_FOUND)
|
|
|
|
|
2011-08-20 04:12:07 +02:00
|
|
|
set(SFML_FIND_VERSION TRUE)
|
|
|
|
set(SFML_FIND_VERSION_MAJOR 1)
|
|
|
|
set(SFML_FIND_VERSION_MINOR 5)
|
2013-02-26 20:49:00 +01:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
2011-12-19 00:54:45 +01:00
|
|
|
include(FindSFML OPTIONAL)
|
|
|
|
endif()
|
2011-08-22 00:27:55 +02:00
|
|
|
if(SFML_FOUND AND NOT SFML_VERSION_MAJOR) # SFML 1.x doesn't define SFML_VERSION_MAJOR
|
2013-07-11 04:49:13 +02:00
|
|
|
message("Using shared SFML")
|
2010-11-04 03:01:07 +01:00
|
|
|
else()
|
2013-07-11 04:49:13 +02:00
|
|
|
message("Using static SFML ${SFML_FIND_VERSION_MAJOR}.${SFML_FIND_VERSION_MINOR} from Externals")
|
|
|
|
add_subdirectory(Externals/SFML)
|
2014-08-20 15:44:18 +02:00
|
|
|
include_directories(BEFORE Externals/SFML/include)
|
2010-11-19 00:27:27 +01:00
|
|
|
endif()
|
2010-11-04 03:01:07 +01:00
|
|
|
|
2013-07-09 02:13:02 +02:00
|
|
|
if(USE_UPNP)
|
2013-07-10 05:07:27 +02:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
|
|
|
include(FindMiniupnpc)
|
|
|
|
endif()
|
2013-07-15 16:22:47 +02:00
|
|
|
if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
2013-07-10 05:07:27 +02:00
|
|
|
message("Using shared miniupnpc")
|
|
|
|
include_directories(${MINIUPNP_INCLUDE_DIR})
|
|
|
|
else()
|
|
|
|
message("Using static miniupnpc from Externals")
|
|
|
|
add_subdirectory(Externals/miniupnpc)
|
|
|
|
include_directories(Externals/miniupnpc/src)
|
|
|
|
endif()
|
2013-07-09 02:13:02 +02:00
|
|
|
add_definitions(-DUSE_UPNP)
|
2010-11-19 00:27:27 +01:00
|
|
|
endif()
|
2010-11-04 03:01:07 +01:00
|
|
|
|
2013-09-03 03:07:47 +02:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
|
|
|
include(FindPolarSSL)
|
|
|
|
endif()
|
|
|
|
if(POLARSSL_FOUND AND POLARSSL_WORKS)
|
|
|
|
message("Using shared PolarSSL")
|
|
|
|
include_directories(${POLARSSL_INCLUDE_DIR})
|
|
|
|
else()
|
|
|
|
message("Using PolarSSL from Externals")
|
2013-09-12 06:35:52 +02:00
|
|
|
set(POLARSSL_LIBRARY polarssl)
|
2013-09-03 03:07:47 +02:00
|
|
|
add_subdirectory(Externals/polarssl/)
|
|
|
|
include_directories(Externals/polarssl/include)
|
|
|
|
endif()
|
2013-08-15 13:36:17 +02:00
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
2011-12-19 00:54:45 +01:00
|
|
|
check_lib(SOIL SOIL SOIL/SOIL.h QUIET)
|
|
|
|
endif()
|
2010-11-19 00:27:27 +01:00
|
|
|
if(SOIL_FOUND)
|
2010-11-04 03:01:07 +01:00
|
|
|
message("Using shared SOIL")
|
|
|
|
else()
|
2011-12-19 00:54:45 +01:00
|
|
|
message("Using static SOIL from Externals")
|
2010-11-04 03:01:07 +01:00
|
|
|
add_subdirectory(Externals/SOIL)
|
|
|
|
include_directories(Externals/SOIL)
|
2010-11-19 00:27:27 +01:00
|
|
|
endif()
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2013-08-29 12:53:15 +02:00
|
|
|
if (ANDROID)
|
2013-08-29 11:43:31 +02:00
|
|
|
message("Using static iconv from Externals")
|
|
|
|
include_directories(Externals/libiconv-1.14/include)
|
|
|
|
add_subdirectory(Externals/libiconv-1.14)
|
|
|
|
endif()
|
|
|
|
|
2014-09-14 21:03:07 +02:00
|
|
|
if(ENABLE_QT)
|
|
|
|
find_package(Qt5Widgets REQUIRED)
|
|
|
|
message("Found Qt version ${Qt5Core_VERSION}, enabling the Qt backend")
|
|
|
|
endif()
|
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
if(NOT DISABLE_WX AND NOT ANDROID)
|
2012-03-20 07:16:01 +01:00
|
|
|
include(FindwxWidgets OPTIONAL)
|
|
|
|
FIND_PACKAGE(wxWidgets COMPONENTS core aui adv)
|
2010-11-08 15:04:56 +01:00
|
|
|
|
2013-02-26 20:49:00 +01:00
|
|
|
if(wxWidgets_FOUND)
|
2013-08-25 02:49:58 +02:00
|
|
|
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2013-02-26 20:49:00 +01:00
|
|
|
COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
|
2013-07-11 04:49:13 +02:00
|
|
|
${wxWidgets_CONFIG_OPTIONS} --version
|
2011-12-04 03:37:02 +01:00
|
|
|
OUTPUT_VARIABLE wxWidgets_VERSION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
message("Found wxWidgets version ${wxWidgets_VERSION}")
|
2014-07-15 01:04:38 +02:00
|
|
|
if(UNIX)
|
|
|
|
set(wxMIN_VERSION "3.0.0")
|
2012-05-02 21:40:40 +02:00
|
|
|
endif()
|
|
|
|
if(${wxWidgets_VERSION} VERSION_LESS ${wxMIN_VERSION})
|
|
|
|
message("At least ${wxMIN_VERSION} is required; ignoring found version")
|
2011-12-04 03:37:02 +01:00
|
|
|
unset(wxWidgets_FOUND)
|
|
|
|
endif()
|
|
|
|
endif(wxWidgets_FOUND)
|
2010-11-08 15:04:56 +01:00
|
|
|
|
2013-07-11 04:49:13 +02:00
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
# There is a bug in the FindGTK module in cmake version 2.8.2 that
|
|
|
|
# does not find gdk-pixbuf-2.0. On the other hand some 2.8.3
|
|
|
|
# users have complained that pkg-config does not find
|
|
|
|
# gdk-pixbuf-2.0. On yet another hand, cmake version 2.8.3 in
|
|
|
|
# Ubuntu Natty does not find the glib libraries correctly.
|
|
|
|
# Ugly!!!
|
|
|
|
execute_process(COMMAND lsb_release -c -s
|
|
|
|
OUTPUT_VARIABLE DIST_NAME
|
|
|
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}
|
|
|
|
VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty")
|
|
|
|
check_lib(GTK2 gtk+-2.0 gtk.h REQUIRED)
|
|
|
|
else()
|
|
|
|
include(FindGTK2)
|
|
|
|
if(GTK2_FOUND)
|
|
|
|
include_directories(${GTK2_INCLUDE_DIRS})
|
2011-01-08 20:14:45 +01:00
|
|
|
endif()
|
2010-11-17 02:03:39 +01:00
|
|
|
endif()
|
2013-07-11 04:49:13 +02:00
|
|
|
endif()
|
2010-11-08 15:04:56 +01:00
|
|
|
|
2012-03-19 12:54:32 +01:00
|
|
|
if(wxWidgets_FOUND)
|
|
|
|
include(${wxWidgets_USE_FILE})
|
2010-11-08 15:04:56 +01:00
|
|
|
message("wxWidgets found, enabling GUI build")
|
|
|
|
else(wxWidgets_FOUND)
|
2011-12-19 00:54:45 +01:00
|
|
|
message("Using static wxWidgets from Externals")
|
2012-03-19 12:54:32 +01:00
|
|
|
|
|
|
|
# These definitions and includes are used when building dolphin against wx,
|
|
|
|
# not when building wx itself (see wxw3 CMakeLists.txt for that)
|
2011-12-04 03:59:42 +01:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
add_definitions(-D__WXOSX_COCOA__)
|
2012-03-19 12:54:32 +01:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
add_definitions(-D__WXGTK__)
|
2012-03-23 01:06:45 +01:00
|
|
|
|
|
|
|
# Check for required libs
|
|
|
|
check_lib(GTHREAD2 gthread-2.0 glib/gthread.h REQUIRED)
|
|
|
|
check_lib(PANGOCAIRO pangocairo pango/pangocairo.h REQUIRED)
|
2012-03-19 12:54:32 +01:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
add_definitions(-D__WXMSW__)
|
2011-12-04 03:59:42 +01:00
|
|
|
else()
|
2012-03-19 12:54:32 +01:00
|
|
|
message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform")
|
2011-12-04 03:59:42 +01:00
|
|
|
endif()
|
2013-07-11 04:49:13 +02:00
|
|
|
|
2012-03-19 12:54:32 +01:00
|
|
|
include_directories(
|
|
|
|
Externals/wxWidgets3
|
|
|
|
Externals/wxWidgets3/include)
|
|
|
|
add_subdirectory(Externals/wxWidgets3)
|
2011-12-05 01:10:45 +01:00
|
|
|
set(wxWidgets_FOUND TRUE)
|
2012-03-19 12:54:32 +01:00
|
|
|
set(wxWidgets_LIBRARIES "wx")
|
2010-11-08 15:04:56 +01:00
|
|
|
endif(wxWidgets_FOUND)
|
2010-11-17 02:03:39 +01:00
|
|
|
add_definitions(-DHAVE_WX=1)
|
2013-02-26 20:49:00 +01:00
|
|
|
endif(NOT DISABLE_WX AND NOT ANDROID)
|
2010-11-01 16:47:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
########################################
|
2011-08-22 00:07:19 +02:00
|
|
|
# Pre-build events: Define configuration variables and write SCM info header
|
2010-11-01 16:47:02 +01:00
|
|
|
#
|
2011-08-21 23:55:21 +02:00
|
|
|
if(DOLPHIN_WC_BRANCH STREQUAL "master")
|
2011-08-21 23:30:19 +02:00
|
|
|
set(DOLPHIN_WC_IS_MASTER "1")
|
|
|
|
else()
|
|
|
|
set(DOLPHIN_WC_IS_MASTER "0")
|
|
|
|
endif()
|
|
|
|
|
2013-12-07 21:14:29 +01:00
|
|
|
file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h
|
2011-08-21 23:30:19 +02:00
|
|
|
"#define SCM_REV_STR \"" ${DOLPHIN_WC_REVISION} "\"\n"
|
|
|
|
"#define SCM_DESC_STR \"" ${DOLPHIN_WC_DESCRIBE} "\"\n"
|
|
|
|
"#define SCM_BRANCH_STR \"" ${DOLPHIN_WC_BRANCH} "\"\n"
|
|
|
|
"#define SCM_IS_MASTER " ${DOLPHIN_WC_IS_MASTER} "\n"
|
|
|
|
)
|
2013-12-07 21:14:29 +01:00
|
|
|
include_directories("${PROJECT_BINARY_DIR}/Source/Core/Common")
|
2010-12-19 15:02:43 +01:00
|
|
|
|
2014-03-03 03:38:46 +01:00
|
|
|
########################################
|
|
|
|
# Unit testing.
|
|
|
|
#
|
|
|
|
include_directories(Externals/gtest/include)
|
|
|
|
add_subdirectory(Externals/gtest)
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
add_custom_target(unittests)
|
|
|
|
add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND})
|
|
|
|
|
2011-07-18 03:47:55 +02:00
|
|
|
|
2010-11-01 16:47:02 +01:00
|
|
|
########################################
|
|
|
|
# Start compiling our code
|
|
|
|
#
|
2012-03-08 10:01:40 +01:00
|
|
|
add_definitions(-std=gnu++0x)
|
2010-11-01 16:47:02 +01:00
|
|
|
add_subdirectory(Source)
|
|
|
|
|
|
|
|
|
|
|
|
########################################
|
2010-11-04 14:47:17 +01:00
|
|
|
# Install shared data files
|
2010-11-01 16:47:02 +01:00
|
|
|
#
|
2011-12-14 02:50:36 +01:00
|
|
|
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
|
|
|
|
install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN)
|
|
|
|
endif()
|
|
|
|
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin"))
|
2010-12-12 16:25:03 +01:00
|
|
|
install(FILES Data/license.txt DESTINATION ${datadir})
|
|
|
|
endif()
|
2013-01-07 23:50:48 +01:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
# Install the application icon and menu item
|
2014-09-06 16:41:45 +02:00
|
|
|
install(FILES Installer/dolphin-emu.xpm
|
|
|
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps)
|
|
|
|
install(FILES Installer/dolphin-emu.desktop
|
2013-01-07 23:50:48 +01:00
|
|
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
|
|
|
endif()
|
2010-11-01 16:47:02 +01:00
|
|
|
|
|
|
|
# packaging information
|
|
|
|
set(CPACK_PACKAGE_NAME "dolphin-emu")
|
|
|
|
set(CPACK_PACKAGE_VENDOR "Dolphin Team")
|
2011-12-11 16:21:17 +01: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 12:51:01 +01:00
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/Data/cpack_package_description.txt)
|
2014-06-07 04:30:39 +02:00
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A GameCube, Wii and Triforce emulator")
|
2010-11-01 16:47:02 +01:00
|
|
|
|
2012-12-22 12:51:01 +01:00
|
|
|
set(CPACK_RPM_PACKAGE_GROUP System/Emulators/Other)
|
|
|
|
set(CPACK_RPM_PACKAGE_LICENSE GPL-2.0)
|
2010-11-01 16:47:02 +01: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 16:50:52 +01:00
|
|
|
|
2010-12-15 15:47:13 +01:00
|
|
|
set(CPACK_SET_DESTDIR ON)
|
|
|
|
set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP")
|
2012-12-22 12:51:01 +01:00
|
|
|
set(CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~;\\\\.swp;/\\\\.git")
|
2010-12-15 15:47:13 +01:00
|
|
|
list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}")
|
|
|
|
|
2010-11-11 16:50:52 +01:00
|
|
|
# CPack must be included after the CPACK_* variables are set in order for those
|
|
|
|
# variables to take effect.
|
2013-02-26 20:49:00 +01:00
|
|
|
Include(CPack)
|
2013-10-17 06:06:34 +02:00
|
|
|
|