Commit Graph

1604 Commits

Author SHA1 Message Date
Pino Toscano
0a41399c2d CMake: enable machine_tuple also on GNU/Hurd
On the Hurd there is the standard GCC toolchain, so it is possible to
query GCC for -dumpmachine.

Change-Id: Idc8e80c0937147a8ea656bc0320a83d647278455
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-11 00:31:30 +01:00
Alexey Edelev
723a4e2b89 Add missing include of QtPublicCMakeHelpers
Amends 2201934efa

Pick-to: 6.2 6.3
Task-number: QTBUG-99491
Change-Id: I449f0705f1e41fd4609008ae6a7f4107cd0a4ca6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2022-02-10 15:43:00 +01:00
Alexey Edelev
2201934efa Use 'copy' but not 'copy_if_different' on Windows platforms
Use custom script to copy big Android artifacts on Windows platforms.
The script uses 'copy' but not 'copy_if_different' when source file
size is bigger than 2GB. 'cmake -E copy_if_different' only compares
first 2GB of files because of cmake issue, so this step only
workaround the problem.

Pick-to: 6.2 6.3
Task-number: QTBUG-99491
Change-Id: Id076734700e334dfc3330da412462c2b53829b33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-10 02:31:05 +01:00
Alexandru Croitor
92dff7c5f8 CMake: Handle slashes in qt_internal_add_example
qtdeclarative has a call like
 qt_internal_add_example(imagine/automotive)

This causes issues when trying to pass that as the name of the
external project. Use the last part after the last slash as the name
of the project.

Pick-to: 6.2 6.3
Change-Id: Ifc074e50e537f07f3636699ed255d2561930d873
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-09 16:48:25 +01:00
Alexandru Croitor
94b158134c configure: Switch error to warning when -skip used in per-repo build
Yield a warning instead of an error that -skip and -submodules have
no effect in a per-repo build.

Amends acaba63260
Adjusts to 11ae0e772c

Pick-to: 6.2 6.3
Change-Id: Ic26b0ba29e48be5162f13ad75308f8358d8878e3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-09 15:33:46 +01:00
Alexey Edelev
3bee7db419 Fix the run of _check targets in multi-config builds
With Ninja Multi-Config generator it's necessary to provide the
'-C' option matching the build configuration when running
ctest. This patchset adds the missing option to the command line
of the '_check' targets.

Pick-to: 6.2 6.3
Change-Id: I42acfba26a09877a6d3a5be9230860f15f95a0cd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-09 15:33:45 +01:00
Alexandru Croitor
90b07054f6 CMake: Assign proper postfixes in multi-config builds
In a single-config build on Linux, we usually don't want a debug
postfix in library names (as opposed to Windows/macOS).

But when doing a multi-config build on Linux, assigning no postfixes
causes CMake to generate rules for a single config only, the first one
specified in CMAKE_CONFIGURATION_TYPES.

This leads to being unable to build all configurations from the same
build.ninja file as well as other obscure issues like race-conditions
when generating prl files.

To address this, when doing a multi-config build, always assign a
postfix for each config except the first release-like one, while
preserving the existing rules we had for debug postfix names.

Pick-to: 6.2 6.3
Fixes: QTBUG-100493
Change-Id: Ie9c88e074abdcf2961d7b3dee19a5694292717b8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-09 15:33:45 +01:00
Alexandru Croitor
bb9be22133 CMake: Fix rpath set for Qml plugins to not contain lib64
Qt6QmlMacros uses the value of GNUInstallDirs's CMAKE_INSTALL_LIBDIR
to calculate the rpath from a Qml plugin's location to the Qt
libraries.

By default CMake detects the value of CMAKE_INSTALL_LIBDIR, and on an
RHEL system it is set to 'lib64', whereas we usually configure Qt with
the lib dir set to just 'lib'. This might cause issues with Qml
plugins not locating the Qt libs due to an incorrect rpath.

Ensure that when building Qt libraries and plugins,
CMAKE_INSTALL_LIBDIR is set to the same lib dir value that Qt was
configured with.

Pick-to: 6.3
Fixes: QTBUG-99707
Task-number: QTBUG-100432
Change-Id: I17b2a22d46ef3b40084a2f6a4992f0e23b35d4d3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-03 21:55:38 +01:00
Alexandru Croitor
acaba63260 configure: Raise error if -skip/-submodules is used in per-repo build
Specifying the options would do nothing, so it's better to error out
early in case the developer accidentally added them.

Pick-to: 6.2 6.3
Change-Id: Ia516468a22c3c48e9e84dc78e522e8870186d96b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-03 21:21:29 +01:00
Alexandru Croitor
7cb2bbd9e7 configure: Introduce -submodules option
The option is used to specify a list of Qt repos (git submodules)
that should be included in the configuration of a top-level Qt build.

The option takes a comma-separated list of qt submodule names e.g.
'qtbase,qtsvg,qtdeclarative'

It can also take a single value like 'qtbase' or 'qtquick3d'.

Each specified submodule and all of its transitive dependencies will
be included when configuring the top-level Qt build (assuming that the
submodules have previously been already checked out).

Any missing submodules or dependencies will not be automatically
checked out, but rather skipped. This can result in a failed
configuration if a required submodule is missing.

If some optional transitive submodule dependency is not desired in the
build, you can combine the -submodules option together with -skip
options.

E.g. configuring with

  -submodules qtdoc,qtnetworkauth -skip qtmultimedia,qtimageformats

will result in a top-level build with the following  submodules:

 - qtbase (common dependency)
 - qttools (dependency of qtdoc)
 - qtactiveqt dependency of qttools)
 - qshadertools (dependency of qtdeclarative)
 - qtdeclarative (explicit)
 - qtnetworkauth (explicit)
 - qtdoc (explicit)

Pick-to: 6.2 6.3
Fixes: QTBUG-100388
Change-Id: Ie8c47cfd1d1e0e44a27260bf9ddf968531cc1cc0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-03 21:21:29 +01:00
Alexandru Croitor
40155ddd0e configure: Allow specifying a comma separated list to -skip option
This makes skipping a list of submodules more concise.

e.g. instead of passing

 -skip qtsvg -skip qtimageformats -skip qtmultimedia

pass

 -skip qtsvg,qtimageformats,qtmultimedia

Pick-to: 6.2 6.3
Change-Id: I6a48828b2fd7cec9f6e19988f7b4033333768abb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-03 21:21:28 +01:00
Alexandru Croitor
d1c825ae8c CMake: Temporarily disable building external examples in prefix builds
There are issues when building examples as external projects in the CI
in child repos like qtsvg.

QEMU configurations fail to find some CMake Config files, Windows
configs fail to find libraries.

Until these issues are fixed, build examples in-tree (without using
external projects) like we did before.

Temporarily disables 98c89c8cc1

Pick-to: 6.2 6.3
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Ia4b39812b27cfde5f5a103fd39cc1cb032842643
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-03 19:29:44 +01:00
Alexey Edelev
fd3341a74e Add qt_internal_undefine_global_definition function
qt_internal_undefine_global_definition disables an internal global
definition that is defined by the qt_internal_add_global_definition
function for a specific target.

Remove the ability to set the custom "undefine" flag for the
definitions since it's hard to control it using the introduced
function.

Pick-to: 6.2 6.3
Task-number: QTBUG-100334
Change-Id: Ic1637d97aa51bbdd06c5b191c57a941aa208d4dc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-02 16:45:37 +01:00
Alexey Edelev
e2b98627a8 Use builtin test data on Integrity
Looks like Integrity doesn't deal well with external test data either.

Pick-to: 6.3
Change-Id: I8beb5ac4d2440d40a7efdceae973e430a2354e9d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-02 09:18:25 +01:00
Ilya Fedin
5a0849ed6b Handle glib optional components properly
Fixes: QTBUG-97929
Pick-to: 6.3
Change-Id: Ic73548cb10680a2ccd60faed2b0548c82892eaa1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-02 08:56:10 +04:00
Alexandru Croitor
1031fa1547 CMake: Allow installing examples outside of the Qt prefix
Introduce a new QT_INTERNAL_CUSTOM_INSTALL_DIR variable to
allow specifying an 'examples install dir' outside of the Qt prefix.

It will be used in a follow-up change to ensure we don't package
the example binaries in our CI artifacts (thus saving space).

This will be even more important when the examples will contain code
to deploy Qt libraries alongside each deployed example (which would
significantly increase the package size).

Pick-to: 6.2 6.3
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I06b4a8f9e8c57a712a356bca0f5c351a9362bc30
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-01 16:51:01 +01:00
Alexandru Croitor
98c89c8cc1 CMake: Build examples as ExternalProjects in prefix builds
Change prefix builds to use ExternalProjects to build examples
by default. This will affect our CI which only does prefix builds.

To make it work, we have to do a few adjustments:
- look for Config files in the build-tree (before Qt is installed)
- build only one examples with only a single config,
   even if Qt is a multi-config build
- install examples as part of main make install step, rather than
  as part of the make step (which is the default for EPs)
- adjust CXX flags when building with MSVC to ensure we can still
  use sccache and separate debug info
- derive the correct install prefix for each example and pass it
  to the ExternalProject

As a drive-by, add TODOs to address tidiness of the code and corner
cases that likely don't work (Conan).

Amends d97fd7af2b

Pick-to: 6.2 6.3
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I3060da5dc64e7b06052f9dcb720d4d250f876450
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-01 16:51:01 +01:00
Alexandru Croitor
1273ffb000 CMake: Copy FindFoo.cmake scripts to build dir in prefix builds
They are used by build dir Qt6FooConfig.cmake files in conjunction
with export(EXPORT)'ed target files when building ExternalProjects
against a non-installed Qt (or in a top-level build).

Change-Id: I688caf1bd1b8a8fe7e549cebade2aef6f928bd6c
Pick-to: 6.2 6.3
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-01 16:51:01 +01:00
Alexandru Croitor
ac4a913f33 CMake: Deduce install prefix of example in qt_internal_add_example
We want to get rid of the INSTALL_EXAMPLEDIR and INSTALL_EXAMPLESDIR
code in each example project.

This was an internal workaround to ensure examples are installed into
a relative path somewhere under $qt_prefix/examples and not in
$qt_prefix/bin or similar.

To achieve that we do two things.

First, deduce the install prefix for each example in the
implementation of qt_internal_add_example (our add_subdirectory
wrapper) and assign it to CMAKE_INSTALL_PREFIX before calling
add_subdirectory. We need to make sure to remove the default
value of CMAKE_INSTALL_PREFIX in the generated
cmake_install.cmake file.

Second, we set an internal variable called
QT_INTERNAL_SET_EXAMPLE_INSTALL_DIR_TO_DOT before the add_subdirectory
call, which will be checked whenever find_package(Qt6Core) is called
in an example project. If the variable is set, the
INSTALL_EXAMPLEDIR var is set to "." in the scope of where Qt6Core
is found.

This ensures that the hardcoded INSTALL_EXAMPLEDIR values in our
example projects are changed to ".".

With both changes, our example project install(TARGET DESTINATION)
calls will now install to
"${CMAKE_INSTALL_PREFIX}/examples/${example_relative_dir}/."

Once all repositories are updated to use qt_internal_add_example
instead of add_subdirectory, we can get rid of the
QT_INTERNAL_SET_EXAMPLE_INSTALL_DIR_TO_DOT workaround.

For repositories that still don't use qt_internal_add_example,
the install prefix rewriting will not happen, but the examples will
still be installed to the proper place because they use their own
hardcoded INSTALL_EXAMPLEDIR value.

Amends d97fd7af2b

Pick-to: 6.2 6.3
Task-number: QTBUG-96232
Task-number: QTBUG-98545
Change-Id: I78c118e10c41b519c570c7d87529afd15aeed900
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-01 16:51:00 +01:00
Alexandru Croitor
1a103beff6 CMake: Shorten ExternalProject example project paths
Instead of nesting the external project build dir under the current
binary dir, place the EP build dir where it would usually be when we
use add_subdirectory.

Shorten the name of the external project to just ${subdir} instead
of using the relative current binary dir path.

Place the EP prefix and stamp dirs under a new ${subdir}-ep folder
next to the example build dir.

Overall this places example executables where you'd usually expect
them to be, as well as shortens a bunch of build paths to circumvent
path limit issues when building on Windows.

Pick-to: 6.2 6.3
Fixes: QTBUG-94608
Task-number: QTBUG-96232
Change-Id: Ifb921c5a6397385e8a914111bf56ee59cda003fd
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-01 16:51:00 +01:00
Alexandru Croitor
209438c16a CMake: Split qt_internal_add_example into two functions
One for building using ExternalProject_Add and one when examples are
built in-tree by calling add_subdirectory directly.

Pick-to: 6.2 6.3
Change-Id: If4c5301163aefed9f15148a70a8f7014bc817ac0
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-02-01 16:51:00 +01:00
Allan Sandfeld Jensen
b954a79e25 CMake: Run export(EXPORT) for prefixed and top-level builds
This is necessary to be able to find Qt6 modules in CMake
ExternalProjects before Qt is installed, regardless of top-level or
per-repo builds.
One use case is examples that are built as ExternalProjects.

Pick-to: 6.2 6.3
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Ic6a9bfd1c52a04e34b221deab40f419a6fee9463
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-02-01 16:51:00 +01:00
Alexey Edelev
f9e48854af Use IMPORTED_LOCATION of rcc target
Use IMPORTED_LOCATION of rcc target when generating Android
deployment settings, instead of the hardcoded host path.

Introduce a helper function to find the location of the imported tool
target.

Change-Id: Icfa51ee7a01b3f58fc4892da03055f9ed531cc0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-02-01 15:06:46 +01:00
Marc Mutz
0d9f4e7526 Make one QT_REMOVED_SINCE/QT_BUILD_REMOVED_API per module
A single global QT_REMOVED_SINCE will start hurting us once more
modules downstream of QtCore start using the mechanism.

With every use of feature, the set of code that needs to compile under
QT_BUILD_REMOVED_API increases. Since we use QT_REMOVED_SINCE in
situations where overloading the new and the old function don't work
in general, this means all code included by any removed_api.cpp needs
to be very carefully written to ensure that any calls to the overload
set formed by the combination of old and new function(s) don't create
ambiguities.

Likewise, the set of APIs that change semantics under
QT_BUILD_REMOVED_API also increases. At some point, the combination of
removed_api.cpp including almost every module header and almost every
header exposing source-incompatibilities when included in
removed_api.cpp will make maintenance a headache.

By making QT_REMOVED_SINCE and QT_BUILD_REMOVED_API per-module
(QT_CORE_REMOVED_SINCE, ...), easy now that we generate the export
macros using CMake, we limit the scope of this problem to the module
using the feature. Downstream modules (say, QtWidgets) will now see
the QtCore API like every other user, even in the
widgets/compat/removed_api.cpp TU.

Pick-to: 6.3
Change-Id: I177bc7bd5aa8791639f97946c98e4592d2c7f9d9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-01 11:47:58 +00:00
Thiago Macieira
05e029619f CMake: fix running of headersclean targets when CMAKE_CXX_FLAGS is set
We were passing the full option from the user as a single string in the
command-line to the compiler.

clang++ -c "-O3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes" [...]
error: invalid integral value '3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes' in '-O3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes'

Pick-to: 6.2 6.3
Fixes: QTBUG-100315
Change-Id: I6fcda969a9e9427198bffffd16ce83150d4e4263
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-31 19:07:58 -08:00
Alexey Edelev
1d28fd7a9c Restore missing Qt definitions
Restore the 'QT_NO_JAVA_STYLE_ITERATORS' and
'QT_NO_NARROWING_CONVERSIONS_IN_CONNECT' definitions for Qt
targets.

Add the function that adds global definitions for Qt targets according
to the provided scope and the target property-based switch to disable
the definition for a specific target.

Pick-to: 6.2 6.3
Task-number: QTBUG-100295
Change-Id: I28697e81f9aabc45c48d79aae1e5caea141e04e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-31 17:40:43 +01:00
Allan Sandfeld Jensen
7e591453be Fix finding GSSAPI
The package is called mit-krb5-gssapi on Ubuntu, and the LIBDIR variable
was missing an underscore.

Pick-to: 6.3 6.2
Change-Id: I85b5603c1161f33462aa71bbd522d40dd7489405
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-29 11:46:04 +00:00
Alexandru Croitor
c8621da852 CMake: Fix host UiTools being picked up instead of target one
Pick-to: 6.2 6.3
Fixes: QTBUG-100233
Change-Id: Id4b30841ba9e499f462325f882218edf407e0a00
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-01-27 00:17:14 +01:00
Yuhang Zhao
c532a57670 Fix build with clang-cl
1. Clang-CL can't recognize "/d2FH4" and it's causing
lots of warnings when compiling. So don't apply it
when building with clang-cl.
2. The definition of "FS_INFORMATION_CLASS" need to
be visible to clang as well. Don't know why it was
excluded originally.

Pick-to: 6.3
Change-Id: I7b6e14999eea0ba1f0d73962ff03a35548f88a5a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-25 14:09:31 +08:00
Joerg Bornemann
33af62db37 CMake: Support overriding CMAKE_BUILD_TYPE per-repo or test
One might want to build qtbase in Release, but qtsvg or some test in
Debug mode. Before if qtbase was configured as Release, there was no
way to override that.

Now we try to detect whether a custom build type was specified to
qt-cmake / qt-configure-module / qt-cmake-standalone-test /
qt-internal-configure-tests

Note mixing won't work on Windows due to different C/C++ runtimes.

Also, now we don't force set a single build type when a multi config
generator is used as well as one opts out via the
QT_NO_FORCE_SET_CMAKE_BUILD_TYPE variable.

Pick-to: 6.2 6.3
Change-Id: I6dc4325087ff7f905ad677d87b0267e2f3e4693f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-21 14:24:09 +01:00
Alexandru Croitor
0d5dc56554 CMake: Display CMAKE_BUILD_TYPE when including QtSetup
This will show the CMAKE_BUILD_TYPE that was computed for a configured
repo or standalone tests, after the logic in
QtBuildInternalsExtra.cmake is executed.

Pick-to: 6.2 6.3
Change-Id: Ib8ffa2c7806a4c16385a2fcd4500f8a0f6a9aa88
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-21 14:24:09 +01:00
Ulf Hermann
6442fbafcd CMake: Add OUTPUT_TARGETS option to qt_internal_add_resource
We need it for shadertools.

Change-Id: I9e9c76e535e5cd698564b48beedb7380b08173e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simeon Kuran <simeon.kuran@gmx.at>
2022-01-20 19:36:00 +01:00
Alexandru Croitor
158287c726 CMake: Add support building Qt with the 'mold' linker
The mold linker is a new linker for Linux that provides faster link
times compared to BFD ld, ld.gold and lld.

It can be found at https://github.com/rui314/mold

To build Qt with mold, ensure that the binary in your PATH and then
configure Qt with with either

 cmake /path/to/qtbase -DINPUT_linker=mold

or

 /path/to/qtbase/configure --linker mold

The change was tested with gcc 9, clang 10, clang 12, mold
1.0.0. Only qtbase and qtdeclarative (and dependencies) were tested.

Pick-to: 6.2 6.3
Task-number: QTBUG-99270
Change-Id: I2e64a1f4257c37ff5b64a9326e548b9b46e07c80
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-20 19:01:27 +01:00
Edward Welbourne
fba863a87e Fix minor grammar error in configure's closing message
Minor glitch in wording, but it's been bugging me for months.

The meaning of "try to remove [a file]" implicitly says you might be
unable to do so; while the attempt might help with your situation, the
experiment might merely be a diagnostic, e.g. because if you can't
remove the file, that would imply things that would help you solve
your problem.  For contrast, "try removing [a file]" says removal
might actually solve the problem for which this action is proposed as
a fix.

Change-Id: Ic995cfdef1523094bb368dcda8bd0d2bbd2e9434
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-20 19:01:27 +01:00
Thiago Macieira
34a67431e4 CMake: Merge QCC with GCC and Clang
Because that's what it is.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c144ef04d68d83
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-20 01:57:06 -03:00
Pino Toscano
099e0fff61 CMake: add support for GNU/Hurd
Add a "HURD" CMake platform specification, so it can be properly
checked in the build system.

Set QT_DEFAULT_MKSPEC to the existing hurd-g++ mkspec.

Hurd supports $ORIGIN in RPATH, so enable it.

Hurd uses X11, so add it to the X11_SUPPORTED list.

Enable few more feature checks that apply to Hurd as well: either
because they are provided by GNU libc itself, or because they are
implemented on Hurd.

Check and set the ELF interpreter, as it is a common functionality of
the GNU toolchain.

Change-Id: Id347033560bbc5a2a4e2c3abb493c948c002b40e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-19 01:53:14 +01:00
Alexandru Croitor
9198a9b8cc CMake: Fix qt_run_linker_version_script_support to use active linker
The version script compile test did not use the linker that the build
system determined to use to link Qt, but rather the system linker.

Run qt_run_linker_version_script_support only after the global qtbase
features have been evaluated and make sure to include the active
linker flags.

Pick-to: 6.2 6.3
Change-Id: I0ff82406828daaf0dc5ec25a55f53ac7d98e3347
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-01-18 14:28:57 +01:00
Alexandru Croitor
d6066d53fa CMake: Fix detection of linker availability
Previously we passed flags like -ld-fuse=lld only to compile
calls, but not to the link call of a compile test project.

Make sure to pass it to the link call instead by using
check_cxx_source_compiles + CMAKE_REQUIRED_LINK_OPTIONS
instead of
check_cxx_compiler_flag.

Note the flag that is passed is still via passed via the
compiler launcher and not directly to the linker.

Remove duplicate flag handling code.

Pick-to: 6.2 6.3
Change-Id: I1bf90573904a9df83240b6debfee3cc9e425c6bb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-18 14:28:57 +01:00
Alexandru Croitor
461f68c5c9 CMake: Fix dbus headers not being added in qt_internal_extend_target
The generated dbus headers would not appear in IDE source lists
because of incorrectly named variables.

Pick-to: 6.2 6.3
Change-Id: I276d4284eb94b98cc75f791de62ca332ad947004
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-01-18 10:18:54 +01:00
Marc Mutz
208cfad9ad Clang: don't error out on -Wdeprecated-enum-enum-conversion
Same treatment as is given to GCC further below.

Pick-to: 6.3 6.2
Change-Id: I3762c39a0b5d9add365ecf828b80d3ba432578c2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-18 04:07:14 +01:00
Joerg Bornemann
037fd545c4 CMake: Propagate qtbase's CMAKE_STAGING_PREFIX to Qt modules
When qtbase is configured with CMAKE_STAGING_PREFIX set, then Qt modules
built against this qtbase should also get CMAKE_STAGING_PREFIX by
default.  Like CMAKE_INSTALL_PREFIX in regular builds, this prefix will
be determined by the location of QtBuildInternalsExtra.cmake to support
building Qt modules against an installer-provided Qt.

CMAKE_INSTALL_PREFIX on the other hand must be exactly the value that
was provided when building qtbase.

If CMAKE_STAGING_PREFIX is specified by the user, honor it.

To opt out of automatically setting CMAKE_STAGING_PREFIX, set
QT_BUILD_INTERNALS_NO_FORCE_SET_STAGING_PREFIX to ON.

Remove the old code that was supposed to set CMAKE_STAGING_PREFIX.

Pick-to: 6.2 6.3
Fixes: QTBUG-99666
Change-Id: I20edef54c102ca9784fcdef0decf0bd83266ae11
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-18 00:20:37 +01:00
Morten Johan Sørvig
bb8c73ab9e wasm: modernize pthreads option
Use “-pthreads” instead of “-s USE_PTHREADS=1”. This
is both a compile and linker option.

Pick-to: 6.3
Change-Id: Iaf7cb4ec41577fe596c3e81fda05c03fe0074c08
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-17 09:01:14 +00:00
Joerg Bornemann
ae294a42f0 CMake: Add C/C++ compiler options to C/C++ sources only
When compiling CUDA sources in a user project, the Qt6::Platform target
would pull in C/C++ related compiler flags, leading to compiler errors.

Make sure that we only add those flags to C/C++ source files.

Pick-to: 6.2 6.3
Fixes: QTBUG-99548
Change-Id: Idbccd65fe8f66abd1da3fce95e563065d1ed3cc6
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-01-08 18:08:10 +01:00
Alexey Edelev
28da24a1a6 Enable -bigobj by default for Qt
Add '-bigobj' for MSVC and '-Wa,-mbig-obj' for MINGW to the
PlatformCommonInternal compiler options.

Pick-to: 6.3
Change-Id: I706b83d189a116a3ab6f93d59593e237e66b0e2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-07 15:21:18 +01:00
Joerg Bornemann
faa26be44c CMake: Fix WrapOpenSSL package
Since f19ce3898e we link OpenSSL to
QTlsBackendOpenSSLPlugin instead of QtNetwork itself.  In dependent Qt
repositories this leads to the following situation:

QTlsBackendOpenSSLPlugin's dependencies call
find_dependency(WrapOpenSSLHeaders), and OpenSSL_FOUND is set to ON in
that scope.  Later, we call find_package(WrapOpenSSL) in a different
scope.  find_package(WrapOpenSSLHeaders) bails out early, because the
target WrapOpenSSLHeaders::WrapOpenSSLHeaders exists.
find_package(OpenSSL) is not called again.  The check for OpenSSL_FOUND
fails, because the variable is not visible in the scope of
FindWrapOpenSSL.cmake, and we don't create the WrapOpenSSL::WrapOpenSSL
target.

Fix this by checking for the existence of the target OpenSSL::SSL
instead of the OpenSSL_FOUND variable.

Pick-to: 6.2 6.3
Fixes: QTBUG-99623
Change-Id: Idd0e8a60fabd0c7772413d557442c0012b0b436c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-01-07 11:16:21 +01:00
Kai Köhne
6205cb161d Update copyright year to 2022
Pick-to: 5.15 6.2 6.3
Change-Id: If6f1d6f9f82a601f8e2b6d36650d6e737518aa60
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-01-04 12:44:19 +01:00
Dimitrios Apostolou
63ffae3fa3 Introduce qt-testrunner.py
Script that wraps Qt test execution in order to iron-out flakiness.

Task-number: QTBUG-96353
Change-Id: Ie8ee780e3f4f8d086c080a7784f9f68fd1867be2
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-01-03 16:32:56 +01:00
Alexey Edelev
8e2f101a6b Exclude sources from HEADER_MODULE if cmake version is less than 3.19
CMake versions less than 3.19 don't support adding the source files to
the PRIVATE scope of the INTERFACE libraries. It looks like these
PRIVATE sources are only used by IDEs to display them in a project
tree. Skip them to avoid configuring issues.

Fixes: QTBUG-99316
Pick-to: 6.3
Change-Id: Id03f540ac9c94e920adfae5de4f364bd7aba4613
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-03 14:35:13 +01:00
Alexey Edelev
f90221d8cd Replace ANDROID_ABI argument with the QT_ANDROID_ABI target property
This change tries to make the API more user friendly and prevent wrong
use of multi-abi API. ANDROID_ABI argument of qt6_add_executable was
position-depend and needed to be placed after the executable 'sources'.
Using the target property we solve this problem and provide more
consistent and common way to enable multi-abi build for the single
target.

This meanwhile also requires to execute multi-abi build configuration
in the finalizer, since the property might be set at any point.

Also the priority of the QT_ANDROID_ABI target property now is higher
than the priority of the QT_ANDROID_BUILD_ALL_ABIS variable. So target
will only build packages with the ABIs specified in QT_ANDROID_ABI
property if both are set.

Pick-to: 6.3
Task-number: QTBUG-88841
Change-Id: I3515297ed267974498913c59619433dc234ec217
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-03 14:35:13 +01:00
Ievgenii Meshcheriakov
a7b70ee55b CMake: Add CryptoTokenKit framework for macOS
Set ${FWCryptoTokenKit} when the framework has been found.
This is useful for WIP card reader support in QtConnectivity.

Task-number: QTBUG-97946
Change-Id: I0e85e0fd2e0fc45fb3069bbdaa2d8b2c927a6c2d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-23 18:11:36 +01:00