2010-11-01 09:47:02 -06:00
|
|
|
########################################
|
|
|
|
# General setup
|
|
|
|
#
|
2010-11-05 21:49:18 -06:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
project(dolphin-emu)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
|
2011-08-20 15:05:43 -06:00
|
|
|
set(DOLPHIN_IS_STABLE FALSE)
|
2010-11-04 07:47:17 -06:00
|
|
|
|
|
|
|
# Set up paths
|
2011-02-10 19:38:23 -07:00
|
|
|
set(bindir ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bindir")
|
|
|
|
set(datadir ${CMAKE_INSTALL_PREFIX}/share/dolphin-emu CACHE PATH "datadir")
|
2010-11-04 07:47:17 -06:00
|
|
|
set(userdir ".dolphin-emu" CACHE STRING "User directory")
|
|
|
|
add_definitions(-DUSER_DIR="${userdir}")
|
|
|
|
add_definitions(-DDATA_DIR="${datadir}/")
|
|
|
|
|
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
|
|
|
|
2011-01-09 09:36:19 -07:00
|
|
|
# Precompiled header support for MSVC:
|
2011-02-10 19:38:23 -07: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 09:36:19 -07: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-10 19:38:23 -07:00
|
|
|
set_source_files_properties(${pch_unity} PROPERTIES COMPILE_FLAGS
|
|
|
|
"/Yc\"${pch_abs}\"")
|
2011-01-09 09:36:19 -07:00
|
|
|
|
|
|
|
# Update properties of source files to use the precompiled header.
|
2011-02-10 19:38:23 -07:00
|
|
|
# Additionally, force the inclusion of the precompiled header at
|
|
|
|
# beginning of each source file.
|
2011-01-09 09:36:19 -07:00
|
|
|
foreach(source_file ${files} )
|
2011-02-10 19:38:23 -07:00
|
|
|
set_source_files_properties(${source_file} PROPERTIES COMPILE_FLAGS
|
|
|
|
"/Yu\"${pch_abs}\" /FI\"${pch_abs}\"")
|
2011-01-09 09:36:19 -07:00
|
|
|
endforeach(source_file)
|
|
|
|
|
2011-02-10 19:38:23 -07:00
|
|
|
# Finally, update the source file collection to contain the
|
|
|
|
# precompiled header translation unit
|
2011-01-09 09:36:19 -07:00
|
|
|
set(${SOURCE_VARIABLE_NAME} ${pch_unity} ${${SOURCE_VARIABLE_NAME}} PARENT_SCOPE)
|
|
|
|
endif(MSVC)
|
|
|
|
endfunction(enable_precompiled_headers)
|
|
|
|
|
2011-08-14 14:17:57 -06:00
|
|
|
# for revision info
|
|
|
|
include(FindGit OPTIONAL)
|
|
|
|
if(GIT_FOUND AND NOT DOLPHIN_WC_REVISION)
|
|
|
|
# defines DOLPHIN_WC_REVISION
|
|
|
|
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
|
|
|
OUTPUT_VARIABLE DOLPHIN_WC_REVISION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2011-08-20 15:05:43 -06:00
|
|
|
endif()
|
|
|
|
|
2010-11-04 20:23:24 -06:00
|
|
|
# Various compile flags
|
2011-01-09 09:36:19 -07:00
|
|
|
add_definitions(-msse2)
|
|
|
|
|
|
|
|
# Enabling all warnings in MSVC spams too much
|
|
|
|
if(NOT MSVC)
|
|
|
|
add_definitions(-Wall)
|
|
|
|
endif(NOT MSVC)
|
2010-11-01 09:47:02 -06:00
|
|
|
|
|
|
|
# gcc uses some optimizations which might break stuff without this flag
|
2010-11-07 10:45:35 -07:00
|
|
|
add_definitions(-fno-strict-aliasing -fno-exceptions)
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2010-11-04 20:23:24 -06:00
|
|
|
include(CheckCXXCompilerFlag)
|
2010-11-13 15:07:27 -07:00
|
|
|
|
|
|
|
# We call fread numerous times without checking return values. Hide the
|
|
|
|
# corresponding compiler warnings if the compiler supports doing so.
|
2010-11-21 12:13:55 -07:00
|
|
|
CHECK_CXX_COMPILER_FLAG(-Wunused-result NO_UNUSED_RESULT)
|
2010-11-13 15:07:27 -07:00
|
|
|
if(NO_UNUSED_RESULT)
|
|
|
|
add_definitions(-Wno-unused-result)
|
|
|
|
endif(NO_UNUSED_RESULT)
|
|
|
|
|
2010-11-04 20:23:24 -06:00
|
|
|
CHECK_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden VISIBILITY_INLINES_HIDDEN)
|
|
|
|
if(VISIBILITY_INLINES_HIDDEN)
|
2010-11-18 16:27:27 -07:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
|
2010-11-04 20:23:24 -06:00
|
|
|
endif(VISIBILITY_INLINES_HIDDEN)
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2010-12-04 08:19:04 -07:00
|
|
|
if(UNIX AND NOT APPLE)
|
2010-11-14 08:13:04 -07:00
|
|
|
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden VISIBILITY_HIDDEN)
|
|
|
|
if(VISIBILITY_HIDDEN)
|
|
|
|
add_definitions(-fvisibility=hidden)
|
|
|
|
endif(VISIBILITY_HIDDEN)
|
2010-11-16 18:03:39 -07:00
|
|
|
endif()
|
2010-11-14 08:13:04 -07:00
|
|
|
|
2011-02-07 08:51:38 -07:00
|
|
|
if (APPLE)
|
2011-02-08 00:45:46 -07:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c")
|
|
|
|
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)
|
|
|
|
FIND_LIBRARY(OGL_LIBRARY OpenGL)
|
|
|
|
FIND_LIBRARY(WEBKIT_LIBRARY WebKit)
|
2011-02-10 19:38:23 -07:00
|
|
|
SET(EXTRA_LIBS ${ATB_LIBRARY} ${AU_LIBRARY} ${CARBON_LIBRARY}
|
|
|
|
${COCOA_LIBRARY} ${COREAUDIO_LIBRARY} ${COREFUND_LIBRARY}
|
|
|
|
${CORESERV_LIBRARY} ${IOB_LIBRARY} ${IOK_LIBRARY} ${OGL_LIBRARY}
|
|
|
|
${WEBKIT_LIBRARY})
|
2011-02-07 08:51:38 -07:00
|
|
|
endif()
|
2011-02-08 00:45:46 -07:00
|
|
|
|
2010-11-08 07:04:56 -07: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-04 22:19:22 -06:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2010-11-05 17:38:37 -06:00
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
|
2010-11-04 22:19:22 -06:00
|
|
|
"Build type (Release/Debug/RelWithDebInfo/MinSizeRe)" FORCE)
|
2010-11-05 17:38:37 -06:00
|
|
|
endif(NOT CMAKE_BUILD_TYPE)
|
2010-11-04 22:19:22 -06:00
|
|
|
|
2010-11-04 20:23:24 -06:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
add_definitions(-D_DEBUG -ggdb)
|
|
|
|
set(wxWidgets_USE_DEBUG ON CACHE BOOL "Use wxWidgets Debugging")
|
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Release)
|
|
|
|
add_definitions(-fomit-frame-pointer)
|
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL Release)
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2010-12-12 22:29:13 -07:00
|
|
|
option(FASTLOG "Enable all logs" OFF)
|
|
|
|
if(FASTLOG)
|
|
|
|
add_definitions(-DDEBUGFAST)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
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.
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
include(CheckLib)
|
|
|
|
|
2011-03-05 09:12:06 -07:00
|
|
|
include(FindOpenGL)
|
2010-11-08 17:29:07 -07:00
|
|
|
include_directories(${OPENGL_INCLUDE_DIR})
|
2010-12-17 15:13:58 -07:00
|
|
|
if(NOT OPENGL_GLU_FOUND)
|
|
|
|
message(FATAL_ERROR "GLU is required but not found")
|
|
|
|
endif()
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2011-03-05 09:12:06 -07:00
|
|
|
option(OPENMP "Enable OpenMP parallelization" ON)
|
|
|
|
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)
|
2011-03-05 14:58:54 -07:00
|
|
|
add_definitions(-Wno-unknown-pragmas)
|
2011-03-05 09:12:06 -07:00
|
|
|
message("OpenMP parallelization disabled")
|
2011-03-04 19:32:09 -07:00
|
|
|
endif()
|
|
|
|
|
2010-11-01 09:47:02 -06: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)
|
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
check_lib(AO ao QUIET)
|
2010-11-01 09:47:02 -06:00
|
|
|
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)
|
|
|
|
|
2011-01-03 15:08:03 -07:00
|
|
|
check_lib(BLUEZ bluez QUIET)
|
2010-11-01 09:47:02 -06:00
|
|
|
if(BLUEZ_FOUND)
|
|
|
|
add_definitions(-DHAVE_BLUEZ=1)
|
|
|
|
message("bluez found, enabling bluetooth support")
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_BLUEZ=0)
|
2010-11-07 19:51:31 -07:00
|
|
|
message("bluez NOT found, disabling bluetooth support")
|
2010-11-01 09:47:02 -06:00
|
|
|
endif(BLUEZ_FOUND)
|
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
check_lib(PULSEAUDIO libpulse QUIET)
|
2010-11-02 22:13:36 -06:00
|
|
|
if(PULSEAUDIO_FOUND)
|
|
|
|
add_definitions(-DHAVE_PULSEAUDIO=1)
|
|
|
|
message("PulseAudio found, enabling PulseAudio sound backend")
|
2010-11-01 09:47:02 -06:00
|
|
|
else()
|
2010-11-02 22:13:36 -06:00
|
|
|
add_definitions(-DHAVE_PULSEAUDIO=0)
|
|
|
|
message("PulseAudio NOT found, disabling PulseAudio sound backend")
|
|
|
|
endif(PULSEAUDIO_FOUND)
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2010-11-08 17:29:07 -07:00
|
|
|
include(FindOpenAL OPTIONAL)
|
2010-11-01 09:47:02 -06:00
|
|
|
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-08 17:29:07 -07:00
|
|
|
# Note: We do not need to explicitly check for X11 as it is done in the cmake
|
|
|
|
# FindOpenGL module on linux.
|
2010-12-04 08:19:04 -07:00
|
|
|
if(UNIX AND NOT APPLE)
|
2010-11-08 17:29:07 -07:00
|
|
|
if(X11_FOUND)
|
|
|
|
add_definitions(-DHAVE_X11=1)
|
|
|
|
include_directories(${X11_INCLUDE_DIR})
|
|
|
|
message("X11 found")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "X11 is required but not found")
|
|
|
|
endif(X11_FOUND)
|
2010-11-01 09:47:02 -06:00
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_X11=0)
|
2010-11-16 18:03:39 -07:00
|
|
|
endif()
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
check_lib(XRANDR Xrandr)
|
2010-11-03 20:01:07 -06:00
|
|
|
if(XRANDR_FOUND)
|
|
|
|
add_definitions(-DHAVE_XRANDR=1)
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_XRANDR=0)
|
|
|
|
endif(XRANDR_FOUND)
|
|
|
|
|
2010-11-18 09:46:17 -07:00
|
|
|
option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON)
|
2010-11-16 18:03:39 -07:00
|
|
|
if(ENCODE_FRAMEDUMPS)
|
2010-12-09 19:00:05 -07:00
|
|
|
check_libav()
|
2010-11-14 14:14:26 -07:00
|
|
|
endif()
|
|
|
|
|
2010-11-07 19:51:31 -07:00
|
|
|
include(CheckCXXSourceRuns)
|
|
|
|
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)
|
2010-11-05 21:49:18 -06:00
|
|
|
if(PORTAUDIO)
|
|
|
|
message("PortAudio found, enabling mic support")
|
|
|
|
add_definitions(-DHAVE_PORTAUDIO=1)
|
|
|
|
set(PORTAUDIO_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
message("PortAudio not found, disabling mic support")
|
|
|
|
add_definitions(-DHAVE_PORTAUDIO=0)
|
|
|
|
set(PORTAUDIO_FOUND FALSE)
|
2010-11-07 19:51:31 -07:00
|
|
|
endif(PORTAUDIO)
|
2010-11-05 21:49:18 -06:00
|
|
|
|
2011-01-07 22:27:18 -07:00
|
|
|
option(OPROFILING "Enable profiling" OFF)
|
|
|
|
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()
|
|
|
|
endif()
|
2010-11-01 09:47:02 -06:00
|
|
|
|
|
|
|
########################################
|
|
|
|
# Setup include directories (and make sure they are preferred over the Externals)
|
|
|
|
#
|
|
|
|
include_directories(Source/Core/AudioCommon/Src)
|
|
|
|
include_directories(Source/Core/Common/Src)
|
|
|
|
include_directories(Source/Core/Core/Src)
|
|
|
|
include_directories(Source/Core/DebuggerUICommon/Src)
|
|
|
|
include_directories(Source/Core/DebuggerWX/Src)
|
|
|
|
include_directories(Source/Core/DiscIO/Src)
|
|
|
|
include_directories(Source/Core/DolphinWX/Src)
|
|
|
|
include_directories(Source/Core/InputCommon/Src)
|
|
|
|
include_directories(Source/Core/VideoCommon/Src)
|
2010-11-15 17:13:33 -07:00
|
|
|
include_directories(Source/Core/VideoUICommon/Src)
|
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.
|
2010-12-30 19:10:07 -07:00
|
|
|
# Externals/CLRun/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)
|
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
check_lib(LZO lzo2 lzo/lzo1x.h QUIET)
|
2010-11-18 16:27:27 -07:00
|
|
|
if(LZO_FOUND)
|
2010-11-03 20:01:07 -06:00
|
|
|
message("Using shared lzo")
|
|
|
|
else()
|
|
|
|
message("Shared lzo not found, falling back to the static library")
|
|
|
|
add_subdirectory(Externals/LZO)
|
|
|
|
include_directories(Externals/LZO)
|
2010-11-18 16:27:27 -07:00
|
|
|
endif()
|
2010-11-01 09:47:02 -06:00
|
|
|
|
|
|
|
include(FindSDL OPTIONAL)
|
|
|
|
if(SDL_FOUND)
|
2010-11-03 20:01:07 -06:00
|
|
|
message("Using shared SDL")
|
2010-11-05 21:49:18 -06:00
|
|
|
include_directories(${SDL_INCLUDE_DIR})
|
2010-11-01 09:47:02 -06:00
|
|
|
else(SDL_FOUND)
|
2010-11-08 17:29:07 -07:00
|
|
|
# TODO: Use the prebuilt one on Windows
|
2010-11-03 20:01:07 -06:00
|
|
|
message("Shared SDL not found, falling back to the static library")
|
2010-12-04 08:19:04 -07:00
|
|
|
include_directories(Externals/SDL Externals/SDL/include)
|
2010-11-08 07:04:56 -07:00
|
|
|
add_subdirectory(Externals/SDL)
|
2010-11-01 09:47:02 -06:00
|
|
|
endif(SDL_FOUND)
|
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
check_lib(SFML sfml-network SFML/Network/Ftp.hpp QUIET)
|
2010-11-18 16:27:27 -07:00
|
|
|
if(SFML_FOUND)
|
2010-11-03 20:01:07 -06:00
|
|
|
message("Using shared sfml-network")
|
|
|
|
else()
|
|
|
|
message("Shared sfml-network not found, falling back to the static library")
|
|
|
|
add_subdirectory(Externals/SFML)
|
|
|
|
include_directories(Externals/SFML/include)
|
2010-11-18 16:27:27 -07:00
|
|
|
endif()
|
2010-11-03 20:01:07 -06:00
|
|
|
|
2010-12-09 19:00:05 -07:00
|
|
|
check_lib(SOIL SOIL SOIL/SOIL.h QUIET)
|
2010-11-18 16:27:27 -07:00
|
|
|
if(SOIL_FOUND)
|
2010-11-03 20:01:07 -06:00
|
|
|
message("Using shared SOIL")
|
|
|
|
else()
|
|
|
|
message("Shared SOIL not found, falling back to the static library")
|
|
|
|
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
|
|
|
|
2010-12-09 19:00:05 -07: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()
|
2010-11-01 09:47:02 -06:00
|
|
|
if(ZLIB_FOUND)
|
2010-12-09 19:00:05 -07:00
|
|
|
set(ZLIB_FOUND 1 CACHE INTERNAL "")
|
2010-11-08 07:04:56 -07:00
|
|
|
message("Using shared zlib")
|
2010-11-05 21:49:18 -06:00
|
|
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
2010-11-01 09:47:02 -06:00
|
|
|
else(ZLIB_FOUND)
|
2010-11-08 07:04:56 -07:00
|
|
|
message("Shared zlib not found, falling back to the static library")
|
2010-11-01 09:47:02 -06:00
|
|
|
add_subdirectory(Externals/zlib)
|
|
|
|
include_directories(Externals/zlib)
|
|
|
|
endif(ZLIB_FOUND)
|
|
|
|
|
2010-11-08 07:04:56 -07:00
|
|
|
if(WIN32)
|
|
|
|
find_library(GLEW glew32s PATHS Externals/GLew)
|
|
|
|
include_directories(Externals/GLew/include)
|
2010-11-11 22:05:27 -07:00
|
|
|
else()
|
2010-12-09 19:00:05 -07:00
|
|
|
check_lib(GLEW GLEW GL/glew.h)
|
|
|
|
if(NOT GLEW_FOUND)
|
|
|
|
message("Shared GLEW not found, falling back to the static library")
|
|
|
|
add_subdirectory(Externals/GLew)
|
|
|
|
include_directories(Externals/GLew/include)
|
|
|
|
endif(NOT GLEW_FOUND)
|
|
|
|
|
|
|
|
check_lib(CG Cg Cg/cg.h)
|
|
|
|
check_lib(CGGL CgGL Cg/cgGL.h)
|
|
|
|
endif()
|
2010-12-04 08:19:04 -07:00
|
|
|
|
2011-01-08 10:35:34 -07:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2010-11-08 07:04:56 -07:00
|
|
|
include_directories(Externals/CLRun/include)
|
|
|
|
add_subdirectory(Externals/CLRun)
|
2010-11-16 18:03:39 -07:00
|
|
|
endif()
|
2010-11-08 07:04:56 -07:00
|
|
|
|
2010-11-16 18:03:39 -07:00
|
|
|
option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)
|
2010-11-08 07:04:56 -07:00
|
|
|
if(NOT DISABLE_WX)
|
|
|
|
include(FindwxWidgets OPTIONAL)
|
2010-12-10 18:09:28 -07:00
|
|
|
FIND_PACKAGE(wxWidgets COMPONENTS core aui adv)
|
2010-11-08 07:04:56 -07:00
|
|
|
|
|
|
|
if(wxWidgets_FOUND)
|
|
|
|
include(${wxWidgets_USE_FILE})
|
|
|
|
|
2010-12-04 08:19:04 -07:00
|
|
|
if(UNIX AND NOT APPLE)
|
2011-01-10 19:18:34 -07:00
|
|
|
# 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
|
2011-05-19 08:26:03 -06:00
|
|
|
# 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)
|
2011-01-11 09:09:39 -07:00
|
|
|
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}
|
2011-05-19 08:26:03 -06:00
|
|
|
VERSION_EQUAL 2.8.2 OR "${DIST_NAME}" STREQUAL "natty")
|
2011-01-10 19:18:34 -07:00
|
|
|
check_lib(GTK2 gtk+-2.0 gtk.h REQUIRED)
|
|
|
|
else()
|
2011-03-05 09:12:06 -07:00
|
|
|
include(FindGTK2)
|
2011-01-10 19:18:34 -07:00
|
|
|
if(GTK2_FOUND)
|
|
|
|
include_directories(${GTK2_INCLUDE_DIRS})
|
|
|
|
endif()
|
2011-01-08 12:14:45 -07:00
|
|
|
endif()
|
2010-11-16 18:03:39 -07:00
|
|
|
endif()
|
2010-11-08 07:04:56 -07:00
|
|
|
|
|
|
|
message("wxWidgets found, enabling GUI build")
|
|
|
|
else(wxWidgets_FOUND)
|
2011-01-07 08:18:00 -07:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
message(FATAL_ERROR "wxWidgets not found. It is required to build the GUI")
|
|
|
|
endif()
|
2010-11-08 07:04:56 -07:00
|
|
|
message("Shared wxWidgets not found, falling back to the static library")
|
|
|
|
include_directories(Externals/wxWidgets/include)
|
|
|
|
add_subdirectory(Externals/wxWidgets)
|
|
|
|
endif(wxWidgets_FOUND)
|
2010-11-16 18:03:39 -07:00
|
|
|
add_definitions(-DHAVE_WX=1)
|
2010-11-08 07:04:56 -07:00
|
|
|
endif(NOT DISABLE_WX)
|
2010-11-01 09:47:02 -06:00
|
|
|
|
|
|
|
|
|
|
|
########################################
|
|
|
|
# Pre-build events: Define configuration variables and write svnrev header
|
|
|
|
#
|
2011-08-20 15:05:43 -06:00
|
|
|
file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/Src/svnrev.h
|
|
|
|
"#define SVN_REV_STR \"" ${DOLPHIN_WC_REVISION} "-" ${CMAKE_BUILD_TYPE} "\"\n")
|
2010-12-19 07:02:43 -07:00
|
|
|
include_directories("${PROJECT_BINARY_DIR}/Source/Core/Common/Src")
|
|
|
|
|
2010-11-01 09:47:02 -06:00
|
|
|
|
2011-01-09 09:36:19 -07:00
|
|
|
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
|
|
|
|
|
2011-07-17 19:47:55 -06:00
|
|
|
########################################
|
|
|
|
# Optional Targets
|
|
|
|
# TODO: Add DSPSpy and TestSuite.
|
|
|
|
option(DSPTOOL "Build dsptool" OFF)
|
|
|
|
option(UNITTESTS "Build unitests" OFF)
|
|
|
|
|
2010-11-01 09:47:02 -06:00
|
|
|
########################################
|
|
|
|
# Start compiling our code
|
|
|
|
#
|
|
|
|
add_subdirectory(Source)
|
|
|
|
|
|
|
|
|
|
|
|
########################################
|
2010-11-04 07:47:17 -06:00
|
|
|
# Install shared data files
|
2010-11-01 09:47:02 -06:00
|
|
|
#
|
2010-11-11 08:50:52 -07:00
|
|
|
install(DIRECTORY Data/User/ DESTINATION ${datadir}/user PATTERN .svn EXCLUDE)
|
|
|
|
install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN .svn EXCLUDE)
|
2011-01-04 21:35:46 -07:00
|
|
|
include(FindGettext)
|
2011-01-07 08:18:00 -07:00
|
|
|
if(GETTEXT_FOUND AND NOT DISABLE_WX)
|
2011-03-14 07:33:11 -06:00
|
|
|
file(GLOB LINGUAS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Languages/po/*.po)
|
2011-04-06 07:58:03 -06:00
|
|
|
GETTEXT_CREATE_TRANSLATIONS(Languages/po/dolphin-emu.pot ALL ${LINGUAS})
|
2011-01-04 21:35:46 -07:00
|
|
|
endif()
|
2011-01-08 10:35:34 -07:00
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2010-12-12 08:25:03 -07:00
|
|
|
install(FILES Data/license.txt DESTINATION ${datadir})
|
|
|
|
endif()
|
2010-11-01 09:47:02 -06:00
|
|
|
|
|
|
|
# packaging information
|
|
|
|
set(CPACK_PACKAGE_NAME "dolphin-emu")
|
|
|
|
set(CPACK_PACKAGE_VENDOR "Dolphin Team")
|
2011-06-24 09:28:43 -06:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "3")
|
2010-11-01 09:47:02 -06:00
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
|
|
|
|
|
|
|
if(DOLPHIN_IS_STABLE)
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
|
|
|
else()
|
2010-11-09 18:59:53 -07:00
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${DOLPHIN_WC_REVISION})
|
2010-11-01 09:47:02 -06:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# TODO: CPACK_PACKAGE_DESCRIPTION_FILE
|
|
|
|
# TODO: CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
|
|
|
# TODO: CPACK_RESOURCE_FILE_README
|
|
|
|
# TODO: CPACK_RESOURCE_FILE_WELCOME
|
|
|
|
# TODO: CPACK_PACKAGE_EXECUTABLES
|
|
|
|
# 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")
|
|
|
|
set(CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~;\\\\.swp;/\\\\.svn")
|
|
|
|
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.
|
|
|
|
include(CPack)
|