macOS: Respect QMAKE_APPLE_DEVICE_ARCHS by building for all those archs

If QMAKE_APPLE_DEVICE_ARCHS is not set, we pick up the available archs
based on what Qt was built with (QT_ARCS), but only build the active
arch.

Pick-to: 6.2
Change-Id: I83273f878022af34a3a0d0eeae8b11d781f78c49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-06-21 21:48:25 +02:00
parent 96469ae338
commit b0a9825edb
2 changed files with 20 additions and 8 deletions

View File

@ -17,6 +17,8 @@ device.dir_affix = $${device.sdk}
device.CONFIG = $${device.sdk}
device.deployment_identifier = $${device.sdk}
CONFIG += only_active_arch
QMAKE_LIBS_VULKAN =
include(mac.conf)

View File

@ -95,11 +95,18 @@ app_extension_api_only {
QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
}
# Pick up available architectures from what Qt was built with,
# so that our Makefile or Xcode project is set up to build for
# any of the available architectures.
isEmpty(QMAKE_APPLE_DEVICE_ARCHS): \
QMAKE_APPLE_DEVICE_ARCHS = $$QT_ARCHS
macos {
!isEmpty(QMAKE_APPLE_DEVICE_ARCHS) {
# If the user has requested a specific set of architectures,
# build all of those by default, but limited to only those.
CONFIG -= only_active_arch
} else {
# Otherwise allow building all of the architectures available
# in Qt, but only build the active arch (unless the user has
# manually overridden this via CONFIG -= only_active_arch).
QMAKE_APPLE_DEVICE_ARCHS = $$QT_ARCHS
}
}
macx-xcode {
qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
@ -158,15 +165,18 @@ macx-xcode {
single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
macos: ACTIVE_ARCH = $$system("uname -m")
macos {
only_active_arch: DEFAULT_ARCHS = $$system("uname -m")
else: DEFAULT_ARCHS = $$VALID_ARCHS
}
ARCHS = $(filter $(EXPORT_VALID_ARCHS), \
$(if $(ARCHS), $(ARCHS), \
$(if $(EXPORT_ACTIVE_ARCH), $(EXPORT_ACTIVE_ARCH), \
$(if $(EXPORT_DEFAULT_ARCHS), $(EXPORT_DEFAULT_ARCHS), \
$(EXPORT_VALID_ARCHS))))
ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ARCHS), $(EXPORT_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCH ARCHS ARCH_ARGS
QMAKE_EXTRA_VARIABLES += VALID_ARCHS DEFAULT_ARCHS ARCHS ARCH_ARGS
arch_flags = $(EXPORT_ARCH_ARGS)