2011-04-27 10:05:43 +00:00
|
|
|
load(default_post)
|
2016-09-21 03:18:45 +00:00
|
|
|
|
2019-07-31 13:42:46 +00:00
|
|
|
# Recompute SDK version in case the user set it explicitly
|
|
|
|
sdk_version = $$QMAKE_MAC_SDK_VERSION
|
|
|
|
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
|
|
|
|
|
2018-08-31 10:33:08 +00:00
|
|
|
contains(TEMPLATE, .*app) {
|
2018-12-10 22:37:54 +00:00
|
|
|
!macx-xcode:if(isEmpty(BUILDS)|build_pass) {
|
2018-08-31 10:33:08 +00:00
|
|
|
# Detect changes to the platform SDK
|
2018-10-19 12:35:40 +00:00
|
|
|
QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION QMAKE_XCODE_DEVELOPER_PATH
|
2018-08-31 10:33:08 +00:00
|
|
|
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk)
|
|
|
|
}
|
|
|
|
|
|
|
|
# Detect incompatible SDK versions
|
|
|
|
|
2018-10-19 12:16:04 +00:00
|
|
|
isEmpty(QT_MAC_SDK_VERSION_MIN): \
|
|
|
|
QT_MAC_SDK_VERSION_MIN = $$QT_MAC_SDK_VERSION
|
|
|
|
|
|
|
|
!versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_MIN): \
|
|
|
|
warning("Qt requires at least version $$QT_MAC_SDK_VERSION_MIN of the platform SDK," \
|
2019-07-31 13:42:46 +00:00
|
|
|
"you're building against version $${QMAKE_MAC_SDK_VERSION}. Please upgrade.")
|
2018-08-31 10:33:08 +00:00
|
|
|
|
2018-10-19 12:16:04 +00:00
|
|
|
!isEmpty(QT_MAC_SDK_VERSION_MAX) {
|
2018-08-31 10:33:08 +00:00
|
|
|
# For Qt developers only
|
|
|
|
!isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
|
|
|
|
CONFIG += sdk_no_version_check
|
|
|
|
|
2018-10-19 17:01:37 +00:00
|
|
|
QMAKE_MAC_SDK_MAJOR_MINOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\\d+)(\\.\\d+)(\\.\\d+)?", \\1\\2)
|
2018-09-20 14:15:58 +00:00
|
|
|
|
2018-10-19 12:16:04 +00:00
|
|
|
!sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_MINOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) {
|
|
|
|
warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_MAX"\
|
2018-09-20 14:15:58 +00:00
|
|
|
"of the platform SDK, you're using $${QMAKE_MAC_SDK_MAJOR_MINOR_VERSION}.")
|
2018-08-31 10:33:08 +00:00
|
|
|
warning("This is an unsupported configuration. You may experience build issues," \
|
|
|
|
"and by using")
|
|
|
|
warning("the $$QMAKE_MAC_SDK_VERSION SDK you are opting in to new features" \
|
|
|
|
"that Qt has not been prepared for.")
|
|
|
|
|
|
|
|
warning("Please downgrade the SDK you use to build your app to version" \
|
2018-10-19 12:16:04 +00:00
|
|
|
"$$QT_MAC_SDK_VERSION_MAX, or configure")
|
2018-08-31 10:33:08 +00:00
|
|
|
warning("with CONFIG+=sdk_no_version_check when running qmake" \
|
|
|
|
"to silence this warning.")
|
|
|
|
}
|
|
|
|
}
|
2018-08-31 09:43:24 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
!no_objective_c:CONFIG += objective_c
|
|
|
|
|
2015-06-04 16:55:55 +00:00
|
|
|
qt {
|
2016-08-05 11:35:39 +00:00
|
|
|
qtConfig(static) {
|
2014-01-27 16:17:04 +00:00
|
|
|
# C++11 support means using libc++ instead of libstd++. As the
|
|
|
|
# two libraries are incompatible we need to ensure the end user
|
|
|
|
# project is built using the same C++11 support/no support as Qt.
|
2016-08-05 11:35:39 +00:00
|
|
|
qtConfig(c++11) {
|
2014-01-27 16:17:04 +00:00
|
|
|
CONFIG += c++11
|
|
|
|
} else: c++11 {
|
|
|
|
warning("Qt was not built with C++11 enabled, disabling feature")
|
|
|
|
CONFIG -= c++11
|
|
|
|
}
|
2014-01-27 16:27:36 +00:00
|
|
|
|
|
|
|
!c++11 {
|
|
|
|
# Explicitly use libstdc++ if C++11 support is not enabled,
|
|
|
|
# as otherwise the compiler will choose the standard library
|
|
|
|
# based on the deployment target, which for iOS 7 and OS X 10.9
|
|
|
|
# is libc++, and we can't mix and match the two.
|
|
|
|
QMAKE_CXXFLAGS += -stdlib=libstdc++
|
|
|
|
QMAKE_LFLAGS += -stdlib=libstdc++
|
|
|
|
}
|
2014-01-27 16:17:04 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-04-03 13:27:27 +00:00
|
|
|
|
2016-05-28 09:13:34 +00:00
|
|
|
# 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 {
|
2019-09-25 12:38:08 +00:00
|
|
|
uikit: QMAKE_RPATHDIR += @executable_path/Frameworks
|
|
|
|
else: QMAKE_RPATHDIR += @executable_path/../Frameworks
|
2016-05-28 09:13:34 +00:00
|
|
|
equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
|
|
|
|
}
|
|
|
|
|
2017-02-17 06:18:56 +00:00
|
|
|
# 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.
|
2016-08-19 03:40:38 +00:00
|
|
|
!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
|
|
|
|
|
2017-01-27 19:34:17 +00:00
|
|
|
app_extension_api_only {
|
2017-04-11 21:18:42 +00:00
|
|
|
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
|
2017-01-27 19:34:17 +00:00
|
|
|
}
|
|
|
|
|
2016-09-21 03:18:45 +00:00
|
|
|
macx-xcode {
|
2017-11-21 07:49:34 +00:00
|
|
|
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
|
|
|
|
|
2019-09-20 12:28:49 +00:00
|
|
|
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
|
2017-11-21 07:49:34 +00:00
|
|
|
|
2016-09-21 03:18:45 +00:00
|
|
|
!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 {
|
2017-01-24 09:33:37 +00:00
|
|
|
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
|
2016-09-21 03:18:45 +00:00
|
|
|
|
2016-11-17 13:15:53 +00:00
|
|
|
isEmpty(VALID_ARCHS): \
|
|
|
|
error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture")
|
|
|
|
|
2016-09-21 03:18:45 +00:00
|
|
|
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
|
2017-01-24 09:33:37 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-01-30 12:02:10 +00:00
|
|
|
# If we're doing a simulator and device build, device and simulator
|
2017-01-24 09:33:37 +00:00
|
|
|
# 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).
|
2017-01-30 12:02:10 +00:00
|
|
|
simulator:device {
|
2016-12-23 14:08:39 +00:00
|
|
|
QMAKE_XARCH_CFLAGS =
|
|
|
|
QMAKE_XARCH_LFLAGS =
|
|
|
|
QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
|
|
|
|
|
2016-12-23 14:36:19 +00:00
|
|
|
for (arch, VALID_ARCHS) {
|
|
|
|
contains(VALID_SIMULATOR_ARCHS, $$arch) {
|
2016-12-23 14:08:39 +00:00
|
|
|
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}
|
|
|
|
}
|
|
|
|
|
2017-01-24 09:33:37 +00:00
|
|
|
QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
|
|
|
|
QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
|
|
|
|
QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
|
2016-12-23 14:08:39 +00:00
|
|
|
} else {
|
2017-01-24 09:33:37 +00:00
|
|
|
simulator: \
|
|
|
|
version_identifier = $$simulator.deployment_identifier
|
|
|
|
else: \
|
|
|
|
version_identifier = $$device.deployment_identifier
|
2016-12-23 14:08:39 +00:00
|
|
|
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
|
|
|
|
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
|
|
|
|
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
|
|
|
|
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
|
|
|
|
}
|
|
|
|
|
2017-01-24 09:33:37 +00:00
|
|
|
# Enable precompiled headers for multiple architectures
|
|
|
|
QMAKE_CFLAGS_USE_PRECOMPILE =
|
|
|
|
for (arch, VALID_ARCHS) {
|
2017-04-11 21:54:53 +00:00
|
|
|
icc_pch_style: \
|
|
|
|
use_flag = "-pch-use "
|
|
|
|
else: \
|
|
|
|
use_flag = -include
|
|
|
|
|
2017-06-07 11:52:30 +00:00
|
|
|
# Only use Xarch with multi-arch, as the option confuses ccache
|
|
|
|
count(VALID_ARCHS, 1, greaterThan): \
|
|
|
|
QMAKE_CFLAGS_USE_PRECOMPILE += \
|
|
|
|
-Xarch_$${arch}
|
|
|
|
|
2017-01-24 09:33:37 +00:00
|
|
|
QMAKE_CFLAGS_USE_PRECOMPILE += \
|
2017-04-11 21:54:53 +00:00
|
|
|
$${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
|
2017-01-24 09:33:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
|
2014-03-13 15:16:22 +00:00
|
|
|
}
|
|
|
|
|
2019-07-31 13:42:46 +00:00
|
|
|
!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
|
|
|
|
# Explicit SDK version has been set, respect that
|
|
|
|
QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
|
|
|
|
}
|
|
|
|
|
2013-10-31 19:27:54 +00:00
|
|
|
cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
|
2017-06-07 23:42:47 +00:00
|
|
|
!isEmpty(QMAKE_XCODE_VERSION): \
|
|
|
|
cache(QMAKE_XCODE_VERSION, stash)
|
2013-05-08 10:21:05 +00:00
|
|
|
|
2013-10-25 15:00:10 +00:00
|
|
|
QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
|
2018-03-13 17:27:58 +00:00
|
|
|
|
|
|
|
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"
|
2018-07-17 06:30:08 +00:00
|
|
|
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}"
|
2018-03-13 17:27:58 +00:00
|
|
|
QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
|
2018-11-20 15:37:12 +00:00
|
|
|
|
|
|
|
!macx-xcode {
|
2019-08-06 12:31:54 +00:00
|
|
|
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
|
2018-11-20 15:37:12 +00:00
|
|
|
generate_xcode_project.target = xcodeproj
|
|
|
|
QMAKE_EXTRA_VARIABLES += _PRO_FILE_
|
|
|
|
QMAKE_EXTRA_TARGETS += generate_xcode_project
|
|
|
|
}
|