qt5base-lts/mkspecs/features/mac/sdk.prf
Tor Arne Vestbø 71b4325cb7 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-19 07:56:34 +01:00

25 lines
947 B
Plaintext

!host_build:!isEmpty(QMAKE_MAC_SDK) {
contains(QMAKE_MAC_SDK, .*/.*): \
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
QMAKE_MAC_SDK_INFO = $$system("xcodebuild -sdk $$QMAKE_MAC_SDK -version 2>/dev/null", lines)
isEmpty(QMAKE_MAC_SDK_INFO): error("Could not resolve SDK \'$$QMAKE_MAC_SDK\'")
defineReplace(qtMacSDKInfo): \
return($$replace($$list($$find(QMAKE_MAC_SDK_INFO, ^$$1:)), ^$$1:(.*), \\1))
QMAKE_MAC_SDK_PATH = $$qtMacSDKInfo(Path)
!equals(MAKEFILE_GENERATOR, XCODE) {
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
QMAKE_OBJECTIVE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH
}
sysrootified =
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
QMAKE_INCDIR_OPENGL = $$sysrootified
}