Needed for subsequent change that will check and error out if the
version is lower than 3.16. We do that to ensure all policies
introduced by CMake up to version 3.16 have their behavior set to
NEW.
Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Ieaf82c10987dd797d86a3fd4a986a67e72de486a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
In non-prefix builds, we want to prevent users from accidentally running
"cmake --install". We did that by replacing cmake_install.cmake with an
empty file.
The responsible target remove_cmake_install is visible in IDEs, appears
in the build output, and the approach is hacky.
It's cleaner and easier to add bail out code at the top of
cmake_install.cmake. This is now done when calling qt_build_repo_begin.
As a bonus, print an informative message on installation.
Change-Id: I022b36289358ba09cac8b79781f44cd7b93113f7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When setting QT_FEATURE_ values we need to convert the user-provided
FEATURE_ values to the one that is supported by QT_FEATURE_.
Pick-to: 6.2
Fixes: QTBUG-96300
Change-Id: Idd19fbf7f23f351a6c1cfdcedccfaaf6b0aa6e44
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
CMake doesn't add framework include paths for the includes if
add_custom_command is used. When all Qt modules are installed to a
single directory, frameworks could be found under
QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX, but for Conan builds
each module is installed to the separate directory. These directories
need to be listed in the QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables
family. This takes into account directories that are listed in the
QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables and considers they
can contain frameworks.
Pick-to: 6.2
Fixes: QTBUG-96511
Change-Id: I664381df4859a2e85c399cd94dc2f3996e452c03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This fixes the detection of always available architecture based on
user set CMAKE flags.
Change-Id: I541ac9569766a0fe05f4395c06f2ee3bcd77b035
Fixes: QTBUG-91090
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
A recent change refactored the call to qt_internal_add_executable(),
but that had the unintended side-effect of changing the symbol
visibility from public to hidden. That meant that main() became hidden,
so while apps still built successfully, they could not be run. Restore
the original symbol visibility to fix this regression.
Amends d47278fd09
Pick-to: 6.2
Change-Id: I27d84ab2b0dd013d5c38dcfe55e88f307c4bc5dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The EXE_FLAGS option wasn't being used anywhere in any Qt repo
and it had no documentation as to its intended use. Remove it.
Pick-to: 6.2
Change-Id: I2f67ec57c1da7dc6eab81d5351361e770d19d7d5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
These TODOs were left as a marker to be checked once the official
CMake 3.21.0 release was made. The things they refer to were included
in the CMake 3.21.0 release, so the TODOs can be removed.
Fixes: QTBUG-94528
Pick-to: 6.2
Change-Id: I769605de85df657ad056123e787ec9849b77e42f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Static libraries don't need to export their symbols, and corner cases
when sources are also used in shared libraries, should be handled
manually.
Task-number: QTBUG-90492
Change-Id: I5cb0a3f7e280b042b678bdbe4475f2bbf9f6b9ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If qt_internal_generate_cpp_global_exports is called outside the
qt_internall_add_module function scope, install rule that is
generated by qt_internall_add_module won't include generated
cpp export header files. This adds the explicit file-based install
rule for the generated cpp exports.
Since qt_internal_generate_cpp_global_exports now encapsulates all
install rules related to the generated cpp exports, no need to expose
the generated filenames outside the function.
It's expected that module public headers now could be added outside
the qt_internal_add_module function. Tune generating of the module
timestamp by replacing the DEPENDS value with generator expression.
Task-number: QTBUG-90492
Change-Id: I0f086abc8187c5d51117c3a75c47b58580f6913f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The _qt_is_android_executable property is normally set by the
_qt_internal_create_executable() command. But various other internal
commands don't route through that and go through
qt_internal_add_executable() instead. The former is used only by the
public API, the latter only by the internal API. Refactor both so that
the internal one calls the public one. This ensures all targets receive
the same base settings, including the _qt_is_android_executable
property.
Fixes: QTBUG-96085
Pick-to: 6.2
Change-Id: I157356872c9d942d7be5f1abbbcbac97961b1f40
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Conan CI builds can built a qt repository in a repo-target-set
configuration. An example of that is qtscxml.
When building standalone tests, qt_build_tests includes a repo
specific TestsConfig.cmake file to call find_package on the modules
that were built as part of that repo.
That doesn't quite work with a repo-target-set build which is enabled
when the repo is built with a QT_BUILD_SINGLE_REPO_TARGET_SET value.
The TestsConfig.cmake file would be overridden with different contents
on each configuration.
Fix that by including the QT_BUILD_SINGLE_REPO_TARGET_SET value as
part of the TestsConfig.cmake file to be generated and included.
This means that when configuring the standalone tests, the same
QT_BUILD_SINGLE_REPO_TARGET_SET value should be passed, so that the
correct packages are found.
Add some debug statements to allow checking which TestsConfig.cmake
file is loaded when the standalone tests are configured with
--log-level=DEBUG.
Adjusts to 4b09522c23
Amends de3a806def
Amends e7f188b2d2
Pick-to: 6.2
Task-number: QTBUG-96253
Change-Id: I7c22aaad88fe8e6fce23046543363316203f6e8d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Functions that use qt_internal_add_module under the hood might need to
generate cpp exports, e.g. qt_internal_add_qml_module. Append cpp
exports related arguments to the qt_internal_add_module arguments set.
Task-number: QTBUG-90492
Change-Id: I4fd539bd1d8be4d3e57ed5b1b88dd2dbc2f5ca24
Reviewed-by: Craig Scott <craig.scott@qt.io>
Because otherwise we may end up with trailing backslashes
Pick-to: 6.2 6.2.0 6.1
Change-Id: I7ad24ec34c35f0a7b32241751bbcd2b26a8a23ea
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Propagating of plugin init libraries should take into account
plugin finalizers to avoid duplicating of object files in a linker
line.
Pick-to: 6.2
Fixes: QTBUG-96062
Change-Id: I48feac94b08a7eb08d84134e9e9ae6e7214f5bdd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The variable might be defined to HOST_PERL-NOTFOUND which will return
early instead of issuing an error.
Change-Id: Id49dfd0fec8f477dad9e816e6128e36059e68702
Pick-to: 6.2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We default to configuring examples as separate ExternalProjects when
using a developer / non-prefix Qt build.
This ensures we test that the examples configure successfully without
the pollution of the main Qt build (e.g. already found packages).
One down-side of this is that a developer's IDE doesn't see these
example targets, unless each project is loaded into the IDE
separately. This is cumbersome to do when refactoring or renaming
code across multiple example projects.
Allow configuring the example projects as part of the main Qt build
by setting QT_BUILD_EXAMPLES_AS_EXTERNAL to FALSE when configuring Qt.
Save the value of the variable in QtBuildInternalsExtra.cmake.in
so it's propagated to leaf repositories as well.
Amends dab8f64b6d
Amends d97fd7af2b
Task-number: QTBUG-90820
Task-number: QTBUG-94608
Task-number: QTBUG-96232
Task-number: QTCREATORBUG-26168
Pick-to: 6.2
Change-Id: Ie1f724f74365b3a788b04c3fffe9eb2d0611dd50
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
There is no need for this variable to be stored in CMake's cache. We
don't perform expensive operations to set up QT_SYNCQT, and we even
unset the cache variable to ensure it gets recomputed on
reconfiguration.
We still store QT_SYNCQT in a global property, because the function
qt_ensure_sync_qt is called in different directory scopes, and we want
to avoid re-calculations for every subdir.
It's now possible for the user to set QT_SYNCQT (see QTBUG-88088 for
motivation). Also, in a non-prefix build, changes to syncqt.pl in the
source dir are reflected upon re-configuration in the build
tree (because qt_copy_or_install is called on every configure).
Pick-to: 6.2
Fixes: QTBUG-88088
Task-number: QTBUG-75290
Change-Id: I6137b060d200d3dafd4a64d5a6c1bd2549723d78
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
By the time of Qt 6.2 release all new apps targeting Play store must
target API level 30 (Android 11) or above (starting in 08/2021 for
new apps and 11/2021 for existing apps' updates).
Pick-to: 6.2 5.15
Task-number: QTBUG-94451
Change-Id: Id7fa2fd62899a7259e365c917292c6c3ac0d2b0d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Before, we would just issue a warning which is likely to get overlooked
in CMake's output. Also, the configure summary would report "Using
ccache ... yes" but CMAKE_<LANG>_COMPILER_LAUNCHER stays unset, which is
inconsistent.
Make QT_USE_CCACHE=ON and missing ccache a hard error.
Task-number: QTBUG-88308
Change-Id: Iddc7f3a91428fd96ad0defbb1ca72bd46a90aa98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The -static argument we used before is supported by ld, but not lld.
The latter requires --static or -Bstatic. Use -Bstatic, which is
supported by both.
Pick-to: 6.2
Fixes: QTBUG-89549
Change-Id: I3c3069661bf4cd20e3298aff4714163b7419d3ef
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add the generating of private cpp exports for Qt modules.
Add the GENERATE_PRIVATE_CPP_EXPORTS option to qt_internal_add_module
that is the manual switch for private exports generator. Existing
modules in qtbase doesn't follow any strict convention of using
private cpp export. So there is no clue how to detect if generating of
the private exports is required or not for the module.
Use autogenerated private cpp exports in QtNetwork module.
CPP_EXPORT_HEADER_NAME argument of the qt_internal_add_module function
is replaced by the CPP_EXPORT_HEADER_BASE_NAME and has a different
meaning. The provided name is used as a base name for the private and
non-private headers that contains cpp exports. Header files suffixes
are constant: .h and _p.h for the non-private and private header files
accordingly.
Pick-to: 6.2
Task-number: QTBUG-90492
Change-Id: Icf11304e00379fb8521a865965c19b974e01e62f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Module may have specific module include name that should be taken into
account when specifying module include directories in different places.
The INTERFACE_MODULE_INCLUDE_NAME module property name is aligned to
the common naming rules and the property is used to preform include
paths instead of the direct use of the module name.
Add additional paths generated by qt_internal_module_info to keep them
consistent across all cmake files.
Pick-to: 6.2
Change-Id: I4c94017abc322c48616f47e65e371bd863bb087d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Warn if the PRIVATE_MODULE_INTERFACE option is provided a value, but
there is no ${target}Private target to set the interface dependencies
on.
Pick-to: 6.2
Task-number: QTBUG-95921
Change-Id: I7d4df9cb3aa9b7746d836b82019ecdd9c8f50fdc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Don't export the MODULE_PLUGIN_TYPES property only when a module has
an associated configure.cmake file with features. Instead, always
export it if a module defines a plugin type.
This fixes qttools DesignerTargets.cmake file to contain the plugin
types it defines, given that the Designer lib does not declare any
features via a configure.cmake file.
Pick-to: 6.2
Task-number: QTBUG-95668
Change-Id: Ic036c31768e03b51d3bce9c2afe48e04f69f435b
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
To detect the internal module ouside the qt_internal_add_module
function need to mark it with the property.
This adds _qt_is_internal_module property to the Qt internal modules.
Since PRIVATE_MODULE_INTERFACE only was applicable to pure Private
modules, INTERNAL_MODULEs is missing those dependencies if they were
specified. Add extra condition to qt_internal_extend_target to link
PRIVATE_MODULE_INTERFACE libraries to internal modules as well.
Pick-to: 6.2 6.1
Change-Id: I9c32fa5bad3aff365f5d7663349e5365d5f1d72d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously we only created object library static plugin initializers
for Qt plugins only, not user-project plugins.
The reason was that if a user tried to install the plugin target via
an export set, CMake would error out saying that the _init library is
not part of the same export set.
Introduce an OUTPUT_TARGETS option that would allow projects to get
the name of the generated _init target, so they can install it if
needed.
This was already done for qt6_add_qml_module, so we just introduce the
same option for qt6_add_plugin.
Now user static plugins will have an _init target created, which will
be propagated to consumers whenever the consumers link against the
plugin itself.
We also need an internal option to disable this propagation, because
it's handled a bit differently for Qt plugins which can be linked
either via finalizers or via usage requirements.
Amends 91c65dd80c
As a result of the implementation change, cleanup example projects
to ensure that they build successfully (the important part is
specifying the CLASS_NAME).
Only plugandpaint works properly with both shared and static Qt
builds.
echoplugin works with a shared Qt build, but not a static one due to
some assumptions in the C++ code about shared plugins.
styleplugin doesn't seem to work properly neither with shared Qt
builds nor static Qt builds, at least on macOS. But it builds fine.
For some reason even if the plugin is found, the style is not applied.
Amends 4caac1feea
Pick-to: 6.2
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: I6f631cda9566229b7a63992b23d7d7fa50303eeb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Do not add catch-all header files like QtCore, QtGui, etc. to
precompiled headers for targets that already define their own set of
precompiled header files.
This reduces the size of the precompiled headers and brings the pch file
sizes down into the region of the qmake build.
Pick-to: 6.2
Task-number: QTBUG-89122
Change-Id: I8e4d17aa6829c7d7b1aa01a01a61b6677e22c460
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Now it's possible to display a configure help screen per module with
qt-configure-module <module-source-dir> -help
Pick-to: 6.2
Fixes: QTBUG-95943
Change-Id: I7d26006246af4b38b5a2ec6deca3f45c5313afec
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This is a preparation for adding the -help argument to
qt-configure-module.bat.
Consider the call
qt-configure-module.bat path/to/qt-module -help
Internally, we called
cmake ... -P .../QtWriteArgsFile.cmake path/to/qt-module -help
which was supposed to separate the arguments and write them into
config.opt.
However, passing arbitrary arguments after "-P script.cmake" only worked
by accident and is not supported. As soon as arguments are passed that
are valid CMake arguments, like -help or -G, the CMake call would fail.
Now, we let configure.bat and qt-configure-module.bat write the
arguments as is into config.opt.in and let QtWriteArgsFile.cmake read
this file, separate the arguments and write config.opt.
Pick-to: 6.2
Task-number: QTBUG-95943
Change-Id: I80f298a2aaf55b0f79fed86320a055eb2d2b6faa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This reverts commit 64c111e10f.
The claim of the commit message, that we cannot use the gold linker,
does not seem to be true (anymore?). This is underlined by the fact
that CMake *forces* the gold linker for Android, whenever LTCG is
enabled (see Modules/Compiler/Clang.cmake as of CMake 3.21.1).
Change-Id: I90edac8555be4abdd44cd367228aeffb0d66b895
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We're passing -Oz for release builds, but that's not a flag the linker
understands when -ltcg is enabled. The build fails with:
ld.gold: fatal error: Optimization level must be between 0 and 3
Fix this by using -O2, which -Oz is based on, and -O3 for the "full
optimization" that is used for core and gui.
Pick-to: 6.2
Fixes: QTBUG-89472
Change-Id: Ie1a86888baefce5ca97026e7d635f10d2819f9f4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Pass Qt6_FIND_VERSION to components when the
find_package(Qt6 ${ver} COMPONENTS Foo) signature is used.
Create a ConfigVersion file for BuildInternals, so that BuildInternals
passes the version check.
Fix qt_configure_file to look in the _qt_6_config_cmake_dir folder for
the template file rather than Qt6_DIR, because Qt6_DIR might be
accidentally unset after a failed find_package(Qt6) call and the error
is not helpful then.
We already pass versions everywhere else when looking for
dependencies, like in ModuleDependencies.cmake.in,
PluginDependencies.cmake.in, ModuleToolsDependencies.cmake.in.
Pick-to: 6.2
Fixes: QTBUG-91737
Change-Id: Ief1da0c6f239c935385e7ce662951e85ccfdf130
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The QT_ADDITIONAL_PACKAGES_PREFIX_PATH variable was introduced to
allow specifying extra locations to find Qt packages.
The reason it was introduced instead of just using CMAKE_PREFIX_PATH
is because the Qt6 component find_package call uses NO_DEFAULT_PATH
which means CMAKE_PREFIX_PATH is ignored.
We use NO_DEFAULT_PATH to ensure we don't accidentally pick up
system / distro Qt packages.
The paths from QT_ADDITIONAL_PACKAGES_PREFIX_PATH are added to the
find_package PATHS option in the Qt6 package, each
ModuleDependencies.cmake file and some other places.
Unfortunately that's not enough to make it work for cross-builds.
Imagine the following scenario.
host qtbase, qtdeclarative installed in /host_qt
target qtbase installed in /target_qtbase
target qtdeclarative installed in /target_qtdeclarative
We want to cross-build qtlottie.
We configure qtlottie as follows
/target_qtbase/bin/qt-configure-module /qtlottie_src -- -DQT_ADDITIONAL_PACKAGES_PREFIX_PATH=/target_qtdeclarative
We expect the target QtQuick package to be found, but it won't be.
The reason is that QT_ADDITIONAL_PACKAGES_PREFIX_PATH is added to the
PATHs option, but we don't adjust CMAKE_FIND_ROOT_PATH.
Without adding the new paths in CMAKE_FIND_ROOT_PATH, CMake will
re-root the passed PATHs under the existing CMAKE_FIND_ROOT_PATH,
which is QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX, which evaluates to
/target_qtbase. There is no QtQuick package there.
To fix this, prepend the values of QT_ADDITIONAL_PACKAGES_PREFIX_PATH
to CMAKE_FIND_ROOT_PATH.
The location where we currently do CMAKE_FIND_ROOT_PATH manipulations
is in the qt.toolchain.cmake file, so to be consistent, we prepend the
new prefixes there as well.
We need to adjust both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH,
due the path re-rooting bug in CMake.
See https://gitlab.kitware.com/cmake/cmake/-/issues/21937 as well as
the existing comment in qt.toolchain.cmake marked with
REROOT_PATH_ISSUE_MARKER.
We also need to do a few more things to make the setup work
Because Qt6Config uses NO_DEFAULT_PATH, the CMAKE_PREFIX_PATH
adjustments we do in the toolchain file are not enough, so we still need
to add the same prefixes to the Qt6Config find_package PATHS option.
One would ask why do we need to adjust CMAKE_PREFIX_PATH at all then.
It's for find_package(Qt6Foo) calls to work which don't go through
the Qt6Config umbrella package.
To make the CMake re-rooting behavior happy, we need to ensure the
provided paths are absolute.
So we iterate over the values of QT_ADDITIONAL_PACKAGES_PREFIX_PATH,
to make them absolute. We do the same for the environment variable.
We need to append lib/cmake to the prefixes which are added to
CMAKE_PREFIX_PATH, otherwise the CMake re-rooting bug is hit.
We need to specify the Qt6 package location (${_qt_cmake_dir}) to the
PATHS option in the various Dependencies.cmake.in files, to ensure
that dependency resolution can jump around between the Qt6 dir and
the additional prefixes. Previously the dependency lookup code assumed
that all dependencies would be within the same prefix.
The same is needed for qt and qml plugin dependency lookup.
Amends 7bb91398f2
Amends 60c87c6801
Amends 5bbd700124
Pick-to: 6.2
Fixes: QTBUG-95854
Change-Id: I35ae82330fec427d0d38fc9a0542ffafff52556a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This is just a minor optimization.
Pick-to: 6.2
Change-Id: Icf0fc615895e1def63c57a72694c89f7ae7ee5cf
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
_<module>_MODULE_DEPENDENCIES variable in the
<module>Dependnecies.cmake should only contain the list of targets that
module depends on, but not versions. Version of the first module
appears in the list because of the regression introduced in
425ff34aa1
Amends 425ff34aa1
Pick-to: 6.2
Change-Id: Iaa42120af6bac742bdf0f8d389bd8e5bdef9c1d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Installing extracted metatypes json files for user projects was an
oversight. We shouldn't install anything on behalf of user projects,
but rather give them enough information so they can do it the
themselves.
Make all the install options of qt6_extract_metatypes internal,
change the behavior not to install the files by default, unless
__QT_INTERNAL_INSTALL is passed, which is used for the Qt build only.
__QT_INTERNAL_NO_INSTALL is now a no-op and should be removed from
projects.
This is behavior change for existing public API, but it's better to
fix this now before 6.2.0 release.
Introduce a new OUTPUT_FILES option to allow assigning the extracted
metatype file paths into a variable that the project provides.
The project can then install the files where they need them.
[ChangeLog][CMake] qt6_extract_metatypes does not install metatypes
files anymore. Instead the OUTPUT_FILES option can be provided to get
the list of extracted files for further processing.
Pick-to: 6.2
Task-number: QTBUG-95845
Change-Id: If5dd0255a5fea2b598e15118c29ec2ab2ba4324e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This will show packages that were found (or not) with
find_package(QUIET) in summary just before the configure summary.
It's useful for CI logs to determine whether some Qt packages was not
found when cross-compiling.
Pick-to: 6.2
Change-Id: Ic7d5062cf061f7c60b5c74374f957065dd8029f5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Let find_package(Qt6 COMPONENTS LinguistTools) for a cross-compiled
Qt fall back to search LinguistTools in the host Qt.
Use the same trick as in QtModuleDependencies.cmake: Prepend both
CMAKE_PREFIX_PATH and CMAKE_FIND_ROOT_PATH with the QT_HOST_PATH
(respective ${QT_HOST_PATH}/lib/cmake).
Furthermore adding ${QT_HOST_PATH}/lib/cmake to PATHS argument
makes sure that find_package will work even with NO_DEFAULT_PATH.
Make sure not to match ShaderTools and Tools packages.
ShaderTools is the cross-compiled package, the host package name is
ShaderToolsTools.
Tools is the cross-compiled module from qttools.
Allow an opt out via a QT_NO_FIND_HOST_TOOLS_PATH_MANIPULATION
variable in case that we accidentally match more packages ending in
Tools that are actually cross-compiled packages.
Pick-to: 6.1 6.2
Fixes: QTBUG-95602
Change-Id: Ib0a787716fa529e36f22356da069e705d9eed5fa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The CFBundleLongVersionString Info.plist entry has been deprecated and
removed from Apple documentation for a long time now.
Remove it.
Pick-to: 6.2
Task-number: QTBUG-95838
Change-Id: I4e4f74e00d678fd67875976c8884a80cdbb8cec4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The value of QT_UIKIT_SDK is used in configure tests via
qt_config_compile_test -> qt_get_platform_try_compile_vars.
Up till now QT_UIKIT_SDK was only available in qtbase only.
Save the value in BuildInternals to ensure it's used for other repos
as well.
Change-Id: I46f372267782f1c8e7d48c237fe0264ac72d33bb
Pick-to: 6.2
Task-number: QTBUG-95838
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Automatically set the CMAKE_OSX_SYSROOT and CMAKE_OSX_ARCHITECTURES
values with the ones Qt was configured with, when configuring a user
project with the Xcode generator and a single arch / sdk Qt build.
This ensures that calling xcodebuild from the command line chooses the
correct architecture and SDK when building the project.
Allow to opt out of this behavior by passing
QT_NO_SET_OSX_ARCHITECTURES and QT_NO_SET_OSX_SYSROOT.
Amends 55a15a1c1b
Amends a6a3b82ffb
Pick-to: 6.2
Task-number: QTBUG-95838
Change-Id: Ifab16e9eee3100a9b80a2a14b3ea29ba8d9aa6fc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The configure summary now suggests "ninja install" for Ninja
Multi-Config builds, because "cmake --install ." does not install all
configurations. See CMake upstream issue #21475.
Pick-to: 6.2
Change-Id: Ie3129a906945db9d09c6772ce66ec7239797b8fc
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Passing -DFEATURE_developer_build=TRUE did not add the define
QT_BUILD_INTERNAL to src/corelib/global/qconfig.h like
-DFEATURE_developer_build=ON would.
This happened, because the feature evaluation in
qt_evaluate_feature_definition did a string comparison against "ON".
Normalize both sides of the string comparison, and thus support all
booly values for features.
Pick-to: 6.2
Fixes: QTBUG-95732
Change-Id: Ibf03579c05919b35219438361fc93676b7cca7cc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When building Qt for Android on Windows, the precompile_headers test
failed if the source directory was passed as absolute path without drive
letter. See CMake upstream issue #22534.
Work around the CMake issue by ensuring that the path is properly
prefixed with a drive letter.
Pick-to: 6.2
Fixes: QTBUG-95652
Change-Id: I3154b6c0bb2f53533306227074b24fbbf5973b05
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The workaround of adding a drive letter to
QT_CONFIGURE_PREFIX_PATH_STR should be done when running on any
Windows host, not only when targeting Windows.
Amends 59c3be7117
Pick-to: 6.1 6.2
Task-number: QTBUG-87580
Change-Id: Ic6ca50aa58a4a54fb483e90fe61a907fe86cb002
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Debug tools are excluded from the ALL target for debug_and_release
builds. However, when using the -separate-debug-info option, the same
exclusion wasn't being applied for their dSYM INSTALL commands,
resulting in a CMake install error.
Pass any additional install args like
EXCLUDE_FROM_ALL COMPONENT "ExcludedExecutables"
to the installation rules of qt_enable_separate_debug_info and
install dSYMs for executables per-config in a multi-config build.
All the non-main config executable install rules are optional because
the non-main config executables are excluded from ALL.
Amends 5b136abd21
Pick-to: 6.2
Fixes: QTBUG-93999
Change-Id: I95c3ce28215c3ee535551e4b7a5fa9731f8f1c28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
So that those values are used when configuring other repos in a
per-repo build arrangement.
Pick-to: 6.2
Change-Id: I5ff86260116c52afc87d7fcd5cbd047fcb9dde22
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The logic for linking plugins in a static build in Qt6*Plugins.cmake
looks up plugins that are named Qt6*PluginConfig.cmake, and the file
name is computed by the target name.
Not naming the target 'Plugin' therefore means it won't be picked up
in static builds.
Pick-to: 6.2
Task-number: QTBUG-95731
Change-Id: Ic83a29d7c91492c302eb413a69577a0c550e1a1b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
After introducing the _qt_module_has_headers target property, it's
better to replace the INTERFACE_MODULE_HAS_HEADERS use by
_qt_module_has_headers since properties duplicate each other.
Pick-to: 6.2
Change-Id: I4d62ed71b8ed8263f51d8575628693122580b4a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
There can be cases where trying to incrementally rebuild an already
built Qt will cause a ninja dependency cycle error due to incorrect
dependency information created by AUTOMOC and AUTOUIC.
Example error when building qtscxml tests
ninja: error: dependency cycle:
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp
->
auto/scxmlcoutput/default/ids1.h ->
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen ->
auto/scxmlcoutput/default/CMakeFiles/tst_scxmlcoutput_default_autogen
->
auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp
Example error when building Qt Creator
ninja: error: dependency cycle:
src/shared/help/shared_help_autogen/include/ui_filternamedialog.h ->
src/shared/help/shared_help_autogen/timestamp ->
src/shared/help/shared_help_autogen/include/ui_filternamedialog.h
Warn and advise to use a different CMake version instead.
Pick-to: 6.1 6.2
Change-Id: I6f529ba6a526663bc6ed699b1bfe8a9094129887
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In top-level builds, when configuring qtsensors, the directory of
FindWMF.cmake isn't in ${CMAKE_MODULE_PATH}, this makes CMake couldn't
find WMF.
On Windows, QtMultimedia requires WMF. If WMF couldn't be found,
QtMultimedia will also be treated as NOT FOUND.
QtSensors has an optional dependency to QtMultimedia. If QtMultimedia
couldn't be found, CMake will warn.
Copy Find*.cmake to ${QT_BUILD_DIR}/lib/cmake/Qt6, to make sure these
files could be found by CMake.
Fixes: QTBUG-95655
Pick-to: 6.2
Change-Id: I87d14c9a7becd0ec493e00c297b2e01fc0ad0f96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Address TODO and use the new helper
__qt_internal_propagate_object_library function instead of
target_sources when linking static plugin initializers via usage
requirements.
Note that to work correctly this depends on using the
target_link_options object library linking approach, which means a
minimum CMake version of 3.17, which is already the case for static
Qt usage.
With CMake 3.21, it will use target_link_libraries approach instead.
With CMake version 3.16 or lower, currently, this won't work correctly
on Linux if there are dependencies wrapped in genexes because the
__qt_internal_propagate_object_library call will try to use
the still-by-default-enabled 'object_libraries' finalizer mode via
__qt_internal_collect_dependency_object_libraries and that stops
the usage of the target_sources approach to link the object files
directly.
This isn't a big deal though, because we already require CMake 3.20
as the minimum.
It might be a bigger deal if we will need any of this functionality
to work with 3.16 in shared Qt builds where the user project tries
to create and link against custom static plugins. But that's already
likely to be a can of worms even without this specific edge case.
Amends a37957df5c
Amends 91c65dd80c
Uses 3329212815
Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I8710e79eee265d820f65c8ccc3d0bd0c0ee6eccd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
qt6_enable_object_libraries_finalizer_mode is not needed anymore
now that static Qt builds require CMake 3.21 and thus CMake takes
care of placing object library object files at the beginning of
the link line.
Rename qt6_enable_import_plugins_finalizer_mode to a more generic
qt6_set_finalizer_mode that can enable or disable multiple
different modes.
For now the only available mode is "static_plugins" which handles
the behavior of the old function name.
The mode can be enabled by calling
qt6_set_finalizer_mode(${target} ENABLE MODES "static_plugins")
Note that the function is re-tagged as being in Technical Preview.
Ideally we would not need it at all. But we need to provide some
workaround for the limitations of linking Qt static plugins in CMake
on Linux-y platforms that use bfd ld or ld.gold.
The workaround does not work well with dependencies wrapped in
generator expressions which is why we can't confidently advertise it
as a proper solution.
Our hope is that this can be fixed in future upstream CMake versions
and the function can be removed.
See 6fcc272ac9 for details.
Adjust the tests due to the renamed and removed functions.
Amends 19e789bace
Amends cdbb390c4a
Amends a25027eecb
Amends 6fcc272ac9
Amends a3c430f390
Pick-to: 6.2
Fixes: QTBUG-95169
Task-number: QTBUG-95601
Task-number: QTBUG-95603
Change-Id: I51b85f776ec29fc04fed1a637eba7d1f60609e69
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When CMP00126 is set to NEW, set(CACHE) doesn't remove regular
variable bindings with the same name as the cache variable.
This introduced an issue in qt_find_package, which called
find_package(CONFIG QUIET) to try and find a package config file, but
did not clean up the non-cache _FOUND variable which is automatically
set to 0 by CMake if no Config file is found.
Make sure to unset both the regular and cache _FOUND variables if either
the package config file was not found, or if none of the provided
targets found even if the Config file was found.
Also move the _DIR cache variable cleaning into the same code block.
Amends 4c31ce68d5
Amends 34b1c1c23c
Fixes: QTBUG-95635
Pick-to: 6.2
Change-Id: I871987217526e0f0a20038a8da52625838e49488
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
CMake master / 3.22 introduced a behavior change in how conditions are
evaluated in the while command. It is now consistent with how if()
evaluates conditions.
This caused an issue in Qt code where a "(" opening parenthesis was
evaluated as part of the condition rather than as a string.
Fix this by wrapping the evaluation of the variable in quotes.
Pick-to: 6.1 6.2
Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
The -coverage argument merely added compiler flags for the Qt build. It
was never properly ported to the CMake build, and it doesn't seem
feasible to have configure arguments for every possible compiler option.
The same can be achieved by passing the needed compiler option to CMake,
for example: CMAKE_CXX_FLAGS=-fsanitize-coverage=trace-pc-guard
Pick-to: 6.2
Fixes: QTBUG-86227
Change-Id: Ieef9acaedc0a839f9fb35b4403395eea28643864
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The intention is to remove TYPE as a keyword completely before 6.2.0
release, but in case if that's not possible due to the large amount
of repositories and examples, just print a deprecation warning for
now and handle both TYPE and PLUGIN_TYPE.
Task-number: QTBUG-95170
Pick-to: 6.2
Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When Qt5Config.cmake was ported to Qt6, the assignment of
_Qt6_FIND_PARTS_QUIET was accidentally left out.
Make sure that when find_package(Qt6 QUIET COMPONENTS Foo) is
called, the underlying component find_package(Qt6Foo) call gets
a QUIET option as well.
This will silence short-form warnings like
-- Could NOT find Qt6Foo (missing: Qt6Foo_DIR)
It currently won't silence any warnings produced by the transitive
find_package calls in QtModuleDependencies.cmake. That will require a
separate change.
Remove usage of _Qt6_FIND_PARTS_REQUIRED which was always empty.
See details of QTBUG-95573 why it's currently not used.
Pick-to: 6.2
Task-number: QTBUG-95573
Change-Id: I3822c068eecbe84c306a1b04f4187278d35ec3d5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Provide better error messages when a Qt package / component is not
found.
Mention the location of the expected Config file on the file system,
whether it exists
Also mention the location of the Config file that was specified by the
user when configuring the project or which CMake computed and stored
in QtModule_DIR cache var.
Mention that a package is not found in case if the main target exposed
by that package is not found.
If the target is not found, mention that it might be due to
QT_NO_CREATE_TARGETS being set to TRUE (when it is set to true).
If it is set to true, the assumption is that the target must have been
defined by something else before the find_package call (either an
earlier find_package call without QT_NO_CREATE_TARGETS set to TRUE or
maybe it's the use case of Qt being built together with its examples
or it's a super build).
Unset _Qt_NOTFOUND_MESSAGE to ensure that the Qt6 not found error
message is not spilled into any subsequent find_package(Qt6) calls,
causing a cascade of unwarranted warnings / errors.
Make sure to unset it only if components were specified, so the
message is not shown or unset in any of the recursive
find_package(Qt6) calls which is a dependency for regular Qt module
packages.
This works fine, because find_package(Qt6) calls with components are
only done in project code and not done by the transitive dependency
code (which looks for Qt6Foo packages directly).
Remove some dead code.
Pick-to: 6.2
Task-number: QTBUG-95532
Change-Id: Ie93d18e25e33aa0fe9e9da9a60e3d3e4cd6adb58
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This function is called by qt_add_executable. There is no need to
expose it as public function.
Fixes: QTBUG-95172
Change-Id: I85a1d906ecda42458e226db225e47c1d348a72f1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This change introduces new behavior to error out when configuring user
projects if the CMake version used is too old for Qt to work with.
The main motivator is the requirement of new CMake features to ensure
object libraries are placed in the proper place on the link line in
static builds.
The minimum CMake version is computed based on whether Qt was
configured as shared or static libraries.
At the moment the required versions for building and using Qt are the
same.
The minimum versions are defined in qtbase/.cmake.conf in the
following variables
QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED
QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_STATIC
QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED
QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC
Qt Packagers can disable the version check when configuring Qt
by setting
QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT and
QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT.
In this case it is the packagers responsibility to ensure such a Qt
works correctly with the specified CMake version.
User projects can also set QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT
to disable the version check. Then it's the project's developer
responsibility to ensure such a Qt works correctly.
No official support is provided for these cases.
Implementation notes.
The versions required to build Qt are stored in
QtBuildInternalsExtra.cmake
whereas the versions required to use Qt are stored in a new
QtConfigExtras.cmake.
Also the policy range variables stored in
QtBuildInternalsExtra.cmake are now regular variables instead of cache
variables, to properly allow overrides per-repository.
Some renaming of functions and variables was done for a bit more
clarity and easier grep-ability.
Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: I4279f2e10b6d3977319237ba21e2f4ed676aa48b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Building a static library Qt configuration will now require a
minimum CMake version of 3.20.
Qt builders and packagers can still opt out of the mentioned minimum
required version by configuring Qt with QT_FORCE_MIN_CMAKE_VERSION.
Such a Qt configuration is /NOT SUPPORTED/.
To facilitate these changes, the minimum version check has been moved
to happen after the BUILD_SHARED_LIBS option is computed by either
QtAutoDetect.cmake or set by a user provided cmake toolchain file.
Introduce a new QT_MIN_SUPPORTED_CMAKE_VERSION_FOR_STATIC_QT variable
in .cmake.conf to mark the minimum version for a static Qt build.
Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Idc1875729f26a7c635b6bd26ac0c1be973917c13
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
The format was renamed in 27db9e458c.
Pick-to: 6.2
Change-Id: I53975c7467d8768dc9dc9ac2d89c42eefa12e22f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
If Vulkan headers are present on the system when qtbase is configured,
QtGui and QtOpenGL should be compiled with Vulkan support.
If a user project uses a Qt built with Vulkan support, but their system
is missing Vulkan headers, the project configuration needs to succeed.
The project will get compilation errors if it uses Vulkan headers, but
that's intended.
This use case was broken when fixing Vulkan to be found when building
Qt for Android.
Fix the regression with a combination of things
1) Mark the WrapVulkanHeaders package as optional (already the case)
2) Use the include directories directly when compiling Gui and OpenGL
3) Propagate WrapVulkanHeaders::WrapVulkanHeaders link requirement to
consumers only if the target exists. It won't exist if Vulkan
include dirs are not found
This also requires some changes in pri and prl file generation.
For prl file generation, we don't want to link to the
WrapVulkanHeaders target, so we filter out all dependencies that
use TARGET_NAME_IF_EXISTS for anything that calls
__qt_internal_walk_libs which includes qt_collect_libs.
For pri files, we make sure to generate a uses=vulkan/nolink clause
by inspecting a new _qt_is_nolink_target property on the target.
We also don't add include dirs to the pri file if the new
_qt_skip_include_dir_for_pri property is set.
This is intended for Vulkan, because there is separate qmake logic to
try and find the include dirs when configuring a user project.
As a drive-by, fix nolink handling for WrapOpenSSLHeaders.
Amends bb25536a3d
Amends 7b9904849f
Pick-to: 6.2
Fixes: QTBUG-95391
Change-Id: I21e2f4be5c386f9e40033e4691f4786a91ba0e2d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This fixes building Qt with Vulkan support on macOS which aside from
the regular Vulkan headers also needs the location of the MoltenVK
headers.
This assumes the usage of the LunarG Vulkan SDK for macOS.
Pick-to: 6.2
Fixes: QTBUG-80576
Change-Id: I030b2fdeaafdd7bf5ebe6fb4c9ea860917e84056
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Building a shared library Qt configuration already required a minimum
CMake version of 3.16, because we depend on CMake's Autogen.json files
which are used for metatype.json file generation.
If a lower version was used, a FATAL_ERROR was issued in
qt6_extract_metatypes.
This change is essentially moving the check to happen earlier in the
qtbase configure process.
User projects will now /also/ officially require a minimum of 3.16
(up from 3.14).
As a consequence, the min/max version policy range that is set in
the public QtFooConfig.cmake files is changed
from 3.14..3.19
to 3.16..3.20
The upper bound is raised because building and using Qt works fine
with all CMake 3.20 policies set to NEW.
[ChangeLog][CMake] Building Qt as shared libraries now requires
CMake version 3.16 or later. Building user projects with CMake using
that Qt installation also requires a CMake version of 3.16 or later.
Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: I77d2829370f1dfc90b4071bebc8a3ade654e59e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Quote the paths after "-L".
Get MSVC’s implicit link directories from $ENV{LIB}.
Fix some issues cause by Inconsistent case.
Amends 2c49f85380
Fixes: QTBUG-95198
Pick-to: 6.2 6.1
Change-Id: Ie82f10b088e2764396377726340509f24a4ae8e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Remove copying of json files in non-prefix builds.
Previously, this was done to mimic the directory layout of prefix
builds in a non-prefix build, but the extra complexity is not worth
it.
Keeping the files in the build directories of each repo in a
non-prefix build should be good enough.
As a result, we don't need to distinguish which file path should be
passed in INTERFACE_SOURCES. Now we have only 2 paths to consider, the
BUILD_INTERFACE one and the INSTALL_PREFIX one, rather than 3
different paths.
Move the code that handles installation closer together.
Rename the internal COPY_OVER_INSTALL option to
___QT_INTERNAL_NO_INSTALL.
We might want to expose it as a public option later, but it depends on
whether we will disable default installation for user projects.
Remove assignment of some properties that are not used anymore.
Amends c431e2d33c
Pick-to: 6.2
Task-number: QTBUG-94942
Change-Id: I3a26d1988987b2ce7c7d01d2311c13b3da3175a8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
All internal libraries, plugins, object libraries (resources, plugin
initializers) need to be built with bitcode flags when targeting iOS.
Internal here means all libraries added by qt_internal_add_X
functions or associated with internal libraries.
We didn't do that for plugin initializers, which were added not too
long ago.
Extract the logic that links to Qt::PlatformModuleInternal into a
separate function to be used for object libraries.
Use it for resources and plugin initializers. It will also be used
in qtdeclarative for qml plugin initializers.
Pick-to: 6.2
Task-number: QTBUG-95208
Change-Id: I366996078f5e9d1c2d2797f6b81c522ee99529e3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Both the compiler and linker -fapplication-extension flag should only
be applied when building Qt's libraries (not executables).
It's up to the user project whether their code will be restricted with
application-extension-only APIs.
In qmake that can be achieved by adding to the qmake project
CONFIG += app_extension_api_only
In CMake it can be achieved by either adding the compiler and link flags
in the project directly (using target_X_options) or by setting the
appropriate setting in the Xcode project when using the Xcode
generator.
Amends e189126f1a
Pick-to: 6.2
Task-number: QTBUG-95199
Change-Id: Ie7a764d460a89c7650391abff0fcc5abfcabef64
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We shouldn't force add the bitcode linker flags to user projects.
And we don't link anything when building Qt for iOS itself, we only
archive object files into static libraries.
The final decision whether bitcode should be used is up to the Xcode
project. That is controlled by Xcode's ENABLE_BITCODE option.
Bitcode compile flags are still added when building Qt itself.
Amends a046833176
Pick-to: 6.1 6.2
Task-number: QTBUG-95199
Change-Id: I04c77f659b82269bb8010ea262b2e51f36e9def3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This was the case in Qt 5.15 as well.
The CMake toolchain file that Qt's CI is using is already setting
BUILD_SHARED_LIBS to OFF, but it's better to be explicit like we
are with WebAssembly and iOS.
Pick-to: 6.2
Change-Id: Ief17259c15690a97337e9df451663718601c2a52
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Otherwise it will confusingly only list the host arch
Pick-to: 6.2
Change-Id: Ic6d080f1fd9ebfa260ce7c35bd5e5b4ee686f083
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The correct variable to check is WIN32, not WINDOWS.
Amends 85e25d93b3
Pick-to: 6.2
Change-Id: I4570eb5a124bcaa0bd38135dd7c7f48345c40c9d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
For internal modules we should keep the name of the file in file system
consistent with previous Qt versions.
Pick-to: 6.2
Fixes: QTBUG-95077
Change-Id: I02e4fced0fc3172e60f07bc7d1515e23744db567
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
qt_config_linker_supports() repeated the conditions of all use_*_linker
features, because the features are not evaluated yet when this function
is called, and the function needs to know what linker is used to build Qt.
Move the required tests and features before any
qt_config_linker_supports() call and evaluate the use_*_linker features
early.
Change-Id: I306f032356682a0e82e4d7c4234e5bbc820ab143
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Since platform definition directory is used as an interface include
path of the Qt::Platform target, it makes sense to define it for this
target only. Also the definition of cached values that contain
path to platform definition looks redundand.
The definition of QT_PLATFORM_DEFINITION_DIR from command line
doesn't make any sense since build procedure doesn't take it into
account when installing mkspecs and the use if the user-provided
QT_PLATFORM_DEFINITION_DIR value as a Qt::Platform include directory
causes inconsistency in the prefixed builds. INSTALL_MKSPECSDIR
and QT_QMAKE_TARGET_MKSPEC should be used instead.
Change-Id: I3636c57b835cb84511a358a0910cc482c5fbd81e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Repositories have been changed to be free of this warning. We're now
changing the default of QT_WARN_PLUGIN_PUBLIC_KEYWORDS to ON.
Set this variable to OFF to disable the warnings.
Pick-to: 6.2
Change-Id: Ie37a4df1032f5b1e9152d970e8a14c574ed70241
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously, if a feature was marked as not to be emitted and there was
no user provided value for that feature, the build system would still
save the user provided value in FEATURE_foo with a value of ON (if the
conditions were met).
After a reconfiguration, the build system would hit the code path that
checks if the user provided a value for the non-emitted feature, and
would then warn about it and reset the feature value to OFF.
This would cause errors when reconfiguring a user project, complaining
that a feature value has changed.
Make sure to not save the user provided value for a non-emitted
feature and to always set its internal feature value to OFF.
Amends c4f5762b20
Pick-to: 6.2
Fixes: QTBUG-94921
Change-Id: I257c7fd795c8a6aeba3348cb72522e4f0b006dc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Rename various functions and variables to hopefully make the behavior
of feature evaluation clearer.
The previous names like 'set_value' or 'set_cache_value' or 'cache'
were too generic and unclear. One would have to carefully read the
code to understand what was actually set.
Add some doc comments about what FEATURE_foo and QT_FEATURE_foo
represent.
Amends c4f5762b20
Pick-to: 6.2
Task-number: QTBUG-94921
Change-Id: Ie6a7b83a4d54a83976b2706d4af82b39832d79f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
If Qt was configured with -static-runtime which implies MultiThreaded
-MT flag, the plugin initializer object libraries were still compiled
with the default -MD flag.
When an application linked to Qt, that caused linking to fail with
mismatched symbol errors between the application symbols and the
plugin initializer object library symbols.
Make sure to set the MSVC_RUNTIME_LIBRARY property on both plugin
initializer and resource object libraries, depending on the value of
QT_FEATURE_static_runtime.
We did set the property for resources added by
qt_internal_add_resource, but not for the resource created by
the public qt6_add_resources counterpart.
Pick-to: 6.2
Fixes: QTBUG-95043
Change-Id: Ia543cd0241db94a12080be2655ad420fe9ad3f24
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In a -debug-and-release build, apps were placed under bin/Release
rather than just bin.
Apply the logic we use for tools for apps as well. Rename and move
the common functions into QtTargetHelpers.cmake.
Pick-to: 6.2
Fixes: QTBUG-95028
Change-Id: I5a9082ea50c9238c8fcf0c6dd099708fbc571bf8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Make QT_USE_BUNDLED_ INTERNAL to hide them from GUI like QtCreator's
CMake configurator.
Pick-to: 6.1 6.2
Change-Id: Id9dcee31c69b579bbe38611cabb98e46550b0e89
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In our *AdditionalTargetInfo.cmake we now set above target properties
for shared libs only, not executables.
IMPORTED_IMPLIB is only set for Windows.
IMPORTED_SONAME is only set for non-Windows platforms.
Pick-to: 6.2
Change-Id: If7f01e6bf5183cca0ac90f9afffd57c41b34dccd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Building a CMake project with CMAKE_BUILD_CONFIG=Debug was broken for
non-prefix debug-and-release builds of Qt.
In debug-and-release builds we set EXCLUDE_FROM_ALL on tools in the
Debug configuration. In non-prefix builds we export(EXPORT) targets, and
that also contains the non-existent Debug variants of the tools. In
prefix builds, we install(EXPORT) instead, which only exports what is
built and installed.
Consequently, we now remove the DEBUG-related import information if the
debug variant if the target binary does not exist.
Pick-to: 6.2
Fixes: QTBUG-95027
Change-Id: I37766d5ab1e2795bcb91a348e7e72150e8a00f82
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QT_BUILD_DIR should be used instead of CMAKE_BINARY_DIR as a base
directory for platform definition when building a non-prefixed
build since artifacts are copied to qtbase directory for top-level
build.
Amends 478f5fcde6
Pick-to: 6.1 6.2
Task-number: QTBUG-94973
Change-Id: I5cce16fdc7f760b954222ae67a4b85d4beea7f13
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Change the default installation prefix to C:/Qt/Qt-${version} on Windows
and /usr/local/Qt-${version} elsewhere.
This is what's expected by users coming from Qt5, and setting the
installation prefix to "/usr/local" manually is easier than setting the
versioned variant "/usr/local/Qt-6.2.0".
[ChangeLog][Build System] The installation prefix now defaults to
/usr/local/Qt-${version} and C:/Qt/Qt-${version} like it did in Qt 5.
Fixes: QTBUG-91632
Pick-to: 6.2
Change-Id: I8ce57b1b18084c705b194c776e038cc807a6ed5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The following host-related configure options were unsupported since Qt
6.0 and are now completely removed:
-hostprefix
-external-hostbindir
-host*dir (except -hostdatadir)
-android-ndk-host
Pick-to: 6.2
Change-Id: Ib69d90c40ef546f61bf87b1f443eb9d10f7a5a21
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Platform definition directory is defined when building qtbase.
Depending on the build type (prefixed/non-prefixed) it should point:
- To the source directory when building prefixed qtbase.
- To the installation directory of the prefixed qtbase when building
consumer projects.
- To the build directory of non-prefixed qtbase when building
non-prefixed qtbase or consumer projects.
TODO: It is desirable to move the logic asssociated with Qt platform
definition to the qt_internal_setup_public_platform_target function.
Pick-to: 6.1 6.2
Fixes: QTBUG-94973
Change-Id: I8530613f9b2029834c66206bbdf02475528a4640
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Our only way to detect whether the user requests an Android build of Qt
was to peek into the CMake toolchain file if it is specified. If the
toolchain file contains a certain magic string, we decide that we're
building for Android.
This approach is fragile and bound to break should the Android toolchain
file's magic string ever change.
Now, we assume an Android build if any of our ANDROID_* cache variables
is set. In that case, we do not peek into the toolchain file.
Pick-to: 6.2
Fixes: QTBUG-94955
Change-Id: Ie2f0ac0963f90f09805e311111bb6912d4325ada
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
target_link_options are placed by CMake at the beginning of a linker
line. This gives us an opportunity to use the function to propagate
object libraries. This change adds one more check in the root
Config.cmake file. If CMP0099 policy is enabled, CMake enables
propagating of the linking options when linking two static libraries
using the PRIVATE linking visibility, so we can rely on the correct
linking order and expect object libraries to be propagated.
Note that on the platforms where cmake version is higher than 3.16
Qt uses CMP0099 NEW in functions like qt_add_executable. This means
that at the moment of creating an executable target the TARGET_POLICY
genex will also be NEW, so we do not take into the account the user
defined CMP0099.
If the CMP0099 policy is not available for a certain CMake version
we skip the TARGET_POLICY check and simply disable propagation of
the object libraries using target_link_options for both user and Qt
libraries. This is applicable for the CMake versions 3.16 and less.
Linking approaches have the following priorities(from higher to lower)
after this change:
- target_link_libraries - works if link order matters not or CMake
version greater equal 3.21.
- target_link_options - works if CMP0099 is set to NEW by user or
if the CMake version is greater than or equal to 3.17 and an
executable is created using Qt functions.
- object library finalizer - works if CMake version is greater equal
3.19 or qt6_finalize_target is called explicitly.
- target_sources - is used when all the other approaches could not
be used.
Amends a1fd4f51ad
Amends 3329212815
Pick-to: 6.2
Change-Id: I14f88caeb04e357191c840abeab89b03e210b796
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This reverts commit 7c62caa355.
Certain toolchain files cannot be read in CMake script mode with CMake
versions >= 3.20.
For example, the vcpkg toolchain file overrides add_executable, and
that fails with CMake 3.20:
CMake Error at D:/dev_tools/vcpkg/scripts/buildsystems/vcpkg.cmake:662 (function):
Built-in flow control command "add_executable" cannot be overridden.
Pick-to: 6.2
Fixes: QTBUG-93627
Change-Id: Ib6e6352dff50b9684dcf81401d138e27e16292c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Introduce two new packages WrapVulkanHeaders and WrapVulkan similar to
the OpenSSL wrapper packages.
WrapVulkanHeaders uses FindVulkan and is marked as found if Vulkan
headers are found (that's the only part the Qt build requires).
The WrapVulkan package is currently not used, but is there for
symmetry.
The Vulkan feature is now disabled by default on QNX, because the
QNX toolchain file in the CI does not set
CMAKE_FIND_ROOT_PATH_MODE-like variables and CMake ends up finding
host Vulkan headers causing the build to break.
Pick-to: 6.2
Fixes: QTBUG-92157
Change-Id: I05309821f866456cd42e7f85bf8b76ba099df656
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Specifying the variables as required variable will show the found
paths in the configure output.
Pick-to: 6.2
Task-number: QTBUG-94355
Change-Id: I985a3585f37b38e25b6be4fae5d42c82e06517de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Ensure that the finalizer approach of
__qt_internal_propagate_object_library considers $<LINK_ONLY:>
libraries when traversing the dependencies of a target.
The issue was discovered when using the Quick.Shapes QML module in a
static build. The module has both a backing library and a plugin.
The backing library has some resource objects associated with it.
When the targets are exported, the plugin INTERFACE_LINK_LIBRARIES
has a $<LINK_ONLY:QuickShapes> dependency.
This ensures that the library will be linked, but depending on which
linking approach in __qt_internal_propagate_object_library is used,
the resources might not be linked to the final executable.
The resources are linked correctly when using the
target_link_libraries approach, but not when using the finalizer or
target_sources approach.
This change fixes the finalizer approach, but the target_sources
approach is still broken.
Amends a1fd4f51ad
Pick-to: 6.2
Change-Id: Ifbb91a17d388c3dc4263e17ec0d3bd5627b57cb4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If user specifies non-existing platform build fails in some non-obvious
place, since qplatfromdefs.h couldn't be found.
Add an explicit error if the defined platform folder doesn't exists in
Qt sources.
Change-Id: Id847d57a6f9cc4f463e697b474b8a669cd041fb8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Ensure that Qt user projects build with sanitizer flags if Qt was
configured with any of the sanitizers enabled.
To compile Qt with sanitizer support enable any of Qt sanitizer
features.
Passing -DECM_ENABLE_SANITIZERS=address to CMake is NOT supported
anymore.
When configuring Qt using CMake directly, pass
-DFEATURE_sanitizer_address=ON
-DFEATURE_sanitizer_undefined=ON
instead of
-DECM_ENABLE_SANITIZERS=address;undefined
When configuring Qt with the configure script pass
-sanitize address -sanitize undefined
as usual.
QtConfig.cmake now records the sanitizer options that should be
enabled for all consuming projects based on the enabled Qt features.
This applies to internal Qt builds as well as well as tests an
examples.
The recorded sanitizer options are assigned to the ECM_ENABLE_SANITIZERS
variable in the directory scope where find_package(Qt6) is called.
The ECMEnableSanitizers module is included to add the necessary flags to
all targets in that directory scope or its children.
This behavior can be opted out by setting the
QT_NO_ADD_SANITIZER_OPTIONS variable in projects that use Qt and might
be handling sanitizer options differently.
Amends 7e03bc39b8
Pick-to: 6.2
Fixes: QTBUG-87989
Task-number: QTBUG-92083
Change-Id: I2e3371147277bdf8f55a39abaa34478dea4853a6
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Restores addition of 'float-divide-by-zero' to undefined sanitizer
flags as well as the custom fuzzer-no-link option.
Pick-to: 6.2
Task-number: QTBUG-87989
Change-Id: Icde1e5d31083ce1b6128ab45b0e9df5ae69736a3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add an option that automatically generates an export header for a Qt
module. The header contains only Q_DECL_EXPORT/Q_DECL_IMPORT related
content, so it's not a full replacement of 'global' header files.
Task-number: QTBUG-90492
Change-Id: I250d1201b11d4096b7e78e61cbf4565945fe6517
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In a Qt build that was configured with INSTALL_MKSPECSDIR set to
something different than INSTALL_DATADIR, the qmake property
QT_HOST_DATA was wrong. Consequently, mkspecs could not be loaded,
rendering qmake dysfunctional.
The reason was that we considered every QT_HOST_xxx property to have the
same value as QT_INSTALL_xxx in a non-cross build.
This is not true for QT_HOST_DATA, because users might want to set
INSTALL_DATADIR to "foo" but INSTALL_MKSPECSDIR to "bar/mkspecs".
Move the unused determination of the host data dir to the QtLibraryInfo
lib and handle QT_HOST_DATA specially.
Fixes: QTBUG-94591
Pick-to: 6.2
Change-Id: I2c44cda8405ff1d14391254fcd1d9b1361cb5855
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also remove handling of older versions, because we only support
Visual Studio 2019 currently
Pick-to: 6.2
Change-Id: If66a46d970047fe25582e323df74e0a904ee92da
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Go with Emscripten’s default of not shutting down on
main() exit; this allows for writing main() in such
a way that avoids the exec() workaround.
Existing main() implementations (which do use the exec()
workaround) do not shut down Qt cleanly anyway, so we
gain little by shutting down the Emscripten runtime.
Applications can set this flag if they do want to shut
down on main() exit:
LFAGS += -s EXIT_RUNTIME=1
Change-Id: I52e1cc2bc907d1d2146822713e39b7610db3f95b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
There's a number of upstream bugs that cause false positives;
do not make them errors.
Change-Id: I4151794d8d37177a47a34aef8d83accf4377d44a
Pick-to: 6.1 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make Emscripten generate a global constructor function
("createQtAppInstance()") instead of a global javascript
module object.
This enables more fine-grained control over module
instantiation; previously the module object would be
created when the runtime javascript was evaluated, and
the number of emscripten module/instances was limited
to one per page.
Set EXPORT_NAME to “createQtAppInstance” which avoids
collisions with other non-Qt Emscripten modules on
the same page. A further improvement would be to include
the app name in EXPORT_NAME, but this is not done at
this time.
Update the code in qtloader.js to call the constructor
function instead of working on a global module object.
The qtloader.js API is functional before the wasm and
Emscripten modules have been instantiated; store properties
and forward to the Emscripten module when it's created.
Change-Id: I12c49a5b9a4a932bbc46fcc5e5ecc453fd0fe7f0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
new syntax rules for EXTRA_EXPORTED_RUNTIME_METHODS valid after 2.0.16
Pick-to: 6.2
Change-Id: Iff33e4c6f3176619fb35ec0994a7cc87b5d937c7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Remove the temprotary 'Private' targets of the iternal modules.
Pick-to: 6.2
Task-number: QTBUG-87775
Change-Id: I9a2c7c8c2f63602476fd935b11dab7a835864537
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Dependency lookup mechanism is the same for modules and plugins. It
makes sense to wrap it using macro.
Pick-to: 6.2
Change-Id: I73727743b0f5f40b2d94624f65ebfcf85e8dcc59
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Check if link order matters before use the object library finalizer.
Amends 5fb99e3860
Pick-to: 6.2
Change-Id: Ie996bc175ebea36ccda1bb2fe388ae3b7fcde395
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Perform a file name of the config header before adding a '_private'
suffix.
TODO: It makes sense to revisit the use of the CONFIG_MODULE_NAME
variable since the variable is used for different purposes and
mutate with use.
Amends 8aee7c6b29
Pick-to: 6.2
Fixes: QTBUG-94568
Change-Id: Id5aaf8d423ec8b94afffe4641b54dab94b5453fb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The linking logic of object libraries should be reusable outside of the
resource context. This introduces a
__qt_internal_propagate_object_library function that prepares all the
necessary genexes to link and propagate the object library to the
end-point executable.
Rename resource object finalizer API to make the naming more generic
to object libraries of any kind.
Amends 5fb99e3860
Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I69d0f34c0dadbd67232de91035aaa53af93d1fa1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QtPriHelpers copies the logic related to the module OUTPUT_NAME to
produce a module identifier. Since the module identifier should be
equal to OUTPUT_NAME it makes sense to reuse the property and
deduplicate logic.
Amends 8aee7c6b29
Pick-to: 6.2
Fixes: QTBUG-94568
Change-Id: I8d9c04273e4cdb1a2e6a3b0db3ddf52e008c0cf7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
GCC 11.1 has a bug [1] in the preprocessor that leads to
-Wsuggest-override warnings being raised in random places, even under
pragmas that are supposed to suppress it. For some reason, NOT using the
integrated preprocessor fixes it, so add that flag as a workaround.
Also, GCC 11 introduces a family of warnings for C++20's deprecations of
mixed enum arithmetic, which we use all over the place. Avoid a hard
error for those warnings.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
Change-Id: I3b2aefa385f191f207e7eb876bc1ed0b18fb342b
Pick-to: 6.1 6.2
Task-number: QTBUG-93360
Task-number: QTBUG-94059
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The optional components arguments were not handled before which
caused the recorded package information for static builds to be
incorrect, it only recorded the package name without the component.
Remove REQUIRED_COMPONENTS TODO, there is no such find_package option,
it's already handled by the regular COMPONENTS code path.
Amends 07b6d3367d
Pick-to: 6.1 6.2
Fixes: QTBUG-94501
Change-Id: Ib48a7befcb70e20c3f21315897d51d3064b48134
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Set the correct value to the _qt_config_module_name property at the
internal module creating step instead of appending _private suffix when
generating .pri files.
Amends 425ff34aa1
Pick-to: 6.2
Fixes: QTBUG-94568
Change-Id: I6fa8089358bc638668e313c98c3aee680bf7ec2a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Needed for qtdeclarative so we can filter out which object library
should go into which export set, because qt_internal_add_qml_module
can create both a backing library export set and a plugin export set.
The plugin initializer object lib should go to the plugin export set.
Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I0fce131eff75a0b3090ac0fbb2a12ecfcba5e38d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This is needed for a change in qtdeclarative to allow building the
Q_IMPORT_PLUGIN-containing object library initializer of a qml plugin.
Show an error if the qml plugin has no class name, it's needed for
plugin initialization so it's mandatory to have a class name.
Show an error if a class name is not found when computing the import
macro for a plugin (both for a regular qt plugin and a qml plugin).
When querying for the class name of a target, query both a Qt6::
prefixed target as well as a non-prefixed one, with the Qt one
taking precedence.
This is to allow querying the class name of user project created qml
plugins.
Currently regular qt user plugins don't use the object library
initializer approach. This will likely be revisited in the future.
Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I46417471a7d8b49651e6821f7b28e7a9d44c2557
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We didn't do it in Qt 5 times and it was accidentally done for Qt 6.
There's no reason to generate them, the .pri files are only meant to
be used for regular plugins so a project can do QTPLUGINS += foo.
That mechanism is not needed for qml plugins which use
qmlimportscanner instead.
Furthermore the pri contents didn't contain a class name, so they
couldn't be used anyway.
Pick-to: 6.2
Change-Id: I6299fda21ece0f693a817ab558b45aa46b97e5ee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Remove target specific flags from static_link_order.
Move the check to the common config.tests folder.
Amends 5fb99e3860
Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I1368075ec6bd1e743b2b89fd93143df38a278ec2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Only depend on the ${project}_src and ${project}_tools targets.
This might exclude some non-obivous target dependencies, but we can
adjust that if needed.
This reduces the build.ninja file of qtbase + qtsvg form 341MB
to 41MB when configuring with tests and examples, as well as reduces
the processing time of calling ninja.
Amends d97fd7af2b
Pick-to: 6.2
Change-Id: I2860d8ae89728f33f6b73fede1335cd6d6290f78
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
For user projects we run the static link order check once
'find_package(Qt6 ...)' is called.
If linker can resolve circular dependencies between static libraries
and object files we set the _qt_link_order_matters property of the
Qt::Platform target. This indicates the use of finalizers is not
required and we may rely on CMake-base propagation of resource
libraries and resource object files.
If linker could not resolve circular dependencies depending on
the _qt_resource_objects_finalizer_mode value:
- Finalizer will be called and collected resource objects will be
linked to the target directly.
- Finalizer will be omitted and resource objects will be linked
using the target_sources function implicitly. This only
propagates resource one level up if consumer links the static
library PUBLICly, but all symbols will be resolved correctly
since object files are placed in the beginning of the linker line.
In the CMake version 3.21 we expect that CMake will take care about
the order of the resource object files in a linker line, it's
expected that all object files are located at the beginning of the
linker line.
TODO: Need to confirm that the CMake 3.21 meets the expectations.
Amends 4e901a2f99
Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: Ia68976df8182d3d3007b90c475c1e3928a305339
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
CMake 3.21 introduced a new IMPORTED_TARGETS directory property which
we can use to promote all imported targets within a scope to be
global.
This would cover transitive non-Qt imported targets which the Qt build
system does not know about and is thus a more complete solution
compared to promoting only Qt targets.
Run a finalizer at the end of the directory scope where
find_package(Qt6) is called to promote all imported targets within
that scope to global (when requested).
The old promotion method is disabled when the CMake version is new
enough.
Pick-to: 6.2
Task-number: QTBUG-92878
Task-number: QTBUG-94528
Change-Id: I533a3bd4186eba652f878ddd72c76118c2fd8bae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
User projects can set the QT_PROMOTE_TO_GLOBAL_TARGETS variable to
true so that the various imported targets created by find_package(Qt6)
are promoted to global targets.
This would allow a project to find Qt packages in a subdirectory scope
while using those Qt targets from a different scope.
E.g. it fixes errors like
CMake Error at CMakeLists.txt:5 (target_link_libraries):
Error evaluating generator expression:
$<TARGET_OBJECTS:Qt6::Widgets_resources_1>
Objects of target "Qt6::Widgets_resources_1" referenced but no such
target exists.
when trying to use a static Qt from a sibling scope.
Various 3rd party dependency targets (like Atomic or ZLIB) are not
made global due to limitations in CMake, but as long as those targets
are not mentioned directly, it shouldn't cause issues.
The targets are made global in the generated
QtFooAdditionalTargetInfo.cmake file.
To ensure that resource object libraries promoted, the generation
of the file has to be done at the end of the defining scope
where qt_internal_export_additional_targets_file is called,
which is achieved with a deferred finalizer.
Replaced all occurrences of target promotion with a helper function
which allows tracing of all promoted targets by specifying
--log-level=debug to CMake.
Pick-to: 6.2
Fixes: QTBUG-92878
Change-Id: Ic4ec03b0bc383d7e591a58c520c3974fbea746d2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Automatically set compilers based on old mkspec style target
Pick-to: 6.2
Change-Id: I80404376964a85c6b519657c054d008da47aed91
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This change allows temporarily removing the EXTERNAL_BUILD option in
a qt repo examples project to check how the examples behave in a
non-external project build, without forcing the developer to use a
prefix build.
Useful to compare behavior until we've ported over prefix builds to
use EXTERNAL_BUILD.
Amends d97fd7af2b
Change-Id: I29b834bb5f00e1e93966caae6f816faedba76b76
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This makes qt_internal_disable_find_package_global_promotion available,
which is needed when linking against QtMultimedia in a static build
Pick-to: 6.2
Change-Id: I9b8f6d7b74a8693ac471f8a280e893f4da80a44b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Removing flags based on REGEX may include spaces, so flags might be
glued. Replace flags with spaces to keep at least one space for
the described case.
Pick-to: 6.2 6.1
Fixes: QTBUG-94400
Change-Id: Ice268da36174ef5cf4398d2aee8fcd4731336316
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add 'Private' suffix to the internal module names in the mappings of
the qmake files for modules of the qtdeclarative repo.
Change-Id: I1592ebad0f0db553322ea766561b1b8c3fd38aea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
'ld' only capable to resolve circular dependencies by wrapping the
suspected static libraries and objects using --start/end-group
arguments. We want to detect if linker is 'ld' at configure time to
decide how to link the resource objects if finalizers are not enabled.
The qt_config_compile_test function is extended with an extra argument
since it's required to pass custom cmake flags to the ld-related test.
Pick-to: 6.2
Change-Id: I484fcc99e2886952d8b0232f37e4e6a35d072931
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This means calling 'ninja apk' in a Qt build with examples configured
will build all example apks, regardless of whether the examples are
built as external projects or in-tree.
Fixes: QTBUG-94264
Change-Id: I5c7af0354858898a2e154a6d54fb025e4d81ff80
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
qmake had support for building with clang-cl as the win32-clang-msvc mkspec.
Task-number: QTBUG-89642
Task-number: QTBUG-88081
Change-Id: I0709c289f90fedb121620d1e67ef841602219816
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
All repositories define QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS by now,
and we can remove QtCompatibilityHelpers.cmake altogether.
Change-Id: I4d8104246e96a4514d5651c104607d651d208d95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add FindWrapSystemMd4c.cmake so that the old md4c target can be used
as well as the new one and set WrapSystemMd4c_FOUND.
Link to the imported target WrapSystemMd4c::WrapSystemMd4c if the
system library is used.
Add qt_find_package line to find the package in configure.cmake.
Fix the condition for enabling system-textmarkdownreader, it includes
testing for textmarkdownreader because even if the code would compile
correctly without it, it looks strange when the output says
"textmarkdownreader no" and under "using system libmd4c yes" even if
libmd4c is not used.
Use system include when system-markdownreader is enabled.
Add library mapping for libmd4c.
Change-Id: Id5d5b13d6691a8c1cdf627238887977c847c1e67
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Move collected resource objects to the beginning of the linker line to
prevent order-related issues.
Fixes: QTBUG-92250
Change-Id: Ia046f2820feb693bfadc2b60e07fa001638d4d7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
qtattributionsscanner is now found in libexec.
Task-number: QTBUG-88791
Change-Id: Ie704663012be92b0c223d9d57210ec1874abff0b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
For Apple's frameworks it's possible to include header files using the
following assumption:
If the framework name is "MyFramework" then
'#include <MyFramework/frameworkheader.h>' will work without specifying
the include path explicitly. This is broken for internal modules since
they use the framework name with the 'Private' suffix.
This uses the module name instead of the target name as a framework
name.
Amends edbe0eb335
Task-number: QTBUG-87775
Change-Id: I0592a28d0768724b6e10ca81aa7cefb0a3699a5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Resource objects might be linked to plugins. Since some plugins may
be present in LINK_LIBRARIES as the complex genexes, need to collect
them explicitly and iterate over plugin targets to find resource object
libraries that need to be exposed to end-point target executable.
Amends a1fd4f51ad
Change-Id: Icd85f54f7bf9d1b7e3382caa5d9aa62449b6adb8
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Before, it would erroneously look for them in the source directory.
Change-Id: I6dcd3ccde3e57dba84639da2cd354c51e8a92459
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In MSVC static build, if we build Qt with 3rdparty library (e.g. zstd),
cmake will add"zstd" (without "-l" prefix) to Qt6Core.prl. Then we
use this Qt to build a qmake project, compilation will fail due to
missing zstd.obj. Without "-l" prefix, qmake will treat "zstd" as an
object file instead of a library.
Library names in qt_module.pri and qt_lib_*_private.pri are also
missing "-l" prefix.
This is because on most compilers, CMAKE_LINK_LIBRARY_FLAG equals
"-l". But on MSVC, it is an empty string. So we should pass
"-DLINK_LIBRARY_FLAG=-l" for MSVC.
Also add "-L/path/to/library" if the library path is not in default
linker search directories. This will write un-relocatable paths to prl
files only when using 3rdparty libraries to build Qt statically. Usually
it's not a problem.
In addition, CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is also empty on
MSVC. So The third argument of "$<FILTER>" is empty, it is an invalid
generator expression. This means no include dir will be written to
qt_module.pri and qt_lib_*_private.pri on MSVC. So only use "$<FILTER>"
when CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is not empty.
Pick-to: 6.1
Change-Id: Ib66f95dc09cf920363a4b9338fb97747dd2f8ab7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
...and make it consistent with that of qt_internal_add_module.
Make EXTRA_CMAKE_FILES a multi value keyword.
Do not add include statements for every file in EXTRA_CMAKE_FILES.
Add the EXTRA_CMAKE_INCLUDES argument to specify includes.
This enables us to specify EXTRA_CMAKE_FILE that are not included.
Change-Id: I1a3667473b94ee44363b554ab9e6c380e5c11389
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When building Linux packages, we pass OpenGL_GL_PREFERENCE=LEGACY when
building qtbase. This is done to link against legacy OpenGL libs.
When building non-qtbase repos, we also need to set this variable to the
same value we have in qtbase.
Pick-to: 6.1
Task-number: QTBUG-89754
Fixes: QTBUG-94040
Change-Id: I567b629d245025d2b1544b91cfc265a9c921725f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Avoid getting the LINK_LIBRARY property of the interface libraries
when calling a resource object finalizer.
Amends a1fd4f51ad
Change-Id: I19d625a927c66994902f5c89e6c82183c94af91e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Versioned tool targets are always promoted to global targets.
Versionless ones were not promoted to global targets.
This was an oversight which caused issues with conditions like
if(TARGET Qt::Tool) in top-level builds.
Fixes: QTBUG-93839
Change-Id: I5176899b5d0d80bfd0b350bc9c4b3fa5b53c0777
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In the future it might be useful to print the config summary entries
of a Qt module configure.cmake file even if the associated module
is not built and thus qt_feature_module_begin is not called.
The repo src/CMakeLists.txt could then use a combination of
qt_feature_evaluate_features and a conditional
qt_feature_record_summary_entries to ensure the that summary entries
are still shown.
Change-Id: I124efc82163ddae48d9e72c70a677ec4c6588fac
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Since the information about framework is performed in multiple places
it's quite hard to control its consistency. This moves the obtaining
of framework related information to the common function and adjusts
the use of the information across the repo.
Change-Id: I1f488d41dcea75a1e8c361926792a6b7c45e5a3f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In the previous implementation of the resource object finalizer, we
used the name of the resource object library without namespaces when
recording it in the resource libraries list. This causes an issue when
we or users export resource targets.
This approach marks resource object libraries with the exporting
property instead of collecting resource targets when creating them.
Amends 19e789bace
Change-Id: I8596815921f2c681ddd78d9b2e9a4e1cafe5000b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This proposal collects all the resource objects to the qt-specific
property of the static libraries. This is done to avoid littering
of other static libraries and put resource object files to the
source part of the linker line when linking the end-point
executable.
The way we link object resource libraries is changed back to the
target_link_libraries approach as we may omit using finalizers
with linkers other than ld. Users may enforce finalizers by calling
the qt6_enable_resource_objects_finalizer_mode function if need.
Refactor tests related to the static resources.
Amends ddaa7150d8
Task-number: QTBUG-93002
Change-Id: I74135e291cd82fb54d1b284b4b4a1e002b1fef98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Only use plugin finalizer mode if qt_finalize_target is called at the
end of the user project (which we can't really check, the user has to
ensure that) or when qt_finalize_target is automatically defer-called
by CMake 3.19+ (which is done by qt_add_executable).
This removes the previous behavior of using the finalizer mode if
qt_import_plugins is called. Instead the old regular mode is used
if the above preconditions are not met.
The removed behavior had ordering issues if qt_import_plugins was called
before target_link_libraries. The dependency walking would be done
before Qt dependencies were added and thus no plugins would be
linked.
Amends 6fcc272ac9
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Task-number: QTBUG-94030
Change-Id: I78702b653a35596f5581c2f4282b2336f0124e60
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
fix debugging demangler
Emscripten apparently does not like the quotes in the compiler argument
and remove array syntax
Change-Id: I66652f6bdc5872faf540a877ca01bf75dde47bbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Examples are intended to show how to build against an installed Qt.
Building them as part of the main build means the way the Qt targets
are defined and created are not representative of an end user's build.
By building them as separate projects using ExternalProject, we can
more closely replicate the intended audience's environment. This
should allow us to catch more problems earlier.
Having examples built as part of the main build also creates problems
with some static builds where a tool built by the main build is needed
during configure time. This happens with other repos like qtdeclarative
but not (currently) with qtbase. Converting the examples in qtbase to
be built using ExternalProject is intended as a demonstrator for how
other repos can do similar. Until other repos are converted, they will
continue to work as they did before, with examples as part of the main
build for non-static builds only.
The new build-externally behavior is only supported for non-prefix
builds with this change. Prefix builds will continue to use the old
non-external method. Support for building examples externally in
prefix builds will be a separate change.
Task-number: QTBUG-90820
Fixes: QTBUG-91068
Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It was copy-pasted (presumably from plugin handling code)
when initially introduced but was never used.
Change-Id: I571738b9f5269ca038f5931a773aa5c2c66aafbc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Internally it uses a new _qt_internal_add_library function (similar
how we have qt_add_executable and _qt_internal_add_executable) as well
as finalizer code line the executable case.
_qt_internal_add_library forwards arguments to add_library with some
Qt specific adjustments to the selected default target type (based on
whether Qt is configured as static or shared).
The new _qt_internal_add_library is now used in qt_add_plugin as well
as some internal library creating functions like
qt_internal_add_module.
This reduces some duplication of file name adjustments across
functions and creates a central point for creation of Qt-like
libraries (for some definition of Qt-like).
Change-Id: Id9a31fe6bf278c8c3bb1e61e00a9febf7f1a2664
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Since we add 3rdparty libraries to the set of the Qt modules, they are
treated as the Qt modules by the depenedcy helper as well. So give them
_qt_module_interface_name to fix dependency helper.
Amends 425ff34aa1
Change-Id: I5898c1c90156de1878aeeef5a0924349b44c50fa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We need to export the Private targets of the internal modules to keep
compatibility with existing internal module users across repositories.
Amends 425ff34aa1
Fixes: QTBUG-93943
Change-Id: I10234cec1eb618b69d041f80fbe29620a4e307b9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When dealing with a universal build of Qt, we would end up
using the QT_ARCH as the architecture for user projects,
but this architecture is always the primary one that Qt
was configured with.
Instead of relying on QT_ARCH, we start writing QT_ARCHS
(plural) to qconfig.pri, based on CMAKE_OSX_ARCHITECTURES,
and then use that to initialize QMAKE_APPLE_DEVICE_ARCHS.
We then resolve the active arch using uname -m, matching
what CMake does.
We still feed all the available architectures to the
Makefile or Xcode project, so that the user can build
for any of the available architectures without needing
a reconfigure.
Fixes: QTBUG-93760
Change-Id: I0d338241ba4d944ca36d85371e9c4df7dbc4f269
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
After discussion we decided to opt-out the UNICODE definintion
behavior. To disable UNICODE in user projects the
qt6_disable_unicode_defines function could be used.
Amends 5b64e5950c
[ChangeLog][CMake] Enables the UNICODE and _UNICODE definitions on
WIN32 platforms by default for all cmake projects to reflect the
qmake behavior. Use qt6_disable_unicode_defines function to disable
the default unicode definitions.
Pick-to: 6.1
Fixes: QTBUG-93895
Change-Id: Id70ff7dcf8c74f660ec851f8b950e1e3b94d9fb4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
HEADER_MODULEs use the INTERFACE visibility to link libraries. This
causes a transitional propagating of the Qt-internal compile definitions
and options to the user targets.
This commit avoids an implicit adding of the Qt::PlatformModuleInternal
library to the HEADER_MODULEs and stops propagation of the Qt-internal
compile definitions and options. If module wants the transitional
propagation of some properties, this needs to be done explicitly.
Amends 8b7894cb63
Pick-to: 6.1
Fixes: QTBUG-89951
Change-Id: Ia9cecc38bac98eb5bc6e47d288308b49813ab5ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In cmake, targets are used as an entity for modules. This causes a
number of problems when we want to manipulate a module as a separate
entity with properties associated with it.
The _qt_internal_module_interface_name target property is introduced to
represent the module entity. All modules write a name to this property,
which will subsequently expand into the module name matched with
the module name in qmake.
The 'qt_internal_module_info' function is responsible for providing the
correct values for the module properties used when working with a module
target.
Unlike qmake, for internal modules in cmake it is expected that the
Private suffix will be specified explicitly. In case the user wants to
have a different module name, an additional argument
MODULE_INTERFACE_NAME of the qt_internal_add_module function is
introduced.
This also changes the way how target dependencies are collected and
resolved. Since the 'Private' suffix no longer means an unique
identifier of the module 'Private' part, we look for the both Private
and non-Private package names when resolving dependencies.
TODO: This change doesn't affect the existing internal modules, so to
keep compatibility with the existing code the existing internal modules
create 'Private' aliases. The code that provides backward compatibility
must be removed once all internal modules will get the proper names.
Taks-number: QTBUG-87775
Change-Id: Ib4f28341506fb2e73eee960a709e24c42bbcd5ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Introduce the concept of repository target sets, which is a named set of
targets within a Qt module repository.
In a Qt repository, a repo target set 'qtfoo' can be defined in the
top-level project file with
qt_internal_define_repo_target_set(qtfoo DEPENDS Bar Baz)
The DEPENDS argument specifies Qt components that need to be
find_package'd when building the targets that belong to qtfoo.
In subdirectory project files, use
qt_internal_include_in_repo_target_set(qtfoo) to mark the file as
belonging to the repo target set.
To build and install a single repo target set, specify
QT_BUILD_SINGLE_REPO_TARGET_SET=qtfoo when configuring the Qt
repository.
Change-Id: Ic9e6213e3225988fd561f315bc857ee44ff17420
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Allow linking all plugin initializer object libraries directly
into the final target (executable or shared library).
The finalizer mode is triggered when the project adds a call
to qt_import_plugins, as well when the project has an explicit
call to qt_finalize_executable or when it is defer called by
CMake 3.19+.
Otherwise the old non-finalizer mode is used, where each plugin
initializer object library is propagated via the usage
requirements of its associated module.
A user can explicitly opt in or out of the new mode by calling
qt_enable_import_plugins_finalizer_mode(target TRUE/FALSE)
The implementation, at configure time, recursively collects all
dependencies of the target to extract a list of used Qt modules.
From each module we extract its list of associated plugins and
their genex conditions. These genexes are used to conditionally
link the plugins and the initializers.
Renamed QT_PLUGINS property to _qt_plugins, so we can safely query the
property even on INTERFACE libraries with lower CMake versions.
QT_PLUGINS is kept for backwards compatibility with projects already
using it, but should be removed in Qt 7.
The upside of the finalizer mode is that it avoids creating link
cycles (e.g. Gui -> SvgPlugin -> Gui case) which causes CMake to
duplicate the library on the link line, slowing down link time as well
as possibly breaking link order dependencies.
The downside is that finalizer mode can't cope with generator
expressions at the moment. So if a Qt module target is wrapped in a
generator expression, it's plugins will not be detected and thus
linked.
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: Ic40c8ae5807a154ed18fcac18b25f00864c8f143
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Instead of compiling the plugin initializers as part of a user
project, pre-compile them as object libraries while building Qt.
The installed object libraries can then be used with
target_sources(qt_module INTERFACE $<TARGET_OBJECTS:plugin_init>)
so that they are linked into the final executable or shared library
via qt module usage requirement propagation.
This reduces the build times of user projects.
The link line placement of the object files should be correct for all
linux-y linkers because the only dependency for the object files is
Core and the Gui -> plugin -> Gui -> Core cycle does not hamper that
from empirical observations.
As a consequence of the recent change not to link plugin initialization
object files into static libraries, as well not having to compile the
files in user projects, we can get rid of the
_qt_internal_disable_static_default_plugins calls in various places.
A side note.
Consider a user static library (L) that links to a Qt static library
(Gui) which provides plugins (platform plugins).
If there is an executable (E) that links to (L), with no direct
dependency to any other Qt module and the intention is that the
executable will automatically get the platform plugin linked,
then (L) needs to link PUBLIC-ly to (Gui) so that the plugin usage
requirements are propagated successfully.
This is a limitation of using
target_sources(qt_module INTERFACE $<TARGET_OBJECTS:plugin_init>)
which will propagate object files across static libraries only if
qt_module is linked publicly.
One could try to use
target_link_libraries(qt_module
INTERFACE $<TARGET_OBJECTS:plugin_init>)
which preserves the linker arguments across static libs even if
qt_module is linked privately, but unfortunately CMake will lose
dependency information on Core, which means the object files might be
placed in the wrong place on the link line.
As far as I know this is a limitation of CMake that can't be worked
around at the moment.
Note this behavior was present before this change as well.
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: Ia99e8aa3d32d6197cacd6162515ac808f2c6c53f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This is to allow other repos like qtdeclarative to more easily pass
through supported arguments to qt_internal_add_module() from their own
functions.
Task-number: QTBUG-88763
Change-Id: I965d593de4c6f9d5295a0d427c32dc3d5b1bb639
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Q_IMPORT_PLUGIN generates a global static symbol that initializes a
plugin. If this symbol is added to a static library and the library
is then linked to an executable, the linker decides that the symbol is
unused (because nothing references it) and discards it.
This means there's no point to compile the Q_IMPORT_PLUGIN containing
files into static libraries.
Change the generator expression we use for plugin propagation via
associated modules to not compile and link the plugin initialization
object file into a static library.
Pick-to: 6.1
Task-number: QTBUG-80863
Change-Id: Ide32c0124c1e313c352a72280ce32ce9fbe8fff1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The option is called QT_CREATE_VERSIONED_HARD_LINK. By default, it
is set to ON. Users can set this option to OFF to disable versioned
hard link.
Pick-to: 6.1
Fixes: QTBUG-93636
Change-Id: I0ffa1ee1c6bae1950df332fcce3152a861b33db0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
There was a D missing, we want to set CMAKE_REQUIRED_LIBRARIES
Pick-to: 6.1
Change-Id: I7a76d60480ef7bff439f298fe85614d3b7e3ae88
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Allow collecting all public dependency CMake targets starting from
a given initial target.
The new mode walks INTERFACE_LINK_LIBRARIES of a shared library
or executable target, as well as the INTERFACE_LINK_LIBRARIES and
LINK_LIBRARIES of a static library target.
Each encountered target (checked with if(TARGET)) is added the output
list.
Note that the private dependencies of a non-static target (like a
shared library or executable) are not walked by the new mode.
Introduce a new function called
__qt_internal_collect_all_target_dependencies which uses the new
mode to collect the full private dependency list of a target.
The final list only contains targets, so no linker flags or file
paths.
This list is useful to do further processing on the targets like
extracting properties from them and running finalizers.
Task-number: QTBUG-92933
Change-Id: I5d96cfa05722d65e2248a344a4f2b0f98a992817
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Needed for the upcoming static plugin mechanism, where we have to
extract the list of Qt module dependencies of a target and then extract
the plugins associated with those modules.
To do that we need to recursively collect the dependencies of a given
target.
Rename the moved functions to contain the __qt_internal prefix.
Also rename the existing QtPublicTargetsHelpers.cmake into
QtPlatformTargetHelpers.cmake to avoid confusion with the newly
introduced QtPublicTargetHelpers.cmake.
Task-number: QTBUG-92933
Change-Id: I48b5b6a8718a3424f59ca60f11fc9e97a809765d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Extract common static plugin handling functionality into a separate
QtPublicPluginHelpers.cmake file which is loaded by the Qt6 package.
Split the code into smaller functions that will be re-used by each
templated QtPlugins.cmake.in file, rather than copy pasting the same
code into each QtFooPlugins.cmake file.
As a drive-by, handle QtFeatures.cmake and QtFeaturesCommon.cmake
as public helper files just like QtPublicPluginHelpers.cmake.
This makes it clearer that the functions are available outside
the internal Qt build and also provides a way for not dumping new
helper functions into Qt6CoreMacros.cmake.
Task-number: QTBUG-92933
Change-Id: Id816ef009b4fac1cd317d3ef23f21b3530028067
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Use paths configured with QT_ADDITIONAL_PACKAGES_PREFIX_PATH
to search also for the tool packages.
Task-number: QTBUG-93565
Pick-to: 6.1
Change-Id: I611b275dd7c4e7ecceb073d16643cd225bbb21d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Sometimes projects don't follow the standard directory layout, so they
end up copy-pasting the guts of qt_build_repo and adapting that.
Split the macro into smaller ones so it's easier to reuse.
Change-Id: I8cc72ba2a2eaf58afd44950b3ac78378b7b1fdfd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
list(PREPEND) command was added in CMake 3.15+, but so far we claim
support for CMake 3.14 in user projects.
Use set command instead.
This is not the only place where we use list PREPEND in public API,
but it's the first immediate issue that comes up when using CMake
3.14.
Amends 963017f588
Pick-to: 6.1
Change-Id: I7ba4507fc7da2dc550317848751502b8b46c298c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We want standalone tests added by qt_internal_add_test to be built as
universal executables, so we can build them on an intel machine and
run them on an ARM machine.
But CMake build tests will be built on the final machine that runs the
tests and it might lack a universal SDK. That's why they should be
built only targeting the architecture of the machine they're running
on.
Change the generated qt.tooclhain.cmake file to allow opting in or out
of building projects with the same architectures as Qt was configured
with.
Now standalone tests will be multi-arch, but CMake build tests will be
single-arch.
Amends e379147f95
Task-number: QTBUG-85447
Task-number: QTBUG-87580
Task-number: QTBUG-92933
Change-Id: I41ab047983115f84eb2333cc9ac2d19ca08d621f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The -developer-build had not the desired effect anymore.
That argument must not be hidden from the feature logic.
This amends commit d5c3e1336b.
Change-Id: I96562ea2df43ba7de002e705f28c7cc7edb4a589
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Let -developer-build, -cmake-file-api set up the CMake File API query,
so that the build can be loaded directly into IDE's like Qt Creator.
[ChangeLog][Build System] configure -developer-build now sets up
the CMake File API query, so that a build can be loaded without
reconfiguration into Qt Creator and other IDE's. Pass
-developer-build -no-cmake-file-api to configure to disable this.
Fixes: QTBUG-89487
Change-Id: I69199b8f96da02e42e5610aa6f49881c1582f7da
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
BrotliCommon is a dependency of BrotliDec and BrotliEnc.
amends 5d2da76c1e
Pick-to: 6.1
Change-Id: I7741d417e95737f8caacd01962985a27dbb7514c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Passing this configure argument will generate a JSON file that contains
information about configure options and features.
This file is used by Qt's conan recipes.
Fixes: QTBUG-92082
Change-Id: I2057ec8cbdb0a1ea198d7eeacb45f65bfa862d8a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
file(REAL_PATH) was introduced in CMake 3.19.
Use get_file_name_component(... REALPATH) instead that is available in
older CMake versions.
This amends commit b226e99c71.
Pick-to: 6.1
Change-Id: Ibb28ef757228e1a1176ff70c3ec57b7ca751a636
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The libraries already contain the ABI suffix, and the .prl files should
too. This is a requirement for ABI-stitching of Qt Android builds.
Fixes: QTBUG-90023
Change-Id: Ib2a7b3119ace14c8542242fc45f42648840d053a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Clarify that OUT_FILE is not the final .prl anymore and where we get the
path of the final .prl from.
Change-Id: I4563c6ef1026bc0646e3ac9ab2fac49e426ca07f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QT_TOOL_PATH_SETUP_COMMAND is used in COMMAND list when call
add_custom_command/add_custom_target. This is necessary to setup
the necessary environment for the tool to run correctly. This approach
is weak according to CMake documentation:
"If more than one COMMAND is specified they will be executed in
order, but not necessarily composed into a stateful shell or
batch script."
This change introduces the _qt_internal_wrap_tool_command function
that uses a wrapping script that setups necessary environment for
the tool and runs it in a single shell.
The script is generated by the _qt_generate_tool_command_wrapper
function.
Change-Id: Id5270b91619b607a0c1e3a19b8c706edec43f388
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The qt_internal_module_info function suppose to provide the information
only about the Qt modules. Avoid using it for the tool and extra
package dependencies, since some targets do not always exist, when
function is called.
Add the qt_internal_qtfy_target function to make the prefixed target
names.
Change-Id: Ifa8c61064d9c6c430889f00a4ead304029da711b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
... and configuring another repo using qt-configure-module.
It's possible to configure a top-level Qt with a subset of repos and
then afterwards configure additional repos with qt-configure-module.
We didn't define QT_REPO_DEPENDENCIES in that case, which caused all
plugin config files to be loaded on reconfiguration, thus causing
duplicate target errors.
Move the QT_SUPERBUILD check to be done every time in
QtBuildInternals.cmake rather than when configuring qtbase/qt5.
Amends 98e8180e56
Pick-to: 6.1
Fixes: QTBUG-86670
Fixes: QTBUG-91887
Fixes: QTBUG-92578
Change-Id: I975835ffa02f702799a3c9f68a5e059d2763a951
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Packagers usually build Qt per repo, but the documentation must be built
from the full Qt source archive to ensure that inter-repo links are set
up correctly. When building the documentation, it's desirable to avoid
building tools and re-use to tools of an existing Qt build.
One now can do a documentation-only build by configuring Qt like this:
cmake /path/to/Qt/source -GNinja \
-DQT_HOST_PATH=/path/to/Qt/installation
and build the documentation with
ninja docs
To avoid building tools, this patch removes the DEPENDS arguments from
some add_custom_target calls in QtDocsHelpers.cmake and makes another
one conditional. The removed dependencies are added at the end of
qt_internal_add_docs. Adding of tool dependencies is not done if
QT_HOST_PATH is set.
Fixes: QTBUG-88441
Change-Id: I3b7a908e22d252d2edcdc1dd522a78b8ad6c487e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It's necessary to have versioned alias of the Platform target to use
versioned target in the installable cmake files.
Pick-to: 6.1
Change-Id: I79286e1c0642068bdfa5d24c1087ee0c39e48f1a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When configuring a Qt module with qt-configure-module, we want to use
the same CMake generator that was used for building qtbase.
That generator is encoded in qt-cmake-private. But qt-configure-module
overrides the generator after trying to detect what generator should be
used. That auto-detection is only useful for qtbase-builds and top-level
builds. Turn it off for repo builds other than qtbase.
Pick-to: 6.1
Fixes: QTBUG-91405
Change-Id: I07efb4afb51ba69d2f5467d272118fa51637ab54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It's important for conan CI builds where the correct installation
location of Qt should be used when configuring standalone tests.
Task-number: QTBUG-93037
Change-Id: I2465a439aea6826dedfb3217d1c909ad639d4ac0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Previously, in a top-level build we always generated the final prl
file somewhere under QT_BUILD_DIR (which is qtbase_build_dir). After
each repo was processed by QtPostProcess.cmake, we installed the prl
files found in PROJECT_BINARY_DIR.
For qtquickcontrols2 this meant that qml plugin prl files were placed
under qtbase/qml, but we tried installing the prl files from
qtquickcontrols2/qml, which didn't have any prl files.
In a static Qt build, qmake's qt.prf calls qmlimportscanner to
identify which plugins should be linked to the executable. This worked
fine because the plugin .pri files were installed correctly.
None of the qml plugin library dependencies were linked in though.
This is supposed to happen in qmake's C++ code where it tries to
find the associated prl file of a linked library in order to extract
all its dependencies. Because no prl file was found, linking failed
with multiple undefined symbols.
Fix this by installing the prl files from QT_BUILD_DIR rather than
PROJECT_BINARY_DIR.
Note that this will create multiple install rules for certain files,
but it's harmless. An example is imageformats.
We process qtbase plugins, see qjpeg, issue an install rule from under
the qtbase/plugins/imageformats folder. We then process
qtimageformats plugins, see webp, issue another install rule from
under qtbase/plugins/imageformats.
The first install rule will install both qjpeg and qwebp, the second
install rule will merely say all plugins are up-to-date.
Pick-to: 6.1 6.0
Change-Id: I8a4bb67bfafc1d016eab62f4fe66b6ba378ceeb2
Fixes: QTBUG-93021
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Passing Android-related variables to the initial CMake call would have
no effect if no (or an empty) value of CMAKE_TOOLCHAIN_FILE was
specified. To alleviate user confusion, yield an error if an Android
build was apparantly requested, but the toolchain file is missing.
Change-Id: I28ec94eabe436d4b9b410b48c7cad1b48d3e1bec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Before, we relied on the deprecated "ndk-bundle" subdirectory being
present in the SDK root. Now, we choose the NDK with the latest version
in the SDK's ndk subdirectory.
Pick-to: 6.1
Fixes: QTBUG-87579
Change-Id: I37a9e03184f4518b4074d55375af08209591de94
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When ANDROID_NDK_ROOT is explicitly set by the user, there's no point in
detecting the NDK. The detection had no effect, because the already set
ANDROID_NDK_ROOT variable would not be overwritten by our set call.
Fix the condition of the check: There is no CMAKE_ANDROID_NDK_ROOT
variable.
Pick-to: 6.1
Change-Id: I8f0d4f2a1a67445f67a79c7d2d0932099828b05e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It's needed in qtconnectivity, but currently the
qt_disable_apple_app_extension_api_only function is defined in
QtInternalTargets.cmake which is loaded only in qtbase.
Move the function to cmake/QtTargetHelpers.cmake.
Amends e189126f1a
Pick-to: 6.1
Change-Id: Ia2470e48a91385239394368780f5bbb223000113
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When cross compiling from a case sensitive file system, casing
matters, and mingw headers and import libraries consistently
use lowercase.
This was uncovered by d385158d5213ef568b7629e2aa4a818016bbffac;
prior to that, the schannel TLS plugin didn't end up built (at
least when cross compiling).
Fix other similar cases that can be found by grepping the repo.
Change-Id: Ia696e17b7aaa979d7b7f5b0801383f338a8b585b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Currently in order to compile a Qt6 test standalone one needs to use
the qt-cmake-standalone-test script which will load the
Qt6BuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt project
with the current test source directory to create a complete CMake project.
This commit will allow a test to have these lines at top:
cmake_minimum_required(VERSION 3.16)
if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
project(a_qt_test LANGUAGES C CXX ASM)
find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
endif()
and be standalone and work with any IDE capable of loading CMake projects.
Fixes: QTCREATORBUG-25389
Pick-to: 6.1
Change-Id: If3f878b7e560a8bfbb604a8f1aa30b7962742e66
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Certain repositories like qtsvg, qtimageformats and qtvirtualkyboard
build plugins associated with Qt modules from other repositories
(qtsvg's QSvgPlugin associated to qtbase's QtGui).
When configuring in-tree tests in the same build folder as the
repository, the test executables would not automatically link to these
plugins.
Fix this by recording the existence of such plugins in a separate
property of the associated Qt module and only link them when both the
test executable and plugin are from the same project (their
PROJECT_NAME coincides).
This is in addition to linking the plugins associated with the
module where both are built in the same repository.
The logic is a bit tricky and ensures that plugins are not
accidentally initialized twice, so that in-tree tests work for both
top-level and per-repo builds.
As a drive-by, added a TODO explaining why in-tree tests that need to
link to static QML plugins won't work (somewhat unrelated to this
change).
Amends 734d2cdbc4ff6db6b3df8fffbb23dbbb565c076b
Amends b1fcdad9c9b9ad2bddd00f7301c8dd1159d523c2
Pick-to: 6.1
Task-number: QTBUG-87580
Change-Id: I3e1ff8166864f92dea931ec2ea34b6f56b4eec60
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add SOLARIS cmake platform definition.
Add settings for QT_DEFAULT_MKSPEC so that qplatformdefs.h can be found.
Solaris has its gssapi symbols in libgss.
Solaris supports @ORIGIN.
Solaris ld does not support --dynamic-list needed for reduce relocations.
Make solaris fail the reduce relocation test.
getauxval is specific to GNU libc and some other libc implementations on
Linux but sys/auxv.h is not. The bootstrap uses sys/aux.h as the only
indication for getauxval. This breaks builds on Solaris, so only make
sys/auxv.h an indicator for getauxval on linux or glibc based systems.
Solaris uses X11 so add it to the X11_SUPPORTED list.
Solaris network libraries for sockets etc are in socket and nsl.
ifreq does not have a member ifr_ifindex on Solaris, it uses
ifr_index. Add test to check if ifr_index is a member of ifreq.
The first struct in the in_addr union on solaris is defined as four
uint8_t, therefore four arguments are needed for its initializer list.
Change-Id: Ieed4c1bbac8559a7ae1db9c4e1e91f609f150270
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The change introduced in 98e8180e56
fixes reconfiguration issues for repositories that provide plugins
associated with modules from a different repository
(QSvgPlugin -> QtGui -> qtbase).
It does so by only loading the public Plugin CMake packages of
dependent repositories.
For executables / tests that are built as part of the current
repository, plugins are linked via a different simplified mechanism in
qt_add_internal_plugin and qt_internal_add_plugin in order to prevent
exporting link cycles between plugins and Qt modules.
This works for the majority of in-tree tests, but unfortunately breaks
static standalone tests.
For example in qtbase neither mechanism will link plugins to the
standalone tests:
- qtbase has no repo dependencies, so the first mechanism (loading of
public plugin packages) is skipped because we assume we are merely
reconfiguring the main build of qtbase and we don't want to
accidentally create duplicate plugin targets
- because a standalone test configuration does not call
qt_internal_add_plugin, no association is done between qt plugin
and module and thus all tests (qt_internal_add_test ->
qt_internal_add_executable) don't get the simplified plugin
linking
Fix this by allowing loading of the public CMake plugin packages when
doing standalone tests. It should be safe to do so because we don't
build any plugins in this case, only tests.
Amends 98e8180e56
Pick-to: 6.1
Task-number: QTBUG-87580
Change-Id: I690a0366c73a24e7f49c65ed13cd70362c273d81
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In commit 013abe3206, I add
_CRT_SECURE_NO_WARNINGS definition for all Qt internal module targets,
to suppress MSVC warnings like:
warning C4996: 'strncpy': This function or variable may be unsafe.
However, when compiling some internal tools, such as qmake and qdoc,
such warnings also exist. To suppress this kind of warning entirely,
_CRT_SECURE_NO_WARNINGS definition should be added for all Qt internal
targets when using MSVC compiler.
Pick-to: 6.1
Change-Id: I9c37b20672f9d0f470e3e9ea847e5221f43bfc04
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Currently, FindWrapBrotli.cmake depends on vcpkg or PkgConfig. But for
users who build Brotli by themselves and don't have vcpkg or PkgConfig,
the Brotli cannot be found.
As a reference, I use following CMake commands to build Brotli:
cmake path/to/Brotli/source -G"Ninja Multi-Config"
-DCMAKE_CONFIGURATION_TYPES=Release;Debug -DCMAKE_CROSS_CONFIGS=all
-DCMAKE_DEFAULT_CONFIGS=all -DCMAKE_DEBUG_POSTFIX=d
-DCMAKE_INSTALL_PREFIX=path/to/install
Pick-to: 6.1
Change-Id: I2fa8d3293dd55ebc18937e13fac40d144ca4c1e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
On the CI system, we build qtbase with CMAKE_INSTALL_PREFIX set to a
path without a drive letter to support DESTDIR when installing.
Other Qt modules are built without CMAKE_INSTALL_PREFIX set. The
Qt6BuildInternals package provides a default value.
Since commit e6527e2f73 this default
prefix is calculated from the current installation location. This
default prefix however has a drive letter, breaking DESTDIR support.
Broken DESTDIR support in this case means for Android that file(INSTALL)
can properly install but stripping will silently fail.
We now compare the "real path" of the original prefix from qtbase and
the calculated prefix. When they're equal, we use the original
CMAKE_INSTALL_PREFIX.
Fixes: QTBUG-92890
Change-Id: I96fb0655e02c5c695722b7e01a32e209cbdea4cc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 15b26935fca4ab14298abdcc70b3cb15b6cca195)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Add an iOS specific plist file like we do for macOS.
If the user hasn't specified a bundle identifier or a development
team id, do what qmake does and query the Xcode preferences file to
pre-populate those if possible.
This allows running
cmake -GXcode ./foo
on a Qt example project and building it with xcodebuild on the
command line without having to go through the IDE to set a development
team id or modifying the example project to add a product
bundle identifier.
Note that the change assumes that the development team id has been
previously set / configured via Xcode. If no such id is found, then
the value will not be set and the user will still have to specify it
either in the project file or via the Xcode UI after the project
has been generated.
Amends 3a2fa3fec5
Pick-to: 6.1
Change-Id: Iaab4e57de72c9877fb9035d28f9a879b2c91a33c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Xcode allows building a project targeting either the device or
simulator sysroot in one single build dir, but for the sysroot
switching to work there should be no linker or compiler flags
referencing absolute paths of a specific sysroot.
During CMake configuration of a project targeting iOS, all found
system libraries will be within one single sysroot, either the device
one or the simulator one, whichever one was passed to
CMAKE_OSX_SYSROOT. CMake will then generate the Xcode project
and pass those absolute paths, which makes sysroot switching within
Xcode not work.
To avoid that, the CMake documentation recommends passing linker and
framework flags of the form '-lfoo' and '-framework bar' instead of
absolute paths. Xcode then takes care of setting the correct framework
search path.
Zlib is one of the libraries found in the iOS sysroot and thus passed
as absolute path.
To avoid that, create a new FindWrapZLIB find script. The target it
creates will pass the absolute path to the library on non Apple
platforms and an -lz linker flag on Apple platforms (macOS and iOS).
To avoid issues with target global promotion when system PNG package
is found, ensure that a found ZLIB::ZLIB target is promoted to global
manually in src/gui/configure.cmake.
Pick-to: 6.1
Change-Id: I8bd8649be4f680a331ad51925f27cb9d13ac5e5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
The directory-level targets missed the first level of sub-targets.
E.g. `qtbase_qmake` did not have a dependency to `qmake`.
Fix qt_build_internals_get_repo_targets to first grab all targets of the
subdirectory and then recurse.
Pick-to: 6.1 6.0
Change-Id: I3604000caec22fac9a4cc5f5aaf651d550d16793
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
With CMake 3.20.1 AUTOMOC can crash or hang on Windows when used with
a Qt installation that supports moc depfiles due to missing
multi-threaded locking.
Warn and advise to use a different CMake version instead.
Change-Id: I78d2269c48dfc2541bebcd6ab23aaa5595012149
Pick-to: 6.1 6.0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We need the metatypes for anything directly or indirectly exposed to
QML. Switching this on has no runtime overhead. For interface libraries
we cannot generate any metatypes, though.
Change-Id: I7b7f85bb4e16c28d00383c5c88b0f1c172c8d193
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Homebrew introduced a new default prefix for Apple Silicon machines,
so that both arm64 and x86_64 packages can be co-installed on a single
system.
The intel packages are installed into /usr/local and the arm64
packages are installed into /opt/homebrew.
For Qt building purposes, we don't want to find packages in any of
homebrew's prefixes unless explicitly requested by the user
Currently our arm64 macOS CI config does pick up system libs under new
prefix.
Remove the new path from the system prefixes.
Amends f3c7d22dd0
Task-number: QTBUG-85447
Change-Id: I381d31c95bcdab26147a331444ba40c7af9d0a95
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
So that the correct version is generated in top-level builds.
Change-Id: I360370815ce178564cc79157dc61d70adfd4f947
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
CMake makes possible to specify a target in the target_link_library
call even if the target is not declared yet. This adds flexibility to
the target declaration arrangement. For the Qt modules we have to
restrict freedom, because of the .prl files generating. If the Qt
module depends on another Qt module, the dependecy must be declared
before the module finalizing step, otherwise this will cause invalid
records in the module .prl file.
TODO: The dependency order issue could be solved by using conditional
genex's when generating step1 .prl file. But we ask developers to
depend on Qt module targets that have been defined before their usage.
Fixes: QTBUG-89467
Change-Id: I12ce1000048fd4a2f3334f17720c8df1c680ca20
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The find script checked for UIKIT which is set during a Qt build
in QtPlaformSupport.cmake but is not set when building a user project.
This casused the find script to skip the iOS specific code that
passed the -framework OpenGLES linker flag.
This broke SDK switching in Xcode.
Check the IOS variable instead which is set by CMake for all projects
that pass -DCMAKE_SYSTEM_NAME=iOS.
Pick-to: 6.1
Change-Id: I9bd088f317917544ccfeff61fc4ff90f18f0f3d8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Before this change, we created a CMake toolchain file for iOS and
macOS universal which propagated the initially configured
CMAKE_OSX_ARCHITECTURES values to user projects.
So if Qt was configured with 2 arches, configuring a CMake user
project using the generated toolchain file would also build the
user project targeting those 2 arches.
The reason for this that the same toolchain file is used for
configuring both Qt and users projects and we needed to ensure that
other Qt repos are built with the same set of arches. That
unfortunately led the multiple arches to carry over into user
projects.
This is different from qmake behavior which configured user projects
with 1 arch only.
Instead of the toolchain file explicitly setting
CMAKE_OSX_ARCHITECTURES for all projects, save the initial list of
arches into QT_OSX_ARCHITECTURES.
Then if the toolchain file detects that we're building a Qt repo (by
checking for the presence of QT_REPO_MODULE_VERSION) set
CMAKE_OSX_ARCHITECTURES to QT_OSX_ARCHITECTURES to propagate the
initial list of arches.
For user projects we want to have some sensible defaults.
For macOS projects, leave the decision of the architecture to build
to CMake.
For iOS Xcode projects, leave the decision to Xcode.
For iOS Ninja projects, set the architecture to the first value of the
architectures used when configuring Qt.
As a side note this fixes an issue in our CI where we configured macOS
Qt with 2 architectures and then tried to run CMake build tests for
both architectures on a machine that doesn't have the universal SDK.
This led to build failures.
Because the CMake build tests act as regular user projects, now they
are configured with a single architecture that is automtically
detected by CMake.
Pick-to: 6.1
Task-number: QTBUG-85447
Change-Id: Id1b7e78d7e67c1796efed10751416e5f857c16d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The CoreMotion is required by the QtSensor module.
Task-number: QTBUG-92502
Change-Id: I7f1853131aa96b2cb052862d5bf492df5ec18150
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The 'list(TRANSFORM cmake_args REPLACE "\\[\\[;\\]\\]" "\\\\;")' call
breaks the list arguments added when evaluating the 'INPUT_' values.
Therefore, it's necessary to apply bracket-based escaping to all list
arguments instead of the standard escaping.
Amends 856fadf85c
Fixes: QTBUG-92459
Change-Id: Ifd4e0ca5f549a1c7fab9ceb587ed355250c4e677
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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 <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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 76230d9879
Amends c975c35eae
Pick-to: 6.1 6.1.0
Fixes: QTBUG-92529
Task-number: QTBUG-87861
Change-Id: I9671f6504374cf0799289bbe19110e01c129402e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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 5807e1ae81
Pick-to: 6.1 6.1.0
Fixes: QTBUG-92451
Change-Id: I56df2ce0201625088417de53038642518c1d3bbd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
CMake 3.20.0 can create autogen-related cyclic dependencies that are
only detected at build time by Ninja, which then fails with a build error.
Warn and advise to use a different CMake version instead.
Pick-to: 6.1 6.0
Change-Id: I9bef973ad2efdb69f28d6a9e0584b543be59f17f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>