CMake: simplify some expressions

This commit is contained in:
Tillmann Karras 2015-01-03 13:17:57 +01:00
parent c3d52e0476
commit 6bcdb10eee
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(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)
endif()
########################################
@ -52,7 +52,7 @@ set(DOLPHIN_IS_STABLE FALSE)
set(LIBS)
# Set up paths
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
if(APPLE)
# 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)
@ -145,7 +145,7 @@ endif()
if(NOT ENABLE_GENERIC)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
APPLE)
if(_ARCH_64)
set(_M_X86 1)
set(_M_X86_64 1)
@ -159,7 +159,7 @@ if(NOT ENABLE_GENERIC)
set(_M_ARM_32 1)
add_definitions(-D_M_ARM=1 -D_M_ARM_32=1)
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
set(_M_ARM 1)
set(_M_ARM_64 1)
@ -531,7 +531,7 @@ else(ZLIB_FOUND)
include_directories(Externals/zlib)
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)
endif()
if(LZO_FOUND)
@ -544,7 +544,7 @@ else()
endif()
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)
endif()
if (PNG_FOUND)
@ -557,7 +557,7 @@ else()
endif()
if(OPENAL_FOUND)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(NOT APPLE)
check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h QUIET)
endif()
if (SOUNDTOUCH_FOUND)
@ -570,7 +570,7 @@ if(OPENAL_FOUND)
endif()
if(NOT ANDROID)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(NOT APPLE)
include(FindSDL2 OPTIONAL)
endif()
if(SDL2_FOUND)
@ -579,7 +579,7 @@ if(NOT ANDROID)
include_directories(${SDL2_INCLUDE_DIR})
else(SDL2_FOUND)
# SDL2 not found, try SDL
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(NOT APPLE)
include(FindSDL OPTIONAL)
endif()
if(SDL_FOUND)
@ -601,7 +601,7 @@ if(LIBUSB_FOUND)
endif(LIBUSB_FOUND)
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)
endif()
if(SFML_FOUND)
@ -614,7 +614,7 @@ else()
endif()
if(USE_UPNP)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
if(NOT APPLE AND NOT ANDROID)
include(FindMiniupnpc)
endif()
if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
@ -629,7 +629,7 @@ if(USE_UPNP)
list(APPEND LIBS miniupnpc)
endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
if(NOT APPLE AND NOT ANDROID)
include(FindPolarSSL)
endif()
if(POLARSSL_FOUND AND POLARSSL_WORKS)
@ -642,7 +642,7 @@ else()
include_directories(Externals/polarssl/include)
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)
endif()
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,
# not when building wx itself (see wxw3 CMakeLists.txt for that)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(APPLE)
add_definitions(-D__WXOSX_COCOA__)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_definitions(-D__WXGTK__)
# Check for required libs
check_lib(GTHREAD2 gthread-2.0 glib/gthread.h REQUIRED)
check_lib(PANGOCAIRO pangocairo pango/pangocairo.h REQUIRED)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
elseif(WIN32)
add_definitions(-D__WXMSW__)
else()
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)
endif(NOT DISABLE_WX AND NOT ANDROID)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD")
set(LIBS ${LIBS} usbhid)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(APPLE)
# Link against OS X system frameworks.
list(APPEND LIBS
${APPKIT_LIBRARY}
@ -809,13 +808,13 @@ add_subdirectory(Source)
########################################
# Install shared data files
#
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
if(NOT APPLE)
install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN)
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})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# Install the application icon and menu item
install(FILES Installer/dolphin-emu.xpm
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps)

View File

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

View File

@ -861,7 +861,7 @@ set(SRCS
${SRCS_COMMON}
${SRCS_GENERIC})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
add_definitions(-D__WXOSX_COCOA__)
set(SRCS
@ -882,7 +882,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
${IOK_LIBRARY}
${OPENGL_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")
add_definitions(-D__WXGTK__)
set(SRCS

View File

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

View File

@ -61,7 +61,7 @@ if(WIN32)
endif(WIN32)
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)
endif()

View File

@ -256,13 +256,13 @@ set(LIBS ${LIBS} ${POLARSSL_LIBRARY})
if(WIN32)
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(LIBS ${LIBS}
${IOB_LIBRARY})
elseif(UNIX)
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(LIBS ${LIBS} bluetooth)
else()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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