diff options
Diffstat (limited to 'mkspecs/features')
24 files changed, 285 insertions, 92 deletions
diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf index b77d1f2653..8437e1542b 100644 --- a/mkspecs/features/android/android_deployment_settings.prf +++ b/mkspecs/features/android/android_deployment_settings.prf @@ -78,8 +78,14 @@ contains(TEMPLATE, ".*app"):!build_pass:!android-embedded { contains(resource, ".*qmake_qmake_immediate\\.qrc$") { # They will be created for each architecture, since they could be different # we need to account for all of them - for (arch, ANDROID_ABIS): \ - rescopy += $$absolute_path("qmake_qmake_immediate.qrc", $$OUT_PWD/$$arch) + qmake_qrc_path = "qmake_qmake_immediate.qrc" + base_out_path = $$OUT_PWD/$$RCC_DIR + multi_android_abi { + for (arch, ANDROID_ABIS): \ + rescopy += $$absolute_path($$qmake_qrc_path, $$base_out_path/$$arch) + } else { + rescopy += $$absolute_path($$qmake_qrc_path, $$base_out_path) + } } else { contains(resource, ".*\\.qrc$"): rescopy += $$absolute_path($$resource, $$_PRO_FILE_PWD_) } diff --git a/mkspecs/features/android/default_pre.prf b/mkspecs/features/android/default_pre.prf index eaa2b0c666..2328b728ac 100644 --- a/mkspecs/features/android/default_pre.prf +++ b/mkspecs/features/android/default_pre.prf @@ -36,6 +36,9 @@ QMAKE_CFLAGS += -fno-limit-debug-info QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS +equals(ANDROID_TARGET_ARCH, armeabi-v7a): \ + QMAKE_LINK += -Wl,--exclude-libs,libunwind.a + ANDROID_STDCPP_PATH = $$NDK_LLVM_PATH/sysroot/usr/lib/ # -fstack-protector-strong offers good protection against stack smashing attacks. @@ -73,8 +76,6 @@ else: equals(QT_ARCH, x86_64): CROSS_COMPILE = $$NDK_LLVM_PATH/bin/x86_64-linux- else: equals(QT_ARCH, arm64-v8a): CROSS_COMPILE = $$NDK_LLVM_PATH/bin/aarch64-linux-android- else: CROSS_COMPILE = $$NDK_LLVM_PATH/bin/arm-linux-androideabi- -QMAKE_RANLIB = $${CROSS_COMPILE}ranlib -QMAKE_LINK_SHLIB = $$QMAKE_LINK QMAKE_LFLAGS = QMAKE_LIBS_PRIVATE = -llog -lz -lm -ldl -lc diff --git a/mkspecs/features/android/sdk.prf b/mkspecs/features/android/sdk.prf index 463d399a21..83428ae7d7 100644 --- a/mkspecs/features/android/sdk.prf +++ b/mkspecs/features/android/sdk.prf @@ -1,6 +1,6 @@ API_VERSION_TO_USE = $$(ANDROID_API_VERSION) isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = $$API_VERSION -isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = android-28 +isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = android-31 ANDROID_JAR_FILE = $$ANDROID_SDK_ROOT/platforms/$$API_VERSION_TO_USE/android.jar !exists($$ANDROID_JAR_FILE) { diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 24ed125f12..64639f177d 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -170,6 +170,9 @@ qtConfig(debug_and_release) { } contains(CONFIG, plugin) { + CMAKE_PLUGIN_NAME = $$PLUGIN_CLASS_NAME + + plugin_genex_check = equals(PLUGIN_EXTENDS, -) { CMAKE_PLUGIN_EXTENDS = - } else { @@ -177,8 +180,13 @@ contains(CONFIG, plugin) { for (p, PLUGIN_EXTENDS) { m = $$cmakeModuleName($$p) list_plugin_extends += Qt::$$m + + # CMake introduced $<IN_LIST:> in 3.12 which is too new for Qt, so manually + # unroll each module check with an STREQUAL genex + plugin_genex_check += \"$<STREQUAL:$<TARGET_PROPERTY:Qt5::$${CMAKE_PLUGIN_NAME},QT_PLUGIN_EXTENDS>,Qt::$${m}>,\" } CMAKE_PLUGIN_EXTENDS = $$join(list_plugin_extends, ";") + CMAKE_PLUGIN_EXTENDS_GENEX_CHECK = $$join(plugin_genex_check, "$$escape_expand(\\n) ") } PLUGIN_MODULE_NAME = @@ -207,7 +215,6 @@ contains(CONFIG, plugin) { CMAKE_MODULE_NAME = $$cmakeModuleName($$PLUGIN_MODULE_NAME) - CMAKE_PLUGIN_NAME = $$PLUGIN_CLASS_NAME CMAKE_PLUGIN_TYPE = $$PLUGIN_TYPE CMAKE_PLUGIN_TYPE_ESCAPED = $$replace(PLUGIN_TYPE, [-/], _) diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in index b550a52c60..b465a7fa89 100644 --- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in +++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in @@ -86,15 +86,14 @@ string(CONCAT _plugin_genex \"${_user_specified_genex_versionless},\" # Add this plugin if all of the following are true: # 1) the list of explicitly included plugin types is empty - # 2) the QT_PLUGIN_EXTENDS property for the plugin is empty or equal to the current - # module name + # 2) the QT_PLUGIN_EXTENDS property for the plugin is empty or equal to one of the modules + # listed in the plugin\'s PLUGIN_EXTEND qmake variable # 3) the user hasn\'t explicitly excluded the plugin. + # TODO: Note that the current implementation of (2) is not entirely correct QTBUG-93501 \"$<AND:\" \"$<STREQUAL:${_plugin_type_genex},>,\" \"$<OR:\" - # FIXME: The value of CMAKE_MODULE_NAME seems to be wrong (e.g for Svg plugin - # it should be Qt::Svg instead of Qt::Gui). - \"$<STREQUAL:$<TARGET_PROPERTY:Qt5::$${CMAKE_PLUGIN_NAME},QT_PLUGIN_EXTENDS>,Qt::$${CMAKE_MODULE_NAME}>,\" + $${CMAKE_PLUGIN_EXTENDS_GENEX_CHECK} \"$<STREQUAL:$<TARGET_PROPERTY:Qt5::$${CMAKE_PLUGIN_NAME},QT_PLUGIN_EXTENDS>,>\" \">,\" \"$<NOT:$<IN_LIST:Qt5::$${CMAKE_PLUGIN_NAME},${_no_plugins_genex}>>,\" diff --git a/mkspecs/features/data/mac/objc_namespace.sh b/mkspecs/features/data/mac/objc_namespace.sh index ceff2df324..b24c5f071c 100755 --- a/mkspecs/features/data/mac/objc_namespace.sh +++ b/mkspecs/features/data/mac/objc_namespace.sh @@ -42,7 +42,7 @@ script_argument_prefix="-Wobjc_namespace,--" required_arguments="target suffix original_ld" -optional_arguments="exclude_list exclude_regex slient" +optional_arguments="exclude_list exclude_regex silent" for argument in $required_arguments $optional_arguments; do declare "$argument=" @@ -100,11 +100,13 @@ sanitize_address() { echo "0x$address" } +arch_offset=0 read_binary() { local address=$1 local length=$2 - dd if="$target" bs=1 iseek=$address count=$length 2>|/dev/null + seek=$(($address + $arch_offset)) + dd if="$target" bs=1 iseek=$seek count=$length 2>|/dev/null } read_32bit_value() { @@ -112,23 +114,23 @@ read_32bit_value() { read_binary $address 4 | xxd -p | dd conv=swab 2>/dev/null | rev } -inspect_binary() { - inspect_mode="$1" +otool_args= +otool() { + command otool $otool_args "$@" +} - echo -n "đ Inspecting binary '$target', " - if [ ! -f "$target" ]; then - echo "target does not exist!" - exit 1 - fi +declare -a extra_classnames_files - read -a mach_header <<< "$(otool -h "$target" -v | tail -n 1)" - if [ "${mach_header[1]}" != "X86_64" ]; then - echo "binary is not 64-bit, only 64-bit binaries are supported!" - exit 1 - fi +inspect_binary() { + inspect_mode="$1" classnames_section="__objc_classname" classnames=$(otool -v -s __TEXT $classnames_section "$target" | tail -n +3) + if [ -z "$classnames" ]; then + echo " âšī¸ No Objective-C classes found in binary" + return 1 + fi + while read -a classname; do address=$(sanitize_address ${classname[0]}) name=${classname[1]} @@ -138,21 +140,26 @@ inspect_binary() { done <<< "$classnames" extra_classnames_file="$(mktemp -t ${classnames_section}_additions).S" + extra_classnames_files+=("$extra_classnames_file") if [ "$inspect_mode" == "inject_classnames" ]; then - echo "class names have not been namespaced, adding suffix '$suffix'..." + echo " âšī¸ Class names have not been namespaced, adding suffix '$suffix'..." printf ".section __TEXT,$classnames_section,cstring_literals,no_dead_strip\n" > $extra_classnames_file elif [ "$inspect_mode" == "patch_classes" ]; then - echo "found namespaced class names, updating class entries..." + echo " âšī¸ Found namespaced class names, updating class entries..." + fi + + classes=$(otool -o -v "$target" | grep "OBJC_CLASS_RO\|OBJC_METACLASS_RO") + if [ -z "$classes" ]; then + echo " đĨ Failed to read class entries from binary" + exit 1 fi - classes=$(otool -o -v "$target" | grep class_ro_t) while read -a class; do address="$(sanitize_address ${class[1]})" - class_flags="0x$(read_32bit_value $address)" if [ -z "$class_flags" ]; then - echo " đĨ failed to read class flags for class at $address" + echo " đĨ Failed to read class flags for class at $address" continue fi @@ -161,13 +168,13 @@ inspect_binary() { name_offset=$(($address + 24)) classname_address="0x$(read_32bit_value $name_offset)" if [ -z "$classname_address" ]; then - echo " đĨ failed to read class name address for class at $address" + echo " đĨ Failed to read class name address for class at $address" continue fi classname=$(get_entry address_to_classname $classname_address) if [ -z "$classname" ]; then - echo " đĨ failed to resolve class name for address '$classname_address'" + echo " đĨ Failed to resolve class name for address '$classname_address'" continue fi @@ -177,7 +184,7 @@ inspect_binary() { else class_type="class" fi - echo " đŊ skipping excluded $class_type '$classname'" + echo " đŊ Skipping excluded $class_type '$classname'" continue fi @@ -188,13 +195,13 @@ inspect_binary() { continue fi - echo " đ injecting $classnames_section entry '$newclassname' for '$classname'" + echo " đ Injecting $classnames_section entry '$newclassname' for '$classname'" printf ".asciz \"$newclassname\"\n" >> $extra_classnames_file elif [ "$inspect_mode" == "patch_classes" ]; then newclassname_address=$(get_entry classname_to_address ${newclassname}) if [ -z "$newclassname_address" ]; then - echo " đĨ failed to resolve class name address for class '$newclassname'" + echo " đĨ Failed to resolve class name address for class '$newclassname'" continue fi @@ -204,7 +211,9 @@ inspect_binary() { class_type="class" fi - echo " đ¨ patching class_ro_t at $address ($class_type) from $classname_address ($classname) to $newclassname_address ($newclassname)" + name_offset=$(($name_offset + $arch_offset)) + + echo " đ¨ Patching class_ro_t at $address ($class_type) from $classname_address ($classname) to $newclassname_address ($newclassname)" echo ${newclassname_address: -8} | rev | dd conv=swab 2>/dev/null | xxd -p -r -seek $name_offset -l 4 - "$target" fi done <<< "$classes" @@ -213,10 +222,43 @@ inspect_binary() { echo "đŠ Linking binary using '$original_ld'..." link_binary -inspect_binary inject_classnames +echo "đ Inspecting binary '$target'..." +if [ ! -f "$target" ]; then + echo " đĨ Target does not exist!" + exit 1 +fi -echo "đŠ Re-linking binary with extra __objc_classname section..." -link_binary $extra_classnames_file +read -a mach_header <<< "$(otool -h "$target" -v | tail -n 1)" +if [ "${mach_header[0]}" != "MH_MAGIC_64" ]; then + echo " đĨ Binary is not 64-bit, only 64-bit binaries are supported!" + exit 1 +fi + +architectures=$(otool -f -v "$target" | grep architecture) + +setup_arch() { + arch="$1" + if [ ! -z "$arch" ]; then + otool_args="-arch $arch" + offset=$(otool -f -v "$target" | grep -A 6 "architecture $arch" | grep offset) + offset="${offset##*( )}" + arch_offset="$(echo $offset | cut -d ' ' -f 2)" + echo "đ¤ Processing architecture '$arch' at offset $arch_offset..." + fi +} + +while read -a arch; do + setup_arch "${arch[1]}" + inspect_binary inject_classnames + if [ $? -ne 0 ]; then + exit + fi +done <<< "$architectures" -inspect_binary patch_classes +echo "đŠ Re-linking binary with extra __objc_classname section(s)..." +link_binary "${extra_classnames_files[@]}" +while read -a arch; do + setup_arch "${arch[1]}" + inspect_binary patch_classes +done <<< "$architectures" diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 1d79f5c958..ac799047ab 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -122,17 +122,18 @@ breakpad { } c++17: CONFIG += c++1z -c++latest: CONFIG *= c++2a c++1z c++14 c++11 +c++latest: CONFIG *= c++2b c++2a c++1z c++14 c++11 -!c++11:!c++14:!c++1z:!c++2a { +!c++11:!c++14:!c++1z:!c++2a:!c++2b { # Qt requires C++11 since 5.7, check if we need to force a compiler option QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "") !greaterThan(QT_COMPILER_STDCXX_no_L, 199711): CONFIG += c++11 } -c++11|c++14|c++1z|c++2a { +c++11|c++14|c++1z|c++2a|c++2b { # Disable special compiler flags for host builds !host_build|!cross_compile { - c++2a: cxxstd = CXX2A + c++2b: cxxstd = CXX2B + else: c++2a: cxxstd = CXX2A else: c++1z: cxxstd = CXX1Z else: c++14: cxxstd = CXX14 else: cxxstd = CXX11 @@ -155,7 +156,8 @@ c++11|c++14|c++1z|c++2a { unset(cxxstd) } -c99|c11 { +c99|c11|c17|c18 { + c17|c18: cstd = C17 c11: cstd = C11 else: cstd = C99 diff --git a/mkspecs/features/lrelease.prf b/mkspecs/features/lrelease.prf index f611c74184..15d336d8e5 100644 --- a/mkspecs/features/lrelease.prf +++ b/mkspecs/features/lrelease.prf @@ -24,7 +24,7 @@ all_translations = $$TRANSLATIONS $$EXTRA_TRANSLATIONS for (translation, all_translations) { # mirrors $$LRELEASE_DIR/${QMAKE_FILE_IN_BASE}.qm above translation = $$basename(translation) - QM_FILES += $$OUT_PWD/$$LRELEASE_DIR/$$replace(translation, \\..*$, .qm) + QM_FILES += $$OUT_PWD/$$LRELEASE_DIR/$$replace(translation, \\.[^.]+$, .qm) } embed_translations { qmake_qm_files.files = $$QM_FILES diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 92a9112bca..abc6d82ade 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -7,7 +7,12 @@ QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion) contains(TEMPLATE, .*app) { !macx-xcode:if(isEmpty(BUILDS)|build_pass) { # Detect changes to the platform SDK - QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION QMAKE_XCODE_DEVELOPER_PATH + QMAKE_EXTRA_VARIABLES += \ + QMAKE_MAC_SDK \ + QMAKE_MAC_SDK_VERSION \ + QMAKE_XCODE_DEVELOPER_PATH \ + _QMAKE_STASH_ \ + QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk) } @@ -25,11 +30,11 @@ contains(TEMPLATE, .*app) { !isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \ CONFIG += sdk_no_version_check - QMAKE_MAC_SDK_MAJOR_MINOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\\d+)(\\.\\d+)(\\.\\d+)?", \\1\\2) + QMAKE_MAC_SDK_MAJOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\\d+)(\\.\\d+)(\\.\\d+)?", \\1) - !sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_MINOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) { + !sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) { warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_MAX"\ - "of the platform SDK, you're using $${QMAKE_MAC_SDK_MAJOR_MINOR_VERSION}.") + "of the platform SDK, you're using $${QMAKE_MAC_SDK_MAJOR_VERSION}.") 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" \ @@ -90,6 +95,19 @@ app_extension_api_only { QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION } +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 !isEmpty(QMAKE_PKGINFO_TYPEINFO): \ @@ -145,15 +163,20 @@ macx-xcode { 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)) + macos { + only_active_arch: DEFAULT_ARCHS = $$system("uname -m") + else: DEFAULT_ARCHS = $$VALID_ARCHS + } + + ARCHS = $(filter $(EXPORT_VALID_ARCHS), \ + $(if $(ARCHS), $(ARCHS), \ + $(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_ARCHS ARCH_ARGS + QMAKE_EXTRA_VARIABLES += VALID_ARCHS DEFAULT_ARCHS ARCHS ARCH_ARGS arch_flags = $(EXPORT_ARCH_ARGS) diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index e3534561a5..2c91ba6679 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -1,4 +1,25 @@ CONFIG = asset_catalogs rez $$CONFIG + +macos { + count(QT_ARCHS, 1, >) { + # For universal builds all the config tests are run with the first + # architecture (as reflected by QT_ARCH). We have to manually enable + # CPU features we know exist on the secondary architecture. For + # simplicity we just hard-code the base features we know exist. + # Note that this hack means we end up with QT_CPU_FEATURES.x86_64 + # containing neon, and QT_CPU_FEATURES.arm64 containing sse2 e.g. + QT_CPU_FEATURES.$$QT_ARCH += sse sse2 + CONFIG += sse sse2 + DEFINES += QT_COMPILER_SUPPORTS_SSE2 + # FIXME: For x86_64 there are a bunch more. If building a universal + # build with arm64 as the primary architecture we'll miss those. + + QT_CPU_FEATURES.$$QT_ARCH += neon + CONFIG += neon + DEFINES += QT_COMPILER_SUPPORTS_NEON + } +} + load(default_pre) isEmpty(QMAKE_XCODE_DEVELOPER_PATH) { diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk index c40f58c987..a32ceacb6c 100644 --- a/mkspecs/features/mac/sdk.mk +++ b/mkspecs/features/mac/sdk.mk @@ -1,6 +1,6 @@ ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),) - CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>&1 + CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>/dev/null 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. @@ -13,12 +13,14 @@ ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),) 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).) + $(info The $(EXPORT_QMAKE_MAC_SDK) 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.) + $(info This requires a fresh build of your project. Please wipe the build directory) + ifneq ($(EXPORT__QMAKE_STASH_),) + $(info including the qmake cache in $(EXPORT__QMAKE_STASH_)) + endif $(error ^) endif endif diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 69d1954306..da1f44a88a 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -215,13 +215,32 @@ for(ever) { # Linking frameworks by absolute path does not work. LIBS$$var_sfx += -framework $$framework } else { - lib = $$MODULE_MODULE$$qtPlatformTargetSuffix() + candidates = $$MODULE_MODULE$$qtPlatformTargetSuffix() + darwin: candidates *= $$MODULE_MODULE win32|contains(MODULE_CONFIG, staticlib) { - lib = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB$${lib}.$$QMAKE_EXTENSION_STATICLIB - PRE_TARGETDEPS += $$lib + lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB + lib_suffix = $$QMAKE_EXTENSION_STATICLIB + add_lib_to_pretargetdeps = true } else { - lib = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB$${lib}.$$QMAKE_EXTENSION_SHLIB + lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB + lib_suffix = $$QMAKE_EXTENSION_SHLIB + add_lib_to_pretargetdeps = false + } + lib_missing = true + lib_fallback = + for(lib_base, candidates) { + lib = $${lib_prefix}$${lib_base}.$${lib_suffix} + isEmpty(lib_fallback): \ + lib_fallback = $$lib + exists($$lib) { + lib_missing = false + break() + } } + $$lib_missing: \ + lib = $$lib_fallback + $$add_lib_to_pretargetdeps: \ + PRE_TARGETDEPS += $$lib LIBS$$var_sfx += $$lib } } diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 269ec11be1..aed52752b7 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -18,6 +18,7 @@ qtConfig(c++11): CONFIG += c++11 strict_c++ qtConfig(c++14): CONFIG += c++14 qtConfig(c++1z): CONFIG += c++1z qtConfig(c++2a): CONFIG += c++2a +qtConfig(c++2b): CONFIG += c++2b qtConfig(c99): CONFIG += c99 qtConfig(c11): CONFIG += c11 qtConfig(separate_debug_info): CONFIG += separate_debug_info @@ -158,4 +159,3 @@ warnings_are_errors:warning_clean { } unset(ver) } - diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf index 095bf15dac..e19d06f788 100644 --- a/mkspecs/features/qt_docs.prf +++ b/mkspecs/features/qt_docs.prf @@ -29,20 +29,20 @@ QT_TOOL_ENV = # On Windows, put the includes into a .inc file which QDoc will read, if the project # has too many includes. We do this to overcome a command-line limit on Windows. -WIN_INCLUDETEMP= +QDOC_WIN_INCLUDETEMP= INCLUDE_PATHS=$$INCPATH win32:count(INCLUDE_PATHS, 30, >) { - WIN_INCLUDETEMP = $$OUT_PWD/qdocincludepaths.inc - WIN_INCLUDETEMP_CONTENT = + QDOC_WIN_INCLUDETEMP = $$OUT_PWD/qdocincludepaths.inc + QDOC_WIN_INCLUDETEMP_CONTENT = for (inc, INCLUDE_PATHS): \ - WIN_INCLUDETEMP_CONTENT += -I$$inc - write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONTENT)|error() + QDOC_WIN_INCLUDETEMP_CONTENT += -I$$inc + write_file($$absolute_path($$QDOC_WIN_INCLUDETEMP, $$OUT_PWD), QDOC_WIN_INCLUDETEMP_CONTENT)|error() } -isEmpty(WIN_INCLUDETEMP) { +isEmpty(QDOC_WIN_INCLUDETEMP) { QDOC_INCLUDE_PATHS=$(INCPATH) } else { - QDOC_INCLUDE_PATHS=@$$shell_quote($$WIN_INCLUDETEMP) + QDOC_INCLUDE_PATHS=@$$shell_quote($$QDOC_WIN_INCLUDETEMP) } macos: QDOC_INCLUDE_PATHS += $$join(QMAKE_DEFAULT_INCDIRS," -I","-I") diff --git a/mkspecs/features/qt_helper_lib.prf b/mkspecs/features/qt_helper_lib.prf index bc20251bd9..2d67a30fb7 100644 --- a/mkspecs/features/qt_helper_lib.prf +++ b/mkspecs/features/qt_helper_lib.prf @@ -89,4 +89,49 @@ TARGET = $$THE_TARGET # In static builds of Qt, convenience libraries must be installed, # as in this case they are not linked to the final library/plugin. -installed|if(!not_installed:qtConfig(static)): load(qt_installs) +installed|if(!not_installed:qtConfig(static)) { + !isEmpty(MODULE_EXT_HEADERS) { + headers.files = $${MODULE_EXT_HEADERS} + headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET + INSTALLS += headers + } else { + !isEmpty(MODULE_EXT_HEADERS_DIR) { + headers.files = $$MODULE_EXT_HEADERS_DIR/* + headers.path = $$[QT_INSTALL_HEADERS]/$$TARGET + INSTALLS += headers + } + } + + CONFIG += qt_install_module + rpl_header_base = $$MODULE_INCLUDEPATH + rpl_lib_base = $${MODULE_LIBS} + qqt_dir = \$\$\$\$[QT_INSTALL_HEADERS] + pri_header_replace.match = $$rpl_header_base + pri_header_replace.replace = $$qqt_dir/$$TARGET + pri_header_replace.CONFIG = path + pri_header_replace.filename = qt_ext_$${MODULE}.pri + qqt_dir = \$\$\$\$[QT_INSTALL_LIBS] + pri_lib_replace.match = $$rpl_lib_base + pri_lib_replace.replace = $$qqt_dir/$$prefix$${THE_TARGET}.$$suffix + pri_lib_replace.CONFIG = path + pri_lib_replace.filename = qt_ext_$${MODULE}.pri + QMAKE_INSTALL_REPLACE += pri_header_replace pri_lib_replace + if(msvc|qtConfig(debug_and_release)): { + rpl_lib_target = $$prefix$${TARGET}.$$suffix + pri_lib_release_replace.match = $$DESTDIR/$${rpl_lib_target} + pri_lib_release_replace.replace = $$qqt_dir/$${rpl_lib_target} + pri_lib_release_replace.CONFIG = path + pri_lib_release_replace.filename = qt_ext_$${MODULE}.pri + QMAKE_INSTALL_REPLACE += pri_lib_release_replace + win32: \ + rpl_lib_target = $$prefix$${TARGET}d.$$suffix + else: darwin: \ + rpl_lib_target = $$prefix$${TARGET}_debug.$$suffix + pri_lib_debug_replace.match = $$DESTDIR/$${rpl_lib_target} + pri_lib_debug_replace.replace = $$qqt_dir/$${rpl_lib_target} + pri_lib_debug_replace.CONFIG = path + pri_lib_debug_replace.filename = qt_ext_$${MODULE}.pri + QMAKE_INSTALL_REPLACE += pri_lib_debug_replace + } + load(qt_installs) +} diff --git a/mkspecs/features/qt_targets.prf b/mkspecs/features/qt_targets.prf index 3810d1e0ad..b6fedd30e9 100644 --- a/mkspecs/features/qt_targets.prf +++ b/mkspecs/features/qt_targets.prf @@ -1,4 +1,4 @@ QMAKE_TARGET_COMPANY = The Qt Company Ltd. isEmpty(QMAKE_TARGET_PRODUCT): QMAKE_TARGET_PRODUCT = Qt5 isEmpty(QMAKE_TARGET_DESCRIPTION): QMAKE_TARGET_DESCRIPTION = C++ Application Development Framework -QMAKE_TARGET_COPYRIGHT = Copyright (C) 2020 The Qt Company Ltd. +QMAKE_TARGET_COPYRIGHT = Copyright (C) 2023 The Qt Company Ltd. diff --git a/mkspecs/features/resources_functions.prf b/mkspecs/features/resources_functions.prf index 9b7c409121..afd6405fe9 100644 --- a/mkspecs/features/resources_functions.prf +++ b/mkspecs/features/resources_functions.prf @@ -35,10 +35,10 @@ defineTest(qtFlattenResources) { } RESOURCES -= $$resource - !android|isEmpty(BUILDS)|build_pass { + isEmpty(BUILDS)|build_pass { resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD) RESOURCES += $$resource_file - } else { + } else: android { # Android will need a resource file for each architecture make sure it is placed # correctly for other functions that need the right paths for these files for (arch, ANDROID_ABIS) { diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index efbe7c1e55..0c505fc965 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -182,9 +182,14 @@ isEmpty($${target_prefix}.INCDIRS) { # UIKit simulator platforms will see the device SDK's sysroot in # QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass. darwin { - # Clang doesn't pick up the architecture from the sysroot, and will - # default to the host architecture, so we need to manually set it. - cxx_flags += -arch $$QMAKE_APPLE_DEVICE_ARCHS + uikit { + # Clang doesn't automatically pick up the architecture, just because + # we're passing the iOS sysroot below, and we will end up building the + # test for the host architecture, resulting in linker errors when + # linking against the iOS libraries. We work around this by passing + # the architecture explicitly. + cxx_flags += -arch $$first(QMAKE_APPLE_DEVICE_ARCHS) + } uikit:macx-xcode: \ cxx_flags += -isysroot $$sdk_path_device.value @@ -326,9 +331,17 @@ isEmpty($${target_prefix}.INCDIRS) { error("Mkspec does not specify MSVC_VER. Cannot continue.") versionAtLeast(MSVC_VER, 15.0) { dir = $$(VSINSTALLDIR) - isEmpty(dir): \ - dir = $$read_registry(HKLM, \ - "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\$$MSVC_VER", 32) + isEmpty(dir) { + version_parts = $$split(MSVC_VER, .) + MSVC_NEXT_MAJOR = $$num_add($$first(version_parts), 1) + vswhere = "$$getenv(ProgramFiles\(x86\))/Microsoft Visual Studio/Installer/vswhere.exe" + !exists($$vswhere): \ + error("Could not find $$vswhere") + vswhere = $$system_quote($$system_path($$vswhere)) + # -version parameter: A version range for instances to find. 15.0 will get all versions >= 15.0 + # Example: [15.0,16.0) will find versions 15.*. + dir = $$system("$$vswhere -latest -version [$$MSVC_VER,$${MSVC_NEXT_MAJOR}.0] -property installationPath") + } isEmpty(dir): \ error("Failed to find the Visual Studio installation directory.") cmd += $$system_quote($$dir\\VC\\Auxiliary\\Build\\vcvarsall.bat) $$arch diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf index 088b39ff3f..46f21ac092 100644 --- a/mkspecs/features/uikit/default_post.prf +++ b/mkspecs/features/uikit/default_post.prf @@ -28,7 +28,7 @@ macx-xcode { device_family.value = $$QMAKE_APPLE_TARGETED_DEVICE_FAMILY QMAKE_MAC_XCODE_SETTINGS += device_family - ios { + equals(TEMPLATE, app):ios { # Set up default 4-inch iPhone/iPod launch image so that our apps # support the full screen resolution of those devices. qmake_launch_image = Default-568h@2x.png diff --git a/mkspecs/features/uikit/devices.py b/mkspecs/features/uikit/devices.py index 8cdcb370a0..5f2bd5dff2 100755 --- a/mkspecs/features/uikit/devices.py +++ b/mkspecs/features/uikit/devices.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 ############################################################################# ## diff --git a/mkspecs/features/uikit/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk index e1156d0e76..4416240cf2 100644 --- a/mkspecs/features/uikit/xcodebuild.mk +++ b/mkspecs/features/uikit/xcodebuild.mk @@ -58,7 +58,7 @@ debug-%: CONFIGURATION = Debug MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -# Test and build (device) destinations +# Test device destinations ifneq ($(filter check%,$(MAKECMDGOALS)),) ifeq ($(DEVICES),) $(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...) @@ -72,10 +72,10 @@ endif %-device: DEVICES = $(HARDWARE_DEVICES) GENERIC_DEVICE_DESTINATION := $(EXPORT_GENERIC_DEVICE_DESTINATION) -GENERIC_SIMULATOR_DESTINATION := "id=$(shell $(MAKEFILE_DIR)devices.py $(EXPORT_DEVICE_FILTER) | tail -n 1)" +GENERIC_SIMULATOR_DESTINATION := $(EXPORT_GENERIC_SIMULATOR_DESTINATION) -%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_SIMULATOR_DESTINATION)) -%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_DEVICE_DESTINATION)) +%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)","$(GENERIC_SIMULATOR_DESTINATION)") +%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)","$(GENERIC_DEVICE_DESTINATION)") XCODE_VERSION_MAJOR := $(shell xcodebuild -version | grep Xcode | sed -e 's/Xcode //' | sed -e 's/\..*//') @@ -83,6 +83,10 @@ ifeq ($(shell test $(XCODE_VERSION_MAJOR) -gt 7; echo $$?),0) XCODEBUILD_FLAGS += $(shell echo "$(MAKEFLAGS)" | sed -e 's/\([^ ]*\).*/\1/' | grep -qv 's' || echo -quiet) endif +ifeq ($(shell test $(XCODE_VERSION_MAJOR) -ge 9; echo $$?),0) + XCODEBUILD_FLAGS += -allowProvisioningUpdates +endif + # Xcodebuild DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \ diff --git a/mkspecs/features/uikit/xcodebuild.prf b/mkspecs/features/uikit/xcodebuild.prf index 01022c7b99..ddf606cda4 100644 --- a/mkspecs/features/uikit/xcodebuild.prf +++ b/mkspecs/features/uikit/xcodebuild.prf @@ -53,7 +53,13 @@ watchos { DEVICE_FILTER = --platform watchOS --minimum-deployment-target $$QMAKE_WATCHOS_DEPLOYMENT_TARGET GENERIC_DEVICE_DESTINATION = "generic/platform=watchOS" } -QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION +GENERIC_SIMULATOR_DESTINATION = "$$GENERIC_DEVICE_DESTINATION Simulator" + +QMAKE_EXTRA_VARIABLES += \ + DEVICE_SDK SIMULATOR_SDK \ + DEVICE_FILTER \ + GENERIC_DEVICE_DESTINATION \ + GENERIC_SIMULATOR_DESTINATION QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/xcodebuild.mk) diff --git a/mkspecs/features/win32/separate_debug_info.prf b/mkspecs/features/win32/separate_debug_info.prf index 2838020f01..8550fdda15 100644 --- a/mkspecs/features/win32/separate_debug_info.prf +++ b/mkspecs/features/win32/separate_debug_info.prf @@ -13,6 +13,10 @@ have_target:!static:!isEmpty(QMAKE_OBJCOPY) { QMAKE_POST_LINK = $$copy_debug_info && $$strip_debug_info && $$link_debug_info $$QMAKE_POST_LINK silent:QMAKE_POST_LINK = @echo creating $@.debug && $$QMAKE_POST_LINK - target.targets += $$QMAKE_TARGET_DEBUG_INFO + contains(TEMPLATE, lib$):!plugin { + dlltarget.targets += $$QMAKE_TARGET_DEBUG_INFO + } else { + target.targets += $$QMAKE_TARGET_DEBUG_INFO + } QMAKE_DISTCLEAN += $$QMAKE_TARGET_DEBUG_INFO } diff --git a/mkspecs/features/winrt/package_manifest.prf b/mkspecs/features/winrt/package_manifest.prf index 279971bd65..2abe75f726 100644 --- a/mkspecs/features/winrt/package_manifest.prf +++ b/mkspecs/features/winrt/package_manifest.prf @@ -37,8 +37,7 @@ else: \ VCLIBS = $${VCLIBS} # VS 2017 and 2019 still use vclibs 140 - contains(MSVC_VER, "15.0"): VCLIBS = $$replace(VCLIBS, 150, 140) - contains(MSVC_VER, "16.0"): VCLIBS = $$replace(VCLIBS, 160, 140) + contains(MSVC_VER, "1[56]\.[0-9]"): VCLIBS = $$replace(VCLIBS, 1[56][0-9], 140) VCLIBS = "$${VCLIBS}\" MinVersion=\"14.0.0.0\" Publisher=\"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" WINRT_MANIFEST.dependencies += $$VCLIBS } |