From 951eb9a801fee97855ab5865134f5098bf09ec0a Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 23 Jan 2017 23:44:15 -0800 Subject: [PATCH 1/6] CMake: use CMAKE_OSX_ARCHITECTURES --- CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fd09dbe8b..dfe0f6cfbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,9 @@ # General setup # cmake_minimum_required(VERSION 3.5.0) -project(dolphin-emu) +set(CMAKE_OSX_ARCHITECTURES "x86_64") +project(dolphin-emu) option(USE_EGL "Enables EGL OpenGL Interface" OFF) option(TRY_X11 "Enables X11 Support" ON) option(USE_SHARED_ENET "Use shared libenet if found rather than Dolphin's soon-to-compatibly-diverge version" OFF) @@ -305,15 +306,12 @@ if(APPLE) set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr") endif() - # Identify the target system: - # Ask for 64-bit binary. - set(TARGET_FLAGS "-arch x86_64") # 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(OSX_MIN_VERSION "10.9") - set(TARGET_FLAGS "${TARGET_FLAGS} -mmacosx-version-min=${OSX_MIN_VERSION}") + set(TARGET_FLAGS "-mmacosx-version-min=${OSX_MIN_VERSION}") # 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") From 0ab3b1a3ff33c548ce9080e95ac8c339237bd0d8 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 23 Jan 2017 23:45:54 -0800 Subject: [PATCH 2/6] CMake: use CMAKE_OSX_DEPLOYMENT_TARGET --- CMakeLists.txt | 11 +++++------ Source/Core/DolphinQt2/Info.plist.in | 4 ++-- Source/Core/DolphinWX/Info.plist.in | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfe0f6cfbf..583267c7d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,11 @@ # cmake_minimum_required(VERSION 3.5.0) set(CMAKE_OSX_ARCHITECTURES "x86_64") +# 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 "") project(dolphin-emu) option(USE_EGL "Enables EGL OpenGL Interface" OFF) @@ -306,12 +311,6 @@ if(APPLE) set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr") endif() - # 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(OSX_MIN_VERSION "10.9") - set(TARGET_FLAGS "-mmacosx-version-min=${OSX_MIN_VERSION}") # 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") diff --git a/Source/Core/DolphinQt2/Info.plist.in b/Source/Core/DolphinQt2/Info.plist.in index 0e6c6b5c50..a68a24dab1 100644 --- a/Source/Core/DolphinQt2/Info.plist.in +++ b/Source/Core/DolphinQt2/Info.plist.in @@ -75,10 +75,10 @@ NSHumanReadableCopyright Licensed under GPL version 2 or later (GPLv2+) LSMinimumSystemVersion - ${OSX_MIN_VERSION} + ${CMAKE_OSX_DEPLOYMENT_TARGET} NSHighResolutionCapable CSResourcesFileMapped - \ No newline at end of file + diff --git a/Source/Core/DolphinWX/Info.plist.in b/Source/Core/DolphinWX/Info.plist.in index f5564f088a..9210389da6 100644 --- a/Source/Core/DolphinWX/Info.plist.in +++ b/Source/Core/DolphinWX/Info.plist.in @@ -75,7 +75,7 @@ NSHumanReadableCopyright Licensed under GPL version 2 LSMinimumSystemVersion - ${OSX_MIN_VERSION} + ${CMAKE_OSX_DEPLOYMENT_TARGET} LSRequiresCarbon NSHighResolutionCapable From 4cbd07b81f1cbe2b3419f721cc3bce66cd9798aa Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 23 Jan 2017 23:58:33 -0800 Subject: [PATCH 3/6] CMake: remove unneeded macOS frameworks --- CMakeLists.txt | 30 +++++++------------ Externals/wxWidgets3/CMakeLists.txt | 3 +- .../wxWidgets3/include/wx/osx/cocoa/chkconf.h | 2 +- Externals/wxWidgets3/wx/wxcocoa.h | 2 +- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 583267c7d0..a9cc850481 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,9 +311,6 @@ if(APPLE) set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};/usr") endif() - # 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") # Specify target CPUs. set(TARGET_FLAGS "${TARGET_FLAGS} -mssse3") set(TARGET_FLAGS "${TARGET_FLAGS} -march=core2") @@ -332,7 +329,6 @@ if(APPLE) 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) @@ -342,10 +338,19 @@ if(APPLE) find_library(FOUNDATION_LIBRARY Foundation) find_library(IOB_LIBRARY IOBluetooth) find_library(IOK_LIBRARY IOKit) - find_library(QUICKTIME_LIBRARY QuickTime) - find_library(WEBKIT_LIBRARY WebKit) find_library(FORCEFEEDBACK ForceFeedback) find_library(OPENGL_LIBRARY OpenGL) + + # Link against OS X system frameworks. + list(APPEND LIBS + ${APPKIT_LIBRARY} + ${AU_LIBRARY} + ${COREAUDIO_LIBRARY} + ${COREFUND_LIBRARY} + ${CORESERV_LIBRARY} + ${IOK_LIBRARY} + ${FORCEFEEDBACK} + ) endif() if(WIN32) @@ -1010,19 +1015,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD") set(LIBS ${LIBS} usbhid) endif() -if(APPLE) - # Link against OS X system frameworks. - list(APPEND LIBS - ${APPKIT_LIBRARY} - ${AU_LIBRARY} - ${COREAUDIO_LIBRARY} - ${COREFUND_LIBRARY} - ${CORESERV_LIBRARY} - ${IOK_LIBRARY} - ${FORCEFEEDBACK} - ) -endif() - ######################################## # Pre-build events: Define configuration variables and write SCM info header # diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 1f09e3318e..5ec5080cdc 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -837,14 +837,13 @@ if(APPLE) iconv ${APPKIT_LIBRARY} ${APPSERV_LIBRARY} - ${ATB_LIBRARY} ${CARBON_LIBRARY} ${COCOA_LIBRARY} ${COREFUND_LIBRARY} ${CORESERV_LIBRARY} ${IOK_LIBRARY} ${OPENGL_LIBRARY} - ${QUICKTIME_LIBRARY}) + ) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h b/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h index 4cb5623b49..8d8818e5d0 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h @@ -48,7 +48,7 @@ */ #define wxOSX_USE_QUICKTIME 0 -#define wxOSX_USE_AUDIOTOOLBOX 1 +#define wxOSX_USE_AUDIOTOOLBOX 0 /* Use the more efficient FSEvents API instead of kqueue diff --git a/Externals/wxWidgets3/wx/wxcocoa.h b/Externals/wxWidgets3/wx/wxcocoa.h index 24e0ba0398..53be5f174c 100644 --- a/Externals/wxWidgets3/wx/wxcocoa.h +++ b/Externals/wxWidgets3/wx/wxcocoa.h @@ -875,7 +875,7 @@ /* * wxWebKitCtrl */ -#define wxUSE_WEBKIT 1 +#define wxUSE_WEBKIT 0 /* * Objective-C class name uniquifying From 7ebb1b4d3dea5cbc54134a0123111ac2faf5bd0e Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Tue, 24 Jan 2017 00:09:32 -0800 Subject: [PATCH 4/6] CMake: find_package(Threads) on macOS too --- CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9cc850481..6aa16aada4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,12 +380,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD") endif() # Dolphin requires threads. -# The Apple build may not need an explicit flag because one of the -# frameworks may already provide it. -# But for non-OSX systems, we will use the CMake Threads package. -IF(NOT APPLE) - FIND_PACKAGE(Threads) -ENDIF(NOT APPLE) +find_package(Threads) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING From b65b87c8b4c377b0041008e5576f84c7b44bf585 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Tue, 24 Jan 2017 00:44:37 -0800 Subject: [PATCH 5/6] CMake: don't need to force Clang on macOS It's already the default! --- CMakeLists.txt | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6aa16aada4..e2ace7a4fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,22 +73,7 @@ endif() # TODO: Add DSPSpy option(DSPTOOL "Build dsptool" OFF) -# Update compiler before calling project() if (APPLE) - # Use clang compiler - 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() - if (NOT DEFINED CMAKE_C_COMPILER) - 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() - endif() - # This doesn't play with with the packaging script that doesn't understand @rpath set(CMAKE_MACOSX_RPATH OFF) endif() From c85127c973e3f8457e79bb2450c1e69c38f3e187 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Tue, 24 Jan 2017 00:45:57 -0800 Subject: [PATCH 6/6] CMake: move CMAKE_MACOSX_RPATH with rest of macOS logic --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2ace7a4fb..862f847962 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,10 +73,6 @@ endif() # TODO: Add DSPSpy option(DSPTOOL "Build dsptool" OFF) -if (APPLE) - # This doesn't play with with the packaging script that doesn't understand @rpath - set(CMAKE_MACOSX_RPATH OFF) -endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests) # Libraries to link set(LIBS) @@ -284,6 +280,9 @@ if(ENABLE_LTO) endif() if(APPLE) + # This doesn't play well with the packaging script that doesn't understand @rpath + set(CMAKE_MACOSX_RPATH OFF) + 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