Used Mac Sdk from config to detect Mac version
This commit is contained in:
parent
5b4e46f8ea
commit
4f51d5fa50
|
@ -161,19 +161,19 @@ if (UNIX)
|
|||
endif()
|
||||
|
||||
if (APPLE)
|
||||
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
|
||||
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
||||
message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}")
|
||||
if (DARWIN_VERSION LESS 9)
|
||||
# 10.4: Universal (32-bit Intel and PowerPC)
|
||||
message(STATUS "OSX_TARGET_MAJOR=${OSX_TARGET_MAJOR}")
|
||||
message(STATUS "OSX_TARGET_MINOR=${OSX_TARGET_MINOR}")
|
||||
|
||||
if (NOT (OSX_TARGET_MAJOR EQUAL 10))
|
||||
message(FATAL_ERROR "Mac OS X target must be 10.x")
|
||||
endif ()
|
||||
|
||||
if (OSX_TARGET_MINOR LESS 6)
|
||||
# <= 10.5: 32-bit Intel and PowerPC
|
||||
set(CMAKE_OSX_ARCHITECTURES "ppc;i386"
|
||||
CACHE STRING "" FORCE)
|
||||
elseif (DARWIN_VERSION LESS 10)
|
||||
# 10.5: 32-bit Intel only
|
||||
set(CMAKE_OSX_ARCHITECTURES "i386"
|
||||
CACHE STRING "" FORCE)
|
||||
else()
|
||||
# 10.6+: Intel only
|
||||
# >= 10.6: Intel only
|
||||
set(CMAKE_OSX_ARCHITECTURES "i386;x86_64"
|
||||
CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
|
|
@ -451,9 +451,15 @@ class InternalCommands:
|
|||
cmake_args += ' -DCMAKE_BUILD_TYPE=' + target.capitalize()
|
||||
|
||||
elif sys.platform == "darwin":
|
||||
macSdkMatch = re.match("(\d+)\.(\d+)", self.macSdk)
|
||||
if not macSdkMatch:
|
||||
raise Exception("unknown osx version: " + self.macSdk)
|
||||
|
||||
sdkDir = self.getMacSdkDir()
|
||||
cmake_args += " -DCMAKE_OSX_SYSROOT=" + sdkDir
|
||||
cmake_args += " -DCMAKE_OSX_DEPLOYMENT_TARGET=" + self.macSdk
|
||||
cmake_args += " -DOSX_TARGET_MAJOR=" + macSdkMatch.group(1)
|
||||
cmake_args += " -DOSX_TARGET_MINOR=" + macSdkMatch.group(2)
|
||||
|
||||
# if not visual studio, use parent dir
|
||||
sourceDir = generator.getSourceDir()
|
||||
|
|
Loading…
Reference in New Issue