fa7626713b
Some users don't want to download the full Xcode installation which can weigh upwards of 5 GB download and 20 GB installed. [ChangeLog][macOS / iOS] Qt can now be built using just the Xcode Command Line Tools, without needing to install the full Xcode IDE. Task-number: QTBUG-35928 Task-number: QTBUG-41908 Change-Id: I6d13c9a03ab9087b3ab56e8547f53f0cc2806c7b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
190 lines
7.5 KiB
Plaintext
190 lines
7.5 KiB
Plaintext
load(default_post)
|
|
|
|
!no_objective_c:CONFIG += objective_c
|
|
|
|
qt {
|
|
qtConfig(static) {
|
|
# 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.
|
|
qtConfig(c++11) {
|
|
CONFIG += c++11
|
|
} else: c++11 {
|
|
warning("Qt was not built with C++11 enabled, disabling feature")
|
|
CONFIG -= c++11
|
|
}
|
|
|
|
!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++
|
|
}
|
|
}
|
|
}
|
|
|
|
# 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 {
|
|
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 {
|
|
!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
|
|
else: \
|
|
version_identifier = $$device.deployment_identifier
|
|
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
|
|
}
|
|
|
|
# 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}
|
|
}
|
|
|
|
cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
|
|
!isEmpty(QMAKE_XCODE_VERSION): \
|
|
cache(QMAKE_XCODE_VERSION, stash)
|
|
|
|
QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
|