diff options
Diffstat (limited to 'build_files/cmake/platform/platform_apple_xcode.cmake')
-rw-r--r-- | build_files/cmake/platform/platform_apple_xcode.cmake | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/build_files/cmake/platform/platform_apple_xcode.cmake b/build_files/cmake/platform/platform_apple_xcode.cmake index f1f02c151ee..3a43ca317dd 100644 --- a/build_files/cmake/platform/platform_apple_xcode.cmake +++ b/build_files/cmake/platform/platform_apple_xcode.cmake @@ -21,8 +21,10 @@ # Xcode and system configuration for Apple. if(NOT CMAKE_OSX_ARCHITECTURES) - set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING - "Choose the architecture you want to build Blender for: i386, x86_64 or ppc" + execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "Detected native architecture ${ARCHITECTURE}.") + set(CMAKE_OSX_ARCHITECTURES ${ARCHITECTURE} CACHE STRING + "Choose the architecture you want to build Blender for: arm64 or x86_64" FORCE) endif() @@ -65,13 +67,9 @@ endif() message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}") -# Older Xcode versions had different approach to the directory hiearchy. -# Require newer Xcode which is also have better chances of being able to compile with the -# required deployment target. -# -# NOTE: Xcode version 8.2 is the latest one which runs on macOS 10.11. -if(${XCODE_VERSION} VERSION_LESS 8.2) - message(FATAL_ERROR "Only Xcode version 8.2 and newer is supported") +# Require a relatively recent Xcode version. +if(${XCODE_VERSION} VERSION_LESS 10.0) + message(FATAL_ERROR "Only Xcode version 10.0 and newer is supported") endif() # note: xcode-select path could be ambiguous, @@ -133,14 +131,21 @@ if(${CMAKE_GENERATOR} MATCHES "Xcode") endif() unset(OSX_SDKROOT) -# 10.11 is our min. target, if you use higher sdk, weak linking happens + +# 10.13 is our min. target, if you use higher sdk, weak linking happens +if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64") + set(OSX_MIN_DEPLOYMENT_TARGET 11.00) +else() + set(OSX_MIN_DEPLOYMENT_TARGET 10.13) +endif() + if(CMAKE_OSX_DEPLOYMENT_TARGET) - if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.11) - message(STATUS "Setting deployment target to 10.11, lower versions are not supported") - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE) + if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS ${OSX_MIN_DEPLOYMENT_TARGET}) + message(STATUS "Setting deployment target to ${OSX_MIN_DEPLOYMENT_TARGET}, lower versions are not supported") + set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE) endif() else() - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE) + set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE) endif() if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode") |