Clean up how we build against SDKs on Mac OS
Instead of setting -isysroot in both arch.test, compile.test, the various
mkspecs, and sdk.prf, we now propgate the chosen SDK as the qmake
variable QMAKE_MAC_SDK, which is then handled exclusivly in sdk.prf.
The QMAKE_MAC_SDK variable, and -sdk argument to configure, is expected
to be of the short-form name, eg macosx or iphoneos, not a full path, as
that's what Xcode also expects. We take care of translating that into
a full path for -isysroot/-syslibroot in sdk.prf, using xcodebuild as
a helper.
Change-Id: I281655b2fa5180c6e78ffdce36824e4a91447570
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-02-15 17:11:04 +00:00
|
|
|
|
2013-03-01 12:28:03 +00:00
|
|
|
isEmpty(QMAKE_MAC_SDK): \
|
|
|
|
error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
|
Clean up how we build against SDKs on Mac OS
Instead of setting -isysroot in both arch.test, compile.test, the various
mkspecs, and sdk.prf, we now propgate the chosen SDK as the qmake
variable QMAKE_MAC_SDK, which is then handled exclusivly in sdk.prf.
The QMAKE_MAC_SDK variable, and -sdk argument to configure, is expected
to be of the short-form name, eg macosx or iphoneos, not a full path, as
that's what Xcode also expects. We take care of translating that into
a full path for -isysroot/-syslibroot in sdk.prf, using xcodebuild as
a helper.
Change-Id: I281655b2fa5180c6e78ffdce36824e4a91447570
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-02-15 17:11:04 +00:00
|
|
|
|
2013-03-01 12:28:03 +00:00
|
|
|
contains(QMAKE_MAC_SDK, .*/.*): \
|
|
|
|
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
|
Clean up how we build against SDKs on Mac OS
Instead of setting -isysroot in both arch.test, compile.test, the various
mkspecs, and sdk.prf, we now propgate the chosen SDK as the qmake
variable QMAKE_MAC_SDK, which is then handled exclusivly in sdk.prf.
The QMAKE_MAC_SDK variable, and -sdk argument to configure, is expected
to be of the short-form name, eg macosx or iphoneos, not a full path, as
that's what Xcode also expects. We take care of translating that into
a full path for -isysroot/-syslibroot in sdk.prf, using xcodebuild as
a helper.
Change-Id: I281655b2fa5180c6e78ffdce36824e4a91447570
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-02-15 17:11:04 +00:00
|
|
|
|
2013-05-08 10:21:05 +00:00
|
|
|
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) {
|
|
|
|
QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
|
|
|
|
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
|
2013-10-31 19:27:54 +00:00
|
|
|
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set stash, QMAKE_MAC_SDK_PATH)
|
2014-12-01 11:59:16 +00:00
|
|
|
} else {
|
|
|
|
QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)
|
|
|
|
}
|
|
|
|
|
2015-02-13 14:17:47 +00:00
|
|
|
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_path) {
|
|
|
|
QMAKE_MAC_SDK_PLATFORM_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version PlatformPath 2>/dev/null")
|
|
|
|
isEmpty(QMAKE_MAC_SDK_PLATFORM_PATH): error("Could not resolve SDK platform path for \'$$QMAKE_MAC_SDK\'")
|
|
|
|
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_path, set stash, QMAKE_MAC_SDK_PLATFORM_PATH)
|
|
|
|
} else {
|
|
|
|
QMAKE_MAC_SDK_PLATFORM_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_path)
|
|
|
|
}
|
|
|
|
|
2014-12-01 11:59:16 +00:00
|
|
|
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.version) {
|
2014-11-08 18:30:56 +00:00
|
|
|
QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version SDKVersion 2>/dev/null")
|
|
|
|
isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$$QMAKE_MAC_SDK\'")
|
|
|
|
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.version, set stash, QMAKE_MAC_SDK_VERSION)
|
2013-05-08 10:21:05 +00:00
|
|
|
} else {
|
2014-11-08 18:30:56 +00:00
|
|
|
QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.version)
|
2013-05-08 10:21:05 +00:00
|
|
|
}
|
Clean up how we build against SDKs on Mac OS
Instead of setting -isysroot in both arch.test, compile.test, the various
mkspecs, and sdk.prf, we now propgate the chosen SDK as the qmake
variable QMAKE_MAC_SDK, which is then handled exclusivly in sdk.prf.
The QMAKE_MAC_SDK variable, and -sdk argument to configure, is expected
to be of the short-form name, eg macosx or iphoneos, not a full path, as
that's what Xcode also expects. We take care of translating that into
a full path for -isysroot/-syslibroot in sdk.prf, using xcodebuild as
a helper.
Change-Id: I281655b2fa5180c6e78ffdce36824e4a91447570
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-02-15 17:11:04 +00:00
|
|
|
|
2013-03-01 12:28:03 +00:00
|
|
|
!equals(MAKEFILE_GENERATOR, XCODE) {
|
|
|
|
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
|
|
|
|
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
|
|
|
|
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH
|
|
|
|
}
|
2013-02-15 16:27:51 +00:00
|
|
|
|
2013-03-01 12:28:03 +00:00
|
|
|
sysrootified =
|
|
|
|
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
|
|
|
|
QMAKE_INCDIR_OPENGL = $$sysrootified
|
2013-02-15 16:27:51 +00:00
|
|
|
|
2013-06-13 12:18:10 +00:00
|
|
|
QMAKESPEC_NAME = $$basename(QMAKESPEC)
|
|
|
|
|
2013-02-27 14:01:25 +00:00
|
|
|
# Resolve SDK version of various tools
|
|
|
|
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB)) {
|
2013-06-13 12:18:10 +00:00
|
|
|
tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
|
|
|
|
!isEmpty($$tool_variable) {
|
|
|
|
$$tool = $$eval($$tool_variable)
|
2013-05-08 10:21:05 +00:00
|
|
|
next()
|
|
|
|
}
|
|
|
|
|
2013-02-27 14:01:25 +00:00
|
|
|
value = $$eval($$tool)
|
|
|
|
isEmpty(value): next()
|
|
|
|
|
2013-04-08 14:34:33 +00:00
|
|
|
sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
|
2013-04-08 10:17:27 +00:00
|
|
|
isEmpty(sysrooted): next()
|
|
|
|
|
2013-02-27 14:01:25 +00:00
|
|
|
$$tool = $$sysrooted $$member(value, 1, -1)
|
2013-10-31 19:27:54 +00:00
|
|
|
cache($$tool_variable, set stash, $$tool)
|
2013-02-27 14:01:25 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 10:21:05 +00:00
|
|
|
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
|
2014-04-01 13:05:20 +00:00
|
|
|
QMAKE_MAC_PLATFORM_NAME = $$system("/usr/libexec/PlistBuddy -c 'print DefaultProperties:PLATFORM_NAME' $$QMAKE_MAC_SDK_PATH/SDKSettings.plist 2>/dev/null")
|
2013-05-08 10:21:05 +00:00
|
|
|
isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'")
|
2013-10-31 19:27:54 +00:00
|
|
|
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set stash, QMAKE_MAC_PLATFORM_NAME)
|
2013-05-08 10:21:05 +00:00
|
|
|
} else {
|
|
|
|
QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name)
|
|
|
|
}
|
2013-02-15 16:27:51 +00:00
|
|
|
|
|
|
|
!equals(MAKEFILE_GENERATOR, XCODE) {
|
2012-11-20 14:25:34 +00:00
|
|
|
# FIXME: Get the version_min_flag out of the platform's 'Native Build System.xcspec'
|
|
|
|
version_identifier = $$replace(QMAKE_MAC_PLATFORM_NAME, iphonesimulator, ios-simulator)
|
|
|
|
|
|
|
|
ios:!host_build: \
|
|
|
|
deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
|
|
|
|
else: \
|
|
|
|
deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
|
|
|
|
|
|
|
|
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
|
2013-02-15 16:27:51 +00:00
|
|
|
QMAKE_CFLAGS += $$version_min_flag
|
|
|
|
QMAKE_CXXFLAGS += $$version_min_flag
|
|
|
|
QMAKE_LFLAGS += $$version_min_flag
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|