From 8115219407fdbe7c01e97c76ccf3aa48b1fd8f78 Mon Sep 17 00:00:00 2001 From: Christoph Keller Date: Sun, 11 Apr 2021 16:11:01 +0200 Subject: [PATCH 1/4] Explicitly set input files for qtpreprocess MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes build errors with Xcode 10. Xcode 10 build system (a.k.a "New Build System") needs to know the input files in order to build a correct dependency graph. Especially when a build is not run for the first time and files changed in-between. Task-number: QTBUG-71035 Pick-to: 6.0 6.1 5.15 5.12 Change-Id: If8fbad3a1915add9b35c79131b03cdbe6b7ac06d Reviewed-by: Tor Arne Vestbø --- qmake/generators/mac/pbuilder_pbx.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 05534677a34..c1c9336c92b 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -784,6 +784,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak"; QFile mkf(mkfile); ProStringList outputPaths; + ProStringList inputPaths; if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) { writingUnixMakefileGenerator = true; debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); @@ -836,6 +837,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QString path = escapeDependencyPath(Option::fixPathToTargetOS( replaceExtraCompilerVariables(tmpOut, file_name, QString(), NoShell))); mkt << ' ' << path; + inputPaths << fn; outputPaths << path; } } @@ -849,6 +851,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } // Remove duplicates from build steps with "combine" outputPaths.removeDuplicates(); + + // Don't create cycles. We only have one qt_preprocess.mak which runs different compilers + // whose inputs may depend on the output of another. The "compilers" step will run all + // compilers anyway + inputPaths.removeEach(outputPaths); + mkfile = fileFixify(mkfile); QString phase_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET"); // project->values("QMAKE_PBX_BUILDPHASES").append(phase_key); @@ -859,6 +867,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("name", "Qt Preprocessors") << ";\n" + << "\t\t\t" << writeSettings("inputPaths", inputPaths, SettingsAsList, 4) << ";\n" << "\t\t\t" << writeSettings("outputPaths", outputPaths, SettingsAsList, 4) << ";\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";\n" << "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(Option::output_dir) From ededf3914297aca62e1d257175305cab5dbf6da2 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 7 Apr 2021 12:00:09 +0200 Subject: [PATCH 2/4] CMake: Fix duplicate symbol errors in Windows static super builds qt_internal_add_executable has some special logic to link static plugins in order to avoid issues with link cycles on exported Qt module targets. This logic does not take into account if a plugin is a default plugin. On windows this caused duplicate symbol linking issues in static super builds, because both qwindows and qdirect2d define a subset of the same symbols. Make sure to only link to default static plugins. This will skip linking to qdirect2d because it's not a default qpa plugin and thus avoid linker issues. Amends 5807e1ae8168a5702ad0f6890d2b35223cfebdee Pick-to: 6.1 6.1.0 Fixes: QTBUG-92451 Change-Id: I56df2ce0201625088417de53038642518c1d3bbd Reviewed-by: Alexey Edelev Reviewed-by: Craig Scott Reviewed-by: Alexandru Croitor --- cmake/QtPluginHelpers.cmake | 39 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index d210d29cdcf..5972d1419dc 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -140,6 +140,23 @@ function(qt_internal_add_plugin target) unset(plugin_install_package_suffix) + # The generic plugins should be enabled by default. + # But platform plugins should always be disabled by default, and only one is enabled + # based on the platform (condition specified in arg_DEFAULT_IF). + if(plugin_type_escaped STREQUAL "platforms") + set(_default_plugin 0) + else() + set(_default_plugin 1) + endif() + + if (DEFINED arg_DEFAULT_IF) + if (NOT ${arg_DEFAULT_IF}) + set(_default_plugin 0) + else() + set(_default_plugin 1) + endif() + endif() + # Save the Qt module in the plug-in's properties and vice versa if(NOT plugin_type_escaped STREQUAL "qml_plugin") qt_internal_get_module_for_plugin("${target}" "${plugin_type_escaped}" qt_module) @@ -166,7 +183,10 @@ function(qt_internal_add_plugin target) DIRECTORY ${module_source_dir} DEFINITION PROJECT_NAME ) - if(module_project_name STREQUAL PROJECT_NAME) + + # When linking static plugins with the special logic in qt_internal_add_executable, + # make sure to skip non-default plugins. + if(module_project_name STREQUAL PROJECT_NAME AND _default_plugin) set_property(TARGET ${qt_module_target} APPEND PROPERTY _qt_repo_plugins "${target}") set_property(TARGET ${qt_module_target} APPEND PROPERTY _qt_repo_plugin_class_names "$" @@ -195,23 +215,6 @@ function(qt_internal_add_plugin target) _qt_plugin_install_package_suffix "${plugin_install_package_suffix}") endif() - # The generic plugins should be enabled by default. - # But platform plugins should always be disabled by default, and only one is enabled - # based on the platform (condition specified in arg_DEFAULT_IF). - if(plugin_type_escaped STREQUAL "platforms") - set(_default_plugin 0) - else() - set(_default_plugin 1) - endif() - - if (DEFINED arg_DEFAULT_IF) - if (NOT ${arg_DEFAULT_IF}) - set(_default_plugin 0) - else() - set(_default_plugin 1) - endif() - endif() - if(TARGET qt_plugins) add_dependencies(qt_plugins "${target}") endif() From b6dd5d7c3b6735ef0f50c7eb068727496bff4abf Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 9 Apr 2021 17:12:39 +0200 Subject: [PATCH 3/4] CMake: Fix auto-importing of plugins in static Qt qmake projects Previously the plugin .pri files that CMake generated for qmake consumption contained an '-' to exclude the plugin from auto-importing only if the plugin type was generic or a platform plugin. Now that plugin projects that should be excluded have a proper DEFAULT_IF FALSE clause, we can simply query for the defaultness of the plugin to know whether to exclude it in the generated .pri file. This fixes an issue with Qt static builds and qtvirtualkeyboard. The vkb plugin was not excluded and thus any simple QtGui app linked to the vkb plugin in a static qmake project. This led to linker issues because the vkb plugin also depends on a vkb quick plugin which is not listed as a dependency. Augments 76230d98795a2e7a365328eb693ff57f6ddd7f1d Amends c975c35eaebcca3bd33931fecc3beb513e332292 Pick-to: 6.1 6.1.0 Fixes: QTBUG-92529 Task-number: QTBUG-87861 Change-Id: I9671f6504374cf0799289bbe19110e01c129402e Reviewed-by: Alexey Edelev Reviewed-by: Alexandru Croitor --- cmake/QtPriHelpers.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake index e425a4ec2b9..36f455bfa11 100644 --- a/cmake/QtPriHelpers.cmake +++ b/cmake/QtPriHelpers.cmake @@ -454,7 +454,7 @@ function(qt_generate_plugin_pri_file target pri_file_var) get_target_property(plugin_class_name ${target} QT_PLUGIN_CLASS_NAME) set(plugin_extends "") - if(NOT default_plugin AND (plugin_type STREQUAL "generic" OR plugin_type STREQUAL "platforms")) + if(NOT default_plugin) set(plugin_extends "-") endif() From c1ac201f5c9905751eb35531f26311c8d291f9cc Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 8 Apr 2021 13:32:26 +0200 Subject: [PATCH 4/4] CMake: Fix condition evaluation in plugin's DEFAULT_IF option Expand the condition without an extra negation. This fixes incorrect condition evaluation for conditions not enclosed in parenthesis. Pick-to: 6.1 Change-Id: I4923059b6b199676058091c23d51c9368daaebd0 Reviewed-by: Craig Scott Reviewed-by: Alexandru Croitor --- cmake/QtPluginHelpers.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/QtPluginHelpers.cmake b/cmake/QtPluginHelpers.cmake index 5972d1419dc..a3a4c94a806 100644 --- a/cmake/QtPluginHelpers.cmake +++ b/cmake/QtPluginHelpers.cmake @@ -149,12 +149,12 @@ function(qt_internal_add_plugin target) set(_default_plugin 1) endif() - if (DEFINED arg_DEFAULT_IF) - if (NOT ${arg_DEFAULT_IF}) - set(_default_plugin 0) - else() - set(_default_plugin 1) - endif() + if(DEFINED arg_DEFAULT_IF) + if(${arg_DEFAULT_IF}) + set(_default_plugin 1) + else() + set(_default_plugin 0) + endif() endif() # Save the Qt module in the plug-in's properties and vice versa