From a5848991db270ffdd9f2fa05220475bb3194d12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20P=C3=A4ssler?= Date: Fri, 3 Apr 2020 21:07:58 +0200 Subject: [PATCH 01/10] qtbase-mkspecs-mac --- mkspecs/common/mac.conf | 2 +- mkspecs/features/mac/default_post.prf | 206 -------------------------- mkspecs/features/mac/default_pre.prf | 58 -------- mkspecs/features/mac/sdk.mk | 25 ---- mkspecs/features/mac/sdk.prf | 61 -------- 5 files changed, 1 insertion(+), 351 deletions(-) delete mode 100644 mkspecs/features/mac/sdk.mk delete mode 100644 mkspecs/features/mac/sdk.prf diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index 61bea952b2..9909dae726 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL = \ QMAKE_FIX_RPATH = install_name_tool -id -QMAKE_LFLAGS_RPATH = -Wl,-rpath, +QMAKE_LFLAGS_RPATH = QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip QMAKE_LFLAGS_REL_RPATH = diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index ba163efc18..b80ec1e801 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -68,212 +68,6 @@ qt { } } -# Add the same default rpaths as Xcode does for new projects. -# This is especially important for iOS/tvOS/watchOS where no other option is possible. -!no_default_rpath { - uikit: QMAKE_RPATHDIR += @executable_path/Frameworks - else: QMAKE_RPATHDIR += @executable_path/../Frameworks - equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks -} - -# Don't pass -headerpad_max_install_names when using Bitcode. -# In that case the linker emits a warning stating that the flag is ignored when -# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962). -# Using this flag is also unnecessary in practice on UIKit platforms since they -# are sandboxed, and only UIKit platforms support bitcode to begin with. -!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD - -app_extension_api_only { - QMAKE_CFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION - QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION -} - -macx-xcode { - qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO - !isEmpty(QMAKE_PKGINFO_TYPEINFO): \ - qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO - else: \ - qmake_pkginfo_typeinfo.value = "????" - QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo - - bundle_version = $$VERSION - isEmpty(bundle_version): bundle_version = 1.0.0 - - l = $$split(bundle_version, '.') 0 0 # make sure there are at least three - VER_MAJ = $$member(l, 0, 0) - VER_MIN = $$member(l, 1, 1) - VER_PAT = $$member(l, 2, 2) - unset(l) - - qmake_full_version.name = QMAKE_FULL_VERSION - qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT} - QMAKE_MAC_XCODE_SETTINGS += qmake_full_version - - qmake_short_version.name = QMAKE_SHORT_VERSION - qmake_short_version.value = $${VER_MAJ}.$${VER_MIN} - QMAKE_MAC_XCODE_SETTINGS += qmake_short_version - - !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) { - debug_information_format.name = DEBUG_INFORMATION_FORMAT - debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT - debug_information_format.build = debug - QMAKE_MAC_XCODE_SETTINGS += debug_information_format - } - - QMAKE_XCODE_ARCHS = - - arch_device.name = "ARCHS[sdk=$${device.sdk}*]" - arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS - QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS - QMAKE_MAC_XCODE_SETTINGS += arch_device - - simulator { - arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]" - arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS - QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS - QMAKE_MAC_XCODE_SETTINGS += arch_simulator - } - - only_active_arch.name = ONLY_ACTIVE_ARCH - only_active_arch.value = YES - only_active_arch.build = debug - QMAKE_MAC_XCODE_SETTINGS += only_active_arch -} else { - device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS - simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS - VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS - - isEmpty(VALID_ARCHS): \ - error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture") - - single_arch: VALID_ARCHS = $$first(VALID_ARCHS) - - ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS)) - ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch)) - - QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS - - arch_flags = $(EXPORT_ARCH_ARGS) - - QMAKE_CFLAGS += $$arch_flags - QMAKE_CXXFLAGS += $$arch_flags - QMAKE_LFLAGS += $$arch_flags - - QMAKE_PCH_ARCHS = $$VALID_ARCHS - - macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET - ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET - tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET - watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET - - # If we're doing a simulator and device build, device and simulator - # architectures use different paths and flags for the sysroot and - # deployment target switch, so we must multiplex them across multiple - # architectures using -Xarch. Otherwise we fall back to the simple path. - # This is not strictly necessary, but results in cleaner command lines - # and makes it easier for people to override EXPORT_VALID_ARCHS to limit - # individual rules to a different set of architecture(s) from the overall - # build (such as machtest in QtCore). - simulator:device { - QMAKE_XARCH_CFLAGS = - QMAKE_XARCH_LFLAGS = - QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS - - for (arch, VALID_ARCHS) { - contains(VALID_SIMULATOR_ARCHS, $$arch) { - sdk = $$simulator.sdk - version_identifier = $$simulator.deployment_identifier - } else { - sdk = $$device.sdk - version_identifier = $$device.deployment_identifier - } - - version_min_flags = \ - -Xarch_$${arch} \ - -m$${version_identifier}-version-min=$$deployment_target - QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \ - -Xarch_$${arch} \ - -isysroot$$xcodeSDKInfo(Path, $$sdk) - QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \ - -Xarch_$${arch} \ - -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk) - - QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch}) - QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch}) - - QMAKE_EXTRA_VARIABLES += \ - QMAKE_XARCH_CFLAGS_$${arch} \ - QMAKE_XARCH_LFLAGS_$${arch} - } - - QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS) - QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS) - QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS) - } else { - simulator { - version_identifier = $$simulator.deployment_identifier - sysroot_path = $$xcodeSDKInfo(Path, $$simulator.sdk) - } else { - version_identifier = $$device.deployment_identifier - sysroot_path = $$xcodeSDKInfo(Path, $$device.sdk) - } - version_min_flag = -m$${version_identifier}-version-min=$$deployment_target - QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag - QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag - QMAKE_LFLAGS += -Wl,-syslibroot,$$sysroot_path $$version_min_flag - } - - # Enable precompiled headers for multiple architectures - QMAKE_CFLAGS_USE_PRECOMPILE = - for (arch, VALID_ARCHS) { - icc_pch_style: \ - use_flag = "-pch-use " - else: \ - use_flag = -include - - # Only use Xarch with multi-arch, as the option confuses ccache - count(VALID_ARCHS, 1, greaterThan): \ - QMAKE_CFLAGS_USE_PRECOMPILE += \ - -Xarch_$${arch} - - QMAKE_CFLAGS_USE_PRECOMPILE += \ - $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}} - } - icc_pch_style { - QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT} - QMAKE_CFLAGS_USE_PRECOMPILE = - } else { - QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - } - - QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT} -} - -!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) { - # Explicit SDK version has been set, respect that - QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version -} - -cache(QMAKE_XCODE_DEVELOPER_PATH, stash) -!isEmpty(QMAKE_XCODE_VERSION): \ - cache(QMAKE_XCODE_VERSION, stash) - -QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() - -xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER -xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX -isEmpty(xcode_product_bundle_identifier_setting.value): \ - xcode_product_bundle_identifier_setting.value = "com.yourcompany" -xcode_product_bundle_target = $$QMAKE_BUNDLE -isEmpty(xcode_product_bundle_target): \ - xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier} -xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}" -QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting - !macx-xcode { generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS generate_xcode_project.target = xcodeproj diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index e3534561a5..3b01424e67 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -1,60 +1,2 @@ CONFIG = asset_catalogs 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.") -} - -isEmpty(QMAKE_XCODEBUILD_PATH): \ - QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null") - -!isEmpty(QMAKE_XCODEBUILD_PATH) { - # Make sure Xcode is set up properly - !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \ - error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.") - - isEmpty(QMAKE_XCODE_VERSION) { - # Extract Xcode version using xcodebuild - xcode_version = $$system("/usr/bin/xcrun xcodebuild -version") - QMAKE_XCODE_VERSION = $$member(xcode_version, 1) - isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") - unset(xcode_version) - } -} - -isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) { - QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist - exists($$QMAKE_XCODE_PREFERENCES_FILE): \ - QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null") - - !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \ - cache(QMAKE_TARGET_BUNDLE_PREFIX) -} - -QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon - -# Make the default debug info format for static debug builds -# DWARF instead of DWARF with dSYM. This cuts down build times -# for application debug builds significantly, as Xcode doesn't -# have to pull out all the DWARF info from the Qt static libs -# and put it into a dSYM file. We don't need that dSYM file in -# the first place, since the information is available in the -# object files inside the archives (static libraries). -macx-xcode:qtConfig(static): \ - QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf - -# This variable is used by the xcode_dynamic_library_suffix -# feature, which allows Xcode to choose the Qt libraries to link to -# at build time, depending on the current Xcode SDK and configuration. -QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX - -xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP -xcode_copy_phase_strip_setting.value = NO -QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk --- a/mkspecs/features/mac/sdk.mk +++ b/mkspecs/features/mac/sdk.mk @@ -1,25 +0,0 @@ - -ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),) - CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>&1 - CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND)) - ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION)) - # We don't want to complain about out of date SDK unless the target needs to be remade. - # This covers use-cases such as running 'make check' after moving the build to a - # computer without Xcode or with a different Xcode version. - TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0) - ifeq ($(TARGET_UP_TO_DATE),0) - ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),) - $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.) - else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),) - $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.) - else ifneq ($(CURRENT_MAC_SDK_VERSION),) - $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).) - else - $(info Unknown error resolving current platform SDK version.) - endif - $(info This requires a fresh build. Please wipe the build directory completely,) - $(info including any .qmake.stash and .qmake.cache files generated by qmake.) - $(error ^) - endif - endif -endif diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf deleted file mode 100644 index 3a9c2778bb..0000000000 --- a/mkspecs/features/mac/sdk.prf +++ /dev/null @@ -1,61 +0,0 @@ - -isEmpty(QMAKE_MAC_SDK): \ - error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.") - -contains(QMAKE_MAC_SDK, .*/.*): \ - error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)") - -defineReplace(xcodeSDKInfo) { - info = $$1 - equals(info, "Path"): \ - infoarg = --show-sdk-path - equals(info, "PlatformPath"): \ - infoarg = --show-sdk-platform-path - equals(info, "SDKVersion"): \ - infoarg = --show-sdk-version - sdk = $$2 - isEmpty(sdk): \ - sdk = $$QMAKE_MAC_SDK - - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) { - QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null") - # --show-sdk-platform-path won't work for Command Line Tools; this is fine - # only used by the XCTest backend to testlib - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \ - error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg") - cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info}) - } - - return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info})) -} - -QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path) -QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath) -QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion) - -isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) { - QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL - sysrootified = - for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val - QMAKE_INCDIR_OPENGL = $$sysrootified -} - -QMAKESPEC_NAME = $$basename(QMAKESPEC) - -# 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 QMAKE_ACTOOL QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) { - tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool} - !isEmpty($$tool_variable) { - $$tool = $$eval($$tool_variable) - next() - } - - value = $$eval($$tool) - isEmpty(value): next() - - sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null") - isEmpty(sysrooted): next() - - $$tool = $$sysrooted $$member(value, 1, -1) - cache($$tool_variable, set stash, $$tool) -} -- 2.25.1