From c45595d64831990311f92fcebc4e34e2797f5352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 27 Feb 2013 15:01:25 +0100 Subject: Use tools from the SDK's toolchain instead of the ones in /usr/bin For Mac OS X we currently specify build tools without an absolute path, which means we end up using the ones in /usr/bin. This is wrong, we should be using the tools from the toolchain of the chosen SDK. For iOS we do specify an absolute path, by resolving the toolchain path in the iOS makespecs. To solve the situation on Mac OS X, we move the logic of resolving the toolchain path to sdk.prf, and share it between OSX and iOS. For configure we need to duplicate some of the logic from sdk.prf, as configure pulls out QMAKE_CC and QMAKE_CXX for running some initial tests and building qmake. The new macSDKify function also solves the issue of missing sysroot and deployment version in the flags. Change-Id: Ib1d239c9904cf3ccee5214b313cf6205869a1462 Reviewed-by: Oswald Buddenhagen --- mkspecs/common/ios/qmake.conf | 18 +++++------------- mkspecs/features/mac/sdk.prf | 9 +++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'mkspecs') diff --git a/mkspecs/common/ios/qmake.conf b/mkspecs/common/ios/qmake.conf index 5164c48e12..39465aa765 100644 --- a/mkspecs/common/ios/qmake.conf +++ b/mkspecs/common/ios/qmake.conf @@ -1,28 +1,20 @@ # # Common build settings for all iOS configurations # -# Depends on: -# -# QMAKE_XCODE_DEVELOPER_PATH - set in mkspecs/common/xcode.conf QT_QPA_DEFAULT_PLATFORM = ios -QMAKE_XCODE_TOOLCHAIN_BIN_PATH = $$QMAKE_XCODE_DEVELOPER_PATH/Toolchains/XcodeDefault.xctoolchain/usr/bin - QMAKE_XCODE_CODE_SIGN_IDENTITY = "iPhone Developer" # iOS build tools -QMAKE_CC = $$QMAKE_XCODE_TOOLCHAIN_BIN_PATH/clang -QMAKE_CXX = $$QMAKE_XCODE_TOOLCHAIN_BIN_PATH/clang++ -QMAKE_FIX_RPATH = $$QMAKE_XCODE_TOOLCHAIN_BIN_PATH/install_name_tool -id -QMAKE_AR = $$QMAKE_XCODE_TOOLCHAIN_BIN_PATH/ar cq -QMAKE_RANLIB = $$QMAKE_XCODE_TOOLCHAIN_BIN_PATH/ranlib -s +QMAKE_CC = clang +QMAKE_CXX = clang++ +QMAKE_FIX_RPATH = install_name_tool -id +QMAKE_AR = ar cq +QMAKE_RANLIB = ranlib -s QMAKE_LINK = $$QMAKE_CXX QMAKE_LINK_SHLIB = $$QMAKE_CXX -# Check that compiler is valid -!exists($$QMAKE_CXX): error("The version of Xcode installed on this system does not include the clang compiler") - # Basic iOS frameworks needed for any GUI app QMAKE_LFLAGS += -framework Foundation -framework UIKit -framework QuartzCore -lz diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 260d8ec97a..eaa3108a8b 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -19,6 +19,15 @@ sysrootified = for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val 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)) { + value = $$eval($$tool) + isEmpty(value): next() + + sysrooted = $$system("xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value)") + $$tool = $$sysrooted $$member(value, 1, -1) +} + # 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 '/^