From 93c6284696db9ca88b663b0d11cf07871f6475a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 1 Mar 2013 13:28:03 +0100 Subject: [PATCH] Make host_build re-use the sdk.prf logic Instead of hard-coding the SDK and deployment target. A host build will already use the host-makespec, so now that we always build against an SDK, these mkspecs will have the SDK and deployment target set. Change-Id: I2b0343ae75f7de12081bab8346307b96b3883f62 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- mkspecs/features/mac/sdk.prf | 56 +++++++++++++++++------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 16dd16159c..287cfdecdb 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -1,41 +1,37 @@ -!host_build:!isEmpty(QMAKE_MAC_SDK) { - contains(QMAKE_MAC_SDK, .*/.*): \ - error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)") +isEmpty(QMAKE_MAC_SDK): \ + error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.") - 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\'") +contains(QMAKE_MAC_SDK, .*/.*): \ + error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)") - defineReplace(qtMacSDKInfo): \ - return($$replace($$list($$find(QMAKE_MAC_SDK_INFO, ^$$1:)), ^$$1:(.*), \\1)) +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\'") - QMAKE_MAC_SDK_PATH = $$qtMacSDKInfo(Path) +defineReplace(qtMacSDKInfo): \ + return($$replace($$list($$find(QMAKE_MAC_SDK_INFO, ^$$1:)), ^$$1:(.*), \\1)) - !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 - } +QMAKE_MAC_SDK_PATH = $$qtMacSDKInfo(Path) - sysrootified = - for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val - QMAKE_INCDIR_OPENGL = $$sysrootified - - # We use xml as the output format instead of json since plutil on 10.6 does not have that option - QMAKE_MAC_PLATFORM_NAME = $$system("plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - | " \ - "sed '/^&1 | " \ - "sed 's/.*Value: \\(.*\\)/\\1/'") - - isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'") - -} else { - # Host tools require Mac OS X >= 10.6 - QMAKE_MAC_PLATFORM_NAME = macosx - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +!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 + +# We use xml as the output format instead of json since plutil on 10.6 does not have that option +QMAKE_MAC_PLATFORM_NAME = $$system("plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - | " \ + "sed '/^&1 | " \ + "sed 's/.*Value: \\(.*\\)/\\1/'") + +isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'") + !equals(MAKEFILE_GENERATOR, XCODE) { # 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)