Merge pull request #1819 from Tilka/cmake

CMake: simplify some expressions
This commit is contained in:
Markus Wick 2015-01-06 09:27:59 +01:00
commit d8d4c94e07
13 changed files with 42 additions and 46 deletions

View File

@ -21,7 +21,7 @@ option(FASTLOG "Enable all logs" OFF)
option(OPROFILING "Enable profiling" OFF) option(OPROFILING "Enable profiling" OFF)
option(GDBSTUB "Enable gdb stub for remote debugging." OFF) option(GDBSTUB "Enable gdb stub for remote debugging." OFF)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF) option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF)
endif() endif()
######################################## ########################################
@ -52,7 +52,7 @@ set(DOLPHIN_IS_STABLE FALSE)
set(LIBS) set(LIBS)
# Set up paths # Set up paths
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) if(APPLE)
# The gettext module will install the translations unconditionally. # The gettext module will install the translations unconditionally.
# Redirect the installation to a build directory where it does no harm. # Redirect the installation to a build directory where it does no harm.
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install-dummy) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install-dummy)
@ -145,7 +145,7 @@ endif()
if(NOT ENABLE_GENERIC) if(NOT ENABLE_GENERIC)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
${CMAKE_SYSTEM_NAME} MATCHES "Darwin") APPLE)
if(_ARCH_64) if(_ARCH_64)
set(_M_X86 1) set(_M_X86 1)
set(_M_X86_64 1) set(_M_X86_64 1)
@ -159,7 +159,7 @@ if(NOT ENABLE_GENERIC)
set(_M_ARM_32 1) set(_M_ARM_32 1)
add_definitions(-D_M_ARM=1 -D_M_ARM_32=1) add_definitions(-D_M_ARM=1 -D_M_ARM_32=1)
add_definitions(-marm -march=armv7-a) add_definitions(-marm -march=armv7-a)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
# This option only applies to 64bit ARM # This option only applies to 64bit ARM
set(_M_ARM 1) set(_M_ARM 1)
set(_M_ARM_64 1) set(_M_ARM_64 1)
@ -531,7 +531,7 @@ else(ZLIB_FOUND)
include_directories(Externals/zlib) include_directories(Externals/zlib)
endif(ZLIB_FOUND) endif(ZLIB_FOUND)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) if(NOT APPLE AND NOT ANDROID)
check_lib(LZO lzo2 lzo/lzo1x.h QUIET) check_lib(LZO lzo2 lzo/lzo1x.h QUIET)
endif() endif()
if(LZO_FOUND) if(LZO_FOUND)
@ -544,7 +544,7 @@ else()
endif() endif()
list(APPEND LIBS ${LZO}) list(APPEND LIBS ${LZO})
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) if(NOT APPLE AND NOT ANDROID)
check_lib(PNG png png.h QUIET) check_lib(PNG png png.h QUIET)
endif() endif()
if (PNG_FOUND) if (PNG_FOUND)
@ -557,7 +557,7 @@ else()
endif() endif()
if(OPENAL_FOUND) if(OPENAL_FOUND)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(NOT APPLE)
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h QUIET) check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h QUIET)
endif() endif()
if (SOUNDTOUCH_FOUND) if (SOUNDTOUCH_FOUND)
@ -570,7 +570,7 @@ if(OPENAL_FOUND)
endif() endif()
if(NOT ANDROID) if(NOT ANDROID)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(NOT APPLE)
include(FindSDL2 OPTIONAL) include(FindSDL2 OPTIONAL)
endif() endif()
if(SDL2_FOUND) if(SDL2_FOUND)
@ -579,7 +579,7 @@ if(NOT ANDROID)
include_directories(${SDL2_INCLUDE_DIR}) include_directories(${SDL2_INCLUDE_DIR})
else(SDL2_FOUND) else(SDL2_FOUND)
# SDL2 not found, try SDL # SDL2 not found, try SDL
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(NOT APPLE)
include(FindSDL OPTIONAL) include(FindSDL OPTIONAL)
endif() endif()
if(SDL_FOUND) if(SDL_FOUND)
@ -601,7 +601,7 @@ if(LIBUSB_FOUND)
endif(LIBUSB_FOUND) endif(LIBUSB_FOUND)
set(SFML_REQD_VERSION 2.1) set(SFML_REQD_VERSION 2.1)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) if(NOT APPLE AND NOT ANDROID)
find_package(SFML ${SFML_REQD_VERSION} COMPONENTS network system) find_package(SFML ${SFML_REQD_VERSION} COMPONENTS network system)
endif() endif()
if(SFML_FOUND) if(SFML_FOUND)
@ -614,7 +614,7 @@ else()
endif() endif()
if(USE_UPNP) if(USE_UPNP)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) if(NOT APPLE AND NOT ANDROID)
include(FindMiniupnpc) include(FindMiniupnpc)
endif() endif()
if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER) if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
@ -629,7 +629,7 @@ if(USE_UPNP)
list(APPEND LIBS miniupnpc) list(APPEND LIBS miniupnpc)
endif() endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) if(NOT APPLE AND NOT ANDROID)
include(FindPolarSSL) include(FindPolarSSL)
endif() endif()
if(POLARSSL_FOUND AND POLARSSL_WORKS) if(POLARSSL_FOUND AND POLARSSL_WORKS)
@ -642,7 +642,7 @@ else()
include_directories(Externals/polarssl/include) include_directories(Externals/polarssl/include)
endif() endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID) if(NOT APPLE AND NOT ANDROID)
check_lib(SOIL SOIL SOIL/SOIL.h QUIET) check_lib(SOIL SOIL SOIL/SOIL.h QUIET)
endif() endif()
if(SOIL_FOUND) if(SOIL_FOUND)
@ -724,15 +724,15 @@ if(NOT DISABLE_WX AND NOT ANDROID)
# These definitions and includes are used when building dolphin against wx, # These definitions and includes are used when building dolphin against wx,
# not when building wx itself (see wxw3 CMakeLists.txt for that) # not when building wx itself (see wxw3 CMakeLists.txt for that)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
add_definitions(-D__WXOSX_COCOA__) add_definitions(-D__WXOSX_COCOA__)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_definitions(-D__WXGTK__) add_definitions(-D__WXGTK__)
# Check for required libs # Check for required libs
check_lib(GTHREAD2 gthread-2.0 glib/gthread.h REQUIRED) check_lib(GTHREAD2 gthread-2.0 glib/gthread.h REQUIRED)
check_lib(PANGOCAIRO pangocairo pango/pangocairo.h REQUIRED) check_lib(PANGOCAIRO pangocairo pango/pangocairo.h REQUIRED)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") elseif(WIN32)
add_definitions(-D__WXMSW__) add_definitions(-D__WXMSW__)
else() else()
message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform") message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform")
@ -748,12 +748,11 @@ if(NOT DISABLE_WX AND NOT ANDROID)
add_definitions(-DHAVE_WX=1) add_definitions(-DHAVE_WX=1)
endif(NOT DISABLE_WX AND NOT ANDROID) endif(NOT DISABLE_WX AND NOT ANDROID)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD")
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(LIBS ${LIBS} usbhid) set(LIBS ${LIBS} usbhid)
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
# Link against OS X system frameworks. # Link against OS X system frameworks.
list(APPEND LIBS list(APPEND LIBS
${APPKIT_LIBRARY} ${APPKIT_LIBRARY}
@ -809,13 +808,13 @@ add_subdirectory(Source)
######################################## ########################################
# Install shared data files # Install shared data files
# #
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) if(NOT APPLE)
install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN) install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN)
endif() endif()
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")
install(FILES Data/license.txt DESTINATION ${datadir}) install(FILES Data/license.txt DESTINATION ${datadir})
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# Install the application icon and menu item # Install the application icon and menu item
install(FILES Installer/dolphin-emu.xpm install(FILES Installer/dolphin-emu.xpm
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps) DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps)

View File

@ -14,7 +14,7 @@ elseif(WIN32)
set(LDLIBS ${WINSOCK2_LIBRARY} ${IPHLPAPI_LIBRARY} ${LDLIBS}) set(LDLIBS ${WINSOCK2_LIBRARY} ${IPHLPAPI_LIBRARY} ${LDLIBS})
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(APPLE)
add_definitions(-DMACOSX -D_DARWIN_C_SOURCE) add_definitions(-DMACOSX -D_DARWIN_C_SOURCE)
endif() endif()

View File

@ -861,7 +861,7 @@ set(SRCS
${SRCS_COMMON} ${SRCS_COMMON}
${SRCS_GENERIC}) ${SRCS_GENERIC})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
add_definitions(-D__WXOSX_COCOA__) add_definitions(-D__WXOSX_COCOA__)
set(SRCS set(SRCS
@ -882,7 +882,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
${IOK_LIBRARY} ${IOK_LIBRARY}
${OPENGL_LIBRARY} ${OPENGL_LIBRARY}
${QUICKTIME_LIBRARY}) ${QUICKTIME_LIBRARY})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
add_definitions(-D__WXGTK__) add_definitions(-D__WXGTK__)
set(SRCS set(SRCS

View File

@ -33,9 +33,7 @@ endif(PULSEAUDIO_FOUND)
if(WIN32) if(WIN32)
set(SRCS ${SRCS} XAudio2Stream.cpp) set(SRCS ${SRCS} XAudio2Stream.cpp)
endif(WIN32) elseif(APPLE)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SRCS ${SRCS} CoreAudioSoundStream.cpp) set(SRCS ${SRCS} CoreAudioSoundStream.cpp)
endif() endif()

View File

@ -61,7 +61,7 @@ if(WIN32)
endif(WIN32) endif(WIN32)
set(LIBS "${CMAKE_THREAD_LIBS_INIT}") set(LIBS "${CMAKE_THREAD_LIBS_INIT}")
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND (NOT ANDROID)) if(NOT APPLE AND NOT ANDROID)
set(LIBS ${LIBS} rt) set(LIBS ${LIBS} rt)
endif() endif()

View File

@ -256,13 +256,13 @@ set(LIBS ${LIBS} ${POLARSSL_LIBRARY})
if(WIN32) if(WIN32)
set(SRCS ${SRCS} HW/BBA-TAP/TAP_Win32.cpp HW/WiimoteReal/IOWin.cpp) set(SRCS ${SRCS} HW/BBA-TAP/TAP_Win32.cpp HW/WiimoteReal/IOWin.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif(APPLE)
set(SRCS ${SRCS} HW/BBA-TAP/TAP_Apple.cpp HW/WiimoteReal/IOdarwin.mm) set(SRCS ${SRCS} HW/BBA-TAP/TAP_Apple.cpp HW/WiimoteReal/IOdarwin.mm)
set(LIBS ${LIBS} set(LIBS ${LIBS}
${IOB_LIBRARY}) ${IOB_LIBRARY})
elseif(UNIX) elseif(UNIX)
set(SRCS ${SRCS} HW/BBA-TAP/TAP_Unix.cpp) set(SRCS ${SRCS} HW/BBA-TAP/TAP_Unix.cpp)
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND BLUEZ_FOUND) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND BLUEZ_FOUND)
set(SRCS ${SRCS} HW/WiimoteReal/IONix.cpp) set(SRCS ${SRCS} HW/WiimoteReal/IONix.cpp)
set(LIBS ${LIBS} bluetooth) set(LIBS ${LIBS} bluetooth)
else() else()

View File

@ -31,7 +31,7 @@ set(UIS
list(APPEND LIBS core uicommon) list(APPEND LIBS core uicommon)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
set(DOLPHINQT_BINARY DolphinQt) set(DOLPHINQT_BINARY DolphinQt)
else() else()
set(DOLPHINQT_BINARY dolphin-emu-qt) set(DOLPHINQT_BINARY dolphin-emu-qt)
@ -42,7 +42,7 @@ add_executable(${DOLPHINQT_BINARY} ${SRCS} ${UI_HEADERS})
target_link_libraries(${DOLPHINQT_BINARY} ${LIBS}) target_link_libraries(${DOLPHINQT_BINARY} ${LIBS})
qt5_use_modules(${DOLPHINQT_BINARY} Widgets) qt5_use_modules(${DOLPHINQT_BINARY} Widgets)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
# Note: This is based on the DolphinWX version. # Note: This is based on the DolphinWX version.
include(BundleUtilities) include(BundleUtilities)

View File

@ -66,7 +66,7 @@ endif()
set(ANDROID_SRCS Android/ButtonManager.cpp set(ANDROID_SRCS Android/ButtonManager.cpp
MainAndroid.cpp) MainAndroid.cpp)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
if(wxWidgets_FOUND) if(wxWidgets_FOUND)
list(APPEND WXLIBS list(APPEND WXLIBS
${APPSERV_LIBRARY} ${APPSERV_LIBRARY}
@ -80,7 +80,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
MACOSX_PACKAGE_LOCATION Resources) MACOSX_PACKAGE_LOCATION Resources)
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
set(DOLPHIN_EXE_BASE Dolphin) set(DOLPHIN_EXE_BASE Dolphin)
else() else()
set(DOLPHIN_EXE_BASE dolphin-emu) set(DOLPHIN_EXE_BASE dolphin-emu)
@ -123,7 +123,7 @@ if(ANDROID)
elseif(wxWidgets_FOUND) elseif(wxWidgets_FOUND)
add_executable(${DOLPHIN_EXE} ${SRCS} ${GUI_SRCS}) add_executable(${DOLPHIN_EXE} ${SRCS} ${GUI_SRCS})
target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS}) target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
include(BundleUtilities) include(BundleUtilities)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app)

View File

@ -14,10 +14,10 @@ if(WIN32)
ControllerInterface/DInput/DInputKeyboardMouse.cpp ControllerInterface/DInput/DInputKeyboardMouse.cpp
ControllerInterface/XInput/XInput.cpp ControllerInterface/XInput/XInput.cpp
ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp) ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif(APPLE)
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) find_library(COREFOUNDATION_LIBRARY CoreFoundation)
FIND_LIBRARY(CARBON_LIBRARY Carbon) find_library(CARBON_LIBRARY Carbon)
FIND_LIBRARY(COCOA_LIBRARY Cocoa) find_library(COCOA_LIBRARY Cocoa)
set(SRCS ${SRCS} set(SRCS ${SRCS}
ControllerInterface/OSX/OSX.mm ControllerInterface/OSX/OSX.mm
ControllerInterface/OSX/OSXKeyboard.mm ControllerInterface/OSX/OSXKeyboard.mm

View File

@ -26,7 +26,7 @@ endif()
if(WIN32) if(WIN32)
set(SRCS ${SRCS} GLInterface/WGL.cpp) set(SRCS ${SRCS} GLInterface/WGL.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif(APPLE)
set(SRCS ${SRCS} GLInterface/AGL.cpp) set(SRCS ${SRCS} GLInterface/AGL.cpp)
elseif(USE_X11) elseif(USE_X11)
if (NOT USE_EGL) if (NOT USE_EGL)
@ -51,8 +51,7 @@ if(USE_EGL)
set(LIBS ${LIBS} EGL) set(LIBS ${LIBS} EGL)
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD")
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set(LIBS ${LIBS} usbhid) set(LIBS ${LIBS} usbhid)
endif() endif()

View File

@ -59,7 +59,7 @@ endif()
add_dolphin_library(videocommon "${SRCS}" "${LIBS}") add_dolphin_library(videocommon "${SRCS}" "${LIBS}")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(LIBAV_FOUND) if(LIBAV_FOUND)
target_link_libraries(videocommon ${LIBS} ${LIBAV_LIBRARIES}) target_link_libraries(videocommon ${LIBS} ${LIBAV_LIBRARIES})
endif() endif()

View File

@ -1,5 +1,5 @@
add_executable(dsptool DSPTool.cpp) add_executable(dsptool DSPTool.cpp)
target_link_libraries(dsptool core) target_link_libraries(dsptool core)
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) if(NOT APPLE)
install(TARGETS dsptool RUNTIME DESTINATION ${bindir}) install(TARGETS dsptool RUNTIME DESTINATION ${bindir})
endif() endif()

View File

@ -1,5 +1,5 @@
set(LIBS core gtest) set(LIBS core gtest)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(APPLE)
list(APPEND LIBS ${FOUNDATION_LIBRARY} ${CORESERV_LIBRARY}) list(APPEND LIBS ${FOUNDATION_LIBRARY} ${CORESERV_LIBRARY})
endif() endif()
macro(add_dolphin_test target srcs) macro(add_dolphin_test target srcs)