diff --git a/mkspecs/common/ios/clang.conf b/mkspecs/common/ios/clang.conf index 5da7e5a23362390bb9ee99ba8b02d22c482b0f8b..8da555e6fa28630ae4747d3bf6fe48b4e936544c 100644 --- a/mkspecs/common/ios/clang.conf +++ b/mkspecs/common/ios/clang.conf @@ -1,10 +1,6 @@ # # compiler settings for iOS clang compilers # -# Depends on: -# -# QMAKE_XCODE_VERSION - set in xcode.conf -# # iOS build flags QMAKE_IOS_CFLAGS += -fvisibility=hidden -fpascal-strings -fmessage-length=0 @@ -24,9 +20,6 @@ QMAKE_IOS_CFLAGS += -Wno-missing-field-initializers -Wno-missing-prototype QMAKE_IOS_CXXFLAGS += -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors QMAKE_IOS_OBJ_CFLAGS += -Wno-deprecated-implementations -Wprotocol -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -# Warn about unsupported (later than 4.5) Xcode versions -!lessThan(QMAKE_XCODE_VERSION, "4.7"): warning("The version of Xcode installed on this system is not recognised - custom compiler settings may be necessary") - # Set build flags QMAKE_CFLAGS += $$QMAKE_IOS_CFLAGS QMAKE_CXXFLAGS += $$QMAKE_IOS_CFLAGS $$QMAKE_IOS_CXXFLAGS diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index f31db3bb4b67a7a60039c31699e479f01a91c256..cf54f3f58012504e03264aab28b413372e818221 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -26,7 +26,4 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cq QMAKE_RANLIB = ranlib -s -# We rely on Xcode to build -include(xcode.conf) - include(unix.conf) diff --git a/mkspecs/common/xcode.conf b/mkspecs/common/xcode.conf deleted file mode 100644 index b15266b6789a166d699516b1fd3646c3df18b0f4..0000000000000000000000000000000000000000 --- a/mkspecs/common/xcode.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# qmake configuration for Xcode -# - -# Get path of Xcode's Developer directory -QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null") -isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \ - error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.") - -# Make sure Xcode path is valid -!exists($$QMAKE_XCODE_DEVELOPER_PATH): \ - error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.") - -# Make sure Xcode is set up properly -isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \ - error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.") - -# Extract Xcode version using xcodebuild -xcode_version = $$system("/usr/bin/xcodebuild -version") -QMAKE_XCODE_VERSION = $$member(xcode_version, 1) -unset(xcode_version) diff --git a/mkspecs/features/ios/default_pre.prf b/mkspecs/features/ios/default_pre.prf index e2956bd77d4b7d19f8cb16b31b66d4151eb0fc76..fa0245aa2c352ba46f34001fb7455756458a68d0 100644 --- a/mkspecs/features/ios/default_pre.prf +++ b/mkspecs/features/ios/default_pre.prf @@ -2,3 +2,9 @@ unset(MAKEFILE_GENERATOR) load(default_pre) + +# Check for supported Xcode versions +lessThan(QMAKE_XCODE_VERSION, "4.3"): \ + error("This mkspec requires Xcode 4.3 or later") +!lessThan(QMAKE_XCODE_VERSION, "4.7"): \ + warning("The version of Xcode installed on this system is not recognized - custom compiler settings may be necessary") diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 437e3d93e4a2553d9bb8f81a2bb90dcab62458b0..0538a81771cc258c1e7dbe9a3736029001b4fa33 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -16,6 +16,14 @@ qt:!isEmpty(QT_CONFIG) { } } +isEmpty(_QMAKE_CACHE_) { + warning("No .qmake.cache is present. This significantly slows down qmake with this makespec.") + warning("Call 'cache()' in the top-level project file to rectify this problem.") +} else { + cache(QMAKE_XCODE_DEVELOPER_PATH) + cache(QMAKE_XCODE_VERSION) +} + # Ensure that we process sdk.prf first, as it will update QMAKE_CXX # and friends that other features/extra compilers may depend on. sdk: load(sdk) diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index 81e1d061f852660e7138745fcaae59e64c8f9979..e535c4d9e9dcd81d9d19ce48587972ebb8263de1 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -1,3 +1,25 @@ CONFIG = sdk rez $$CONFIG load(default_pre) +isEmpty(QMAKE_XCODE_DEVELOPER_PATH) { + # Get path of Xcode's Developer directory + QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null") + isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \ + error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.") + + # Make sure Xcode path is valid + !exists($$QMAKE_XCODE_DEVELOPER_PATH): \ + error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.") + + # Make sure Xcode is set up properly + isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))): \ + error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.") +} + +isEmpty(QMAKE_XCODE_VERSION) { + # Extract Xcode version using xcodebuild + xcode_version = $$system("/usr/bin/xcodebuild -version") + QMAKE_XCODE_VERSION = $$member(xcode_version, 1) + isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") + unset(xcode_version) +} diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index f5b1639a5da18f35fd5c608c10264a440c8edfe7..0da0b65d41a42c9c38b22796c1616dd17a865686 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -5,8 +5,13 @@ 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_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\'") +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\'") + !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set, QMAKE_MAC_SDK_PATH) +} else { + QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) +} !equals(MAKEFILE_GENERATOR, XCODE) { QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH @@ -21,6 +26,11 @@ QMAKE_INCDIR_OPENGL = $$sysrootified # 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)) { + !isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}) { + $$tool = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}) + next() + } + value = $$eval($$tool) isEmpty(value): next() @@ -28,15 +38,21 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_ isEmpty(sysrooted): next() $$tool = $$sysrooted $$member(value, 1, -1) + !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}, set, $$tool) } -# 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("/usr/bin/plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - 2>/dev/null | " \ - "sed '/^<!DOCTYPE/d' | " \ # Don't look up http://www.apple.com/DTDs/PropertyList-1.0.dtd - "PERL5LIB= xpath 'string(//key[.=\"PLATFORM_NAME\"]/following-sibling::*[1])' 2>/dev/null | " \ - "sed 's/.*Value: \\(.*\\)/\\1/'") +isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) { + # 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("/usr/bin/plutil -convert xml1 \"$$QMAKE_MAC_SDK_PATH/SDKSettings.plist\" -o - 2>/dev/null | " \ + "sed '/^<!DOCTYPE/d' | " \ # Don't look up http://www.apple.com/DTDs/PropertyList-1.0.dtd + "PERL5LIB= xpath 'string(//key[.=\"PLATFORM_NAME\"]/following-sibling::*[1])' 2>/dev/null | " \ + "sed 's/.*Value: \\(.*\\)/\\1/'") -isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'") + isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'") + !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set, QMAKE_MAC_PLATFORM_NAME) +} else { + QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) +} !equals(MAKEFILE_GENERATOR, XCODE) { # FIXME: Get the version_min_flag out of the platform's 'Native Build System.xcspec' diff --git a/mkspecs/unsupported/macx-ios-clang/qmake.conf b/mkspecs/unsupported/macx-ios-clang/qmake.conf index 833e22e3bd3004ff5673941334aa25340cdb1a4f..3dc2715a5f7ef7d3a506f0b611bc8d0ffafcc655 100644 --- a/mkspecs/unsupported/macx-ios-clang/qmake.conf +++ b/mkspecs/unsupported/macx-ios-clang/qmake.conf @@ -22,6 +22,4 @@ include(../../common/clang-mac.conf) include(../../common/ios/clang.conf) include(../../common/ios/qmake.conf) -lessThan(QMAKE_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later") - load(qt_config)