summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-05-08 12:21:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-08 14:07:41 +0200
commit1308aa25fbf45995eac075688165e42d9e1c90f5 (patch)
tree305f432e77adc393f1bf8b2e42ccea96ddfd4606 /mkspecs/features
parent032befa819cfb335876a08ca7aa5acab6d7a2f17 (diff)
Cache Xcode and SDK settings in .qmake.cache if it exists
The Xcode and SDK settings are expensive to resolve, as we're using system() calls to resolve them. We now try to detect the presence of a .qmake.cache file (and inform the user that creating one would be a good idea), and use the file to cache the various settings after resolving them. The Xcode logic had to be moved form xcode.conf as part of the mkspec, into default_pre/post.prf, so that we could cache() the resolved values. Task-number: QTBUG-30586 Change-Id: Ib5368cfee6f7e4a4a33f6be70d0e20d96896fe56 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/ios/default_pre.prf6
-rw-r--r--mkspecs/features/mac/default_post.prf8
-rw-r--r--mkspecs/features/mac/default_pre.prf22
-rw-r--r--mkspecs/features/mac/sdk.prf32
4 files changed, 60 insertions, 8 deletions
diff --git a/mkspecs/features/ios/default_pre.prf b/mkspecs/features/ios/default_pre.prf
index e2956bd77d..fa0245aa2c 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 437e3d93e4..0538a81771 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 81e1d061f8..e535c4d9e9 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 f5b1639a5d..0da0b65d41 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'