summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Fix rpath set for Qml plugins to not contain lib64Alexandru Croitor2022-02-031-0/+5
| | | | | | | | | | | | | | | | | | | | | 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>
* configure: Raise error if -skip/-submodules is used in per-repo buildAlexandru Croitor2022-02-031-0/+10
| | | | | | | | | 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>
* configure: Introduce -submodules optionAlexandru Croitor2022-02-032-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* configure: Allow specifying a comma separated list to -skip optionAlexandru Croitor2022-02-032-3/+16
| | | | | | | | | | | | | | | | 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>
* CMake: Temporarily disable building external examples in prefix buildsAlexandru Croitor2022-02-031-1/+9
| | | | | | | | | | | | | | | | | | | 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 98c89c8cc1c5ceb4bfbb5f5ed6c96ecdbab99afa 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>
* Add qt_internal_undefine_global_definition functionAlexey Edelev2022-02-023-17/+23
| | | | | | | | | | | | | | | | 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>
* Use builtin test data on IntegrityAlexey Edelev2022-02-021-1/+1
| | | | | | | | | 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>
* Handle glib optional components properlyIlya Fedin2022-02-021-19/+31
| | | | | | | | 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>
* CMake: Allow installing examples outside of the Qt prefixAlexandru Croitor2022-02-012-1/+14
| | | | | | | | | | | | | | | | | | | 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>
* CMake: Build examples as ExternalProjects in prefix buildsAlexandru Croitor2022-02-012-27/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 d97fd7af2bc5c89a0ad9e5fac080041b78d01179 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>
* CMake: Copy FindFoo.cmake scripts to build dir in prefix buildsAlexandru Croitor2022-02-011-0/+11
| | | | | | | | | | | | | | 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>
* CMake: Deduce install prefix of example in qt_internal_add_exampleAlexandru Croitor2022-02-011-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 d97fd7af2bc5c89a0ad9e5fac080041b78d01179 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>
* CMake: Shorten ExternalProject example project pathsAlexandru Croitor2022-02-011-3/+15
| | | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: Split qt_internal_add_example into two functionsAlexandru Croitor2022-02-011-5/+12
| | | | | | | | | | | 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>
* CMake: Run export(EXPORT) for prefixed and top-level buildsAllan Sandfeld Jensen2022-02-011-7/+11
| | | | | | | | | | | | | | | 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>
* Use IMPORTED_LOCATION of rcc targetAlexey Edelev2022-02-014-0/+46
| | | | | | | | | | | 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>
* Make one QT_REMOVED_SINCE/QT_BUILD_REMOVED_API per moduleMarc Mutz2022-02-011-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: fix running of headersclean targets when CMAKE_CXX_FLAGS is setThiago Macieira2022-01-311-1/+1
| | | | | | | | | | | | | | 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>
* Restore missing Qt definitionsAlexey Edelev2022-01-312-0/+76
| | | | | | | | | | | | | | | | | 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>
* Fix finding GSSAPIAllan Sandfeld Jensen2022-01-291-2/+5
| | | | | | | | | 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>
* CMake: Fix host UiTools being picked up instead of target oneAlexandru Croitor2022-01-271-0/+1
| | | | | | | Pick-to: 6.2 6.3 Fixes: QTBUG-100233 Change-Id: Id4b30841ba9e499f462325f882218edf407e0a00 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Fix build with clang-clYuhang Zhao2022-01-251-1/+1
| | | | | | | | | | | | | 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>
* CMake: Support overriding CMAKE_BUILD_TYPE per-repo or testJoerg Bornemann2022-01-213-7/+53
| | | | | | | | | | | | | | | | | | | | | 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>
* CMake: Display CMAKE_BUILD_TYPE when including QtSetupAlexandru Croitor2022-01-211-0/+2
| | | | | | | | | | 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>
* CMake: Add OUTPUT_TARGETS option to qt_internal_add_resourceUlf Hermann2022-01-201-1/+5
| | | | | | | | We need it for shadertools. Change-Id: I9e9c76e535e5cd698564b48beedb7380b08173e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Simeon Kuran <simeon.kuran@gmx.at>
* CMake: Add support building Qt with the 'mold' linkerAlexandru Croitor2022-01-201-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix minor grammar error in configure's closing messageEdward Welbourne2022-01-201-1/+1
| | | | | | | | | | | | | | | 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>
* CMake: Merge QCC with GCC and ClangThiago Macieira2022-01-201-14/+1
| | | | | | | | | 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>
* CMake: add support for GNU/HurdPino Toscano2022-01-193-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: Fix qt_run_linker_version_script_support to use active linkerAlexandru Croitor2022-01-182-1/+12
| | | | | | | | | | | | | | | 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>
* CMake: Fix detection of linker availabilityAlexandru Croitor2022-01-183-16/+36
| | | | | | | | | | | | | | | | | | | | 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>
* CMake: Fix dbus headers not being added in qt_internal_extend_targetAlexandru Croitor2022-01-181-2/+2
| | | | | | | | | | 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>
* Clang: don't error out on -Wdeprecated-enum-enum-conversionMarc Mutz2022-01-181-0/+6
| | | | | | | | 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>
* CMake: Propagate qtbase's CMAKE_STAGING_PREFIX to Qt modulesJoerg Bornemann2022-01-182-12/+9
| | | | | | | | | | | | | | | | | | | | | | | 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>
* wasm: modernize pthreads optionMorten Johan Sørvig2022-01-171-2/+2
| | | | | | | | | | | 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>
* CMake: Add C/C++ compiler options to C/C++ sources onlyJoerg Bornemann2022-01-081-2/+7
| | | | | | | | | | | | 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>
* Enable -bigobj by default for QtAlexey Edelev2022-01-071-1/+8
| | | | | | | | | 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>
* CMake: Fix WrapOpenSSL packageJoerg Bornemann2022-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Since f19ce3898e0257dac1112754b1a84c24486bda01 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>
* Update copyright year to 2022Kai Köhne2022-01-041-1/+1
| | | | | | | 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>
* Introduce qt-testrunner.pyDimitrios Apostolou2022-01-032-0/+3
| | | | | | | | 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>
* Exclude sources from HEADER_MODULE if cmake version is less than 3.19Alexey Edelev2022-01-031-3/+12
| | | | | | | | | | | | | 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>
* Replace ANDROID_ABI argument with the QT_ANDROID_ABI target propertyAlexey Edelev2022-01-032-0/+10
| | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: Add CryptoTokenKit framework for macOSIevgenii Meshcheriakov2021-12-231-0/+1
| | | | | | | | | 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>
* CMake: Remove WinRT leftovers from build systemYuhang Zhao2021-12-183-15/+1
| | | | | | | Qt's WinRT support was removed long time ago. Change-Id: I60b220e970072c3450e3793862d6f68801d2b5b3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix exit code to be shown properly on test failureAlexandru Croitor2021-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | The result variable was expanded at configure time rather than at script execution time due to missing escaping. A tidbit of information, the result variable can contain not only an exit code, but a string as well. For example on arm macOS with a crashed test it contains 'SIGTRAP'. Curiously if the crashing executable is executed directly without CMake, 'Trace/BPT trap: 5' is shown instead, perhaps because of the shell. Amends 3ef6af024be43bc18352796df61542a241192583 Pick-to: 6.2 6.3 Change-Id: I50e57922abfc6eccde205c6252eebfda510bad41 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Fix errors about missing qt_setup_tool_path_command.bat.inJoerg Bornemann2021-12-152-6/+3
| | | | | | | | | | | | | | | | This amends commit 0bea727cac6b22af05e0ae68b02de6684c98667b or rather reverts it and applies a different fix for QTBUG-98843. Use file(WRITE) instead of configure_file or file(CONFIGURE). This command doesn't have the line endings issues in CMake 3.19 (see QTBUG-98843). It's not problematic that the .bat file gets a new timestamp on every configuration step, since we don't add dependencies on it. Fixes: QTBUG-99223 Task-number: QTBUG-98843 Change-Id: Ibdcd0e4703bf6df42c6a6d0bb2f35c5144bbe30a Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QtTestHelpers: print exit code upon failureFabian Kosmale2021-12-151-1/+1
| | | | | | | | This might give a few insights into why the process has failed, at least if distinct return values are used for different errors. Change-Id: I61fe0ede812c4dda3d0cf0f2c96a479d198d340d Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* MSVC: Optimize global data to reduce binary sizeYuhang Zhao2021-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | Package global data in COMDAT sections for optimization. According to the docs, this can significantly reduce the size of the resulting binary executable. I've tested build Qt with /Gw locally with and without LTCG, the result shows /Gw can reduce the binary size indeed, but not "significantly". The result also reveals that exes can benefit much more from /Gw than dlls. The result can be seen from the QTBUG-98894 bug report. Microsoft Docs: https://docs.microsoft.com/en-us/cpp/build/reference/gw-optimize-global-data?view=msvc-170 Task-number: QTBUG-98894 Change-Id: Ibce34c98e791e519d669a5fe39c0027d1459c382 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Support configure -platform linux-clang-libc++Allan Sandfeld Jensen2021-12-143-0/+22
| | | | | | | | Detect libc++ config and add appropriate compiler and linker flags. Pick-to: 6.3 Change-Id: I9ec91b3ace987599d4e79e43b1b75aa67cd5caeb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use the highest-available android SDK version as the 'target' SDKAlexey Edelev2021-12-141-15/+26
| | | | | | | | | | | | When building Qt we want to use the highest available 'target' SDK version. If the version of the available SDK is lower than the minimum required 'target' SDK version, we need to throw an error. Pick-to: 6.2 6.3 Fixes: QTBUG-99165 Task-number: QTBUG-98870 Change-Id: Ib75567a6f33ac6d23d9f79e8ed8535839c08b91d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>