summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
...
* CMake: Print prefix info when building qtbaseAlexandru Croitor2022-04-191-0/+9
| | | | | | Pick-to: 6.2 6.3 Change-Id: Ib76d94b1c51f99d5ce007d463d97b5d2b256d2bf Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: An -extprefix -developer-build should install by defaultAlexandru Croitor2022-04-191-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously if -extprefix /tmp/sysroot (CMAKE_STAGING_PREFIX) -developer-build (FEATURE_developer_build) were specified, but -prefix (CMAKE_INSTALL_PREFIX) was not, the build system would set the CMAKE_INSTALL_PREFIX to the qtbase build dir. Then, if targeting desktop, this would be considered a non-prefix build (ninja install would refuse to work), whereas in a cross-build it would be considered an installable build. In both cases though, the rpath of installed binaries would point to the qtbase build dir (because CMAKE_INSTALL_PREFIX would be set to the qtbase build dir). This is quite confusing behavior, in more than one way. Change the build system to consider that an explicit -extprefix should cause Qt to always be installed, even if -developer-build is specified. This means the installed rpaths and on-device install prefix (CMAKE_INSTALL_PREFIX) will now use the default computed install prefix, e.g. /usr/local/Qt It also means that to get a non-installable developer + custom staging and install (on-device) prefix build, users will have to be explicit and set all the options -extprefix ~/qt/qtbase_build_dir -prefix /usr -developer-build Pick-to: 6.2 6.3 Change-Id: Ib560452a4b4778860e0fd7666c76f8a6745773ee Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow no install + custom on-device prefix for desktop buildsAlexandru Croitor2022-04-193-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow such a combination - staging prefix (CMAKE_STAGING_PREFIX / -extprefix) set to the qtbase build dir - install prefix (CMAKE_INSTALL_PREFIX / -prefix / on-device prefix) set to some custom location even for non-cross builds. An example would be configure -prefix /usr \ -extprefix ~/qt/qtbase_build_dir CMake will put the Qt libraries in the qtbase build dir, ninja install will not be required, but ultimately in order to run applications, the Qt libraries are expected to be in /usr. Support for this scenario was originally added for cross-builds in 062318feb2d3b7598409c7e81e4459c2f4607764 , but not desktop builds. Such a build is useful when you want to have install rpaths different from where Qt is initially installed to (the staging prefix). This case doesn't really happen often when targeting desktop platforms, it's mostly used for cross-compilation (e.g yocto). Being able to have the same setup with a desktop build is nevertheless useful for faster iteration on build system issues in such a scenario. Amends 062318feb2d3b7598409c7e81e4459c2f4607764 Pick-to: 6.2 6.3 Change-Id: I42be3628a30025f14eebaf0a79401b54e95cde26 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* configure: Add newline between configure summary and build instructionsTor Arne Vestbø2022-04-191-1/+1
| | | | | | | | | | | | | Otherwise we get: Styles ................................. Basic Fusion Imagine iOS Material Universal macOS Windows -- Qt is now configured for building. Just run 'cmake --build . --parallel' Pick-to: 6.2 6.3 Change-Id: Ie8d009455e4f45c9eb0557c4a08e9d0a94030c3a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Explicitly check for atomic addition and relaxed load operation supportMoody Liu2022-04-181-15/+19
| | | | | | | | | | | | | ...and properly find and link against `libatomic` using find_library. This fixes the qtdeclarative build on the RISC-V platform. Initial-patch-by: Sprite <SpriteOvO@gmail.com> Pick-to: 6.2 Pick-to: 6.3 Task-number: QTBUG-99234 Change-Id: I2b5e4812886ce45cb02bed3106ce8c519b294cbe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* wasm: use emscripten::val for specialHTMLTargetsLorn Potter2022-04-151-1/+1
| | | | | | | | | | | We need to add specialHTMLTargets to EXPORTED_RUNTIME_METHODS in order to use it, as Emscripten does not export it. Also, EM_ASM is not allowed for SIDE_MODULES, so it's better to use emscripten::val methods. Change-Id: I9b352ac98e2a961157f5bb36456bec3e35891270 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: remove SAFE_HEAP=1Morten Sørvig2022-04-131-1/+0
| | | | | | | | This adds significant run-time overhead and should not be on by default. Pick-to: 6.3 Change-Id: I33d312e31bd714f696d8acf2066eb4b285ff04af Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Suppress cmake warning about empty string argumentAlexey Edelev2022-04-121-1/+7
| | | | | | | | | | | | | | | When generating .pc files there is a warning when executing QtFinishPkgConfigFile.cmake: Ignoring empty string ("") provided on the command line. This happens because the 'postfix' argument is a part of the script command line even if it's empty. It also makes no sense to check if 'postfix' is empty using genex, use configuring-time check instead. Pick-to: 6.2 6.3 Change-Id: If52d9634f4885caefb828976b3c99592a6db3d3c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix check for pcre2 using cmakeJonas Kvinge2022-04-081-1/+1
| | | | | | | | | | | | | | When PCRE2 is compiled using cmake, a pcre2 cmake file is installed and Qt fails to configure because components isn't specified for find_package. In recent PCRE2 releases components needs to be specified for find_package. Fixes: QTBUG-102358 Pick-to: 6.2 6.3 Change-Id: Ib842b2c4b1c0bf38aa5da5475eaa2b3c56c6b822 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Map the 'verbose' configure option to CMakeAlexey Edelev2022-04-062-1/+3
| | | | | | | | Raise the CMake log level to STATUS when the 'verbose' argument is passed to the configure script. Change-Id: I736d95ab66b115f8416eec7f9e2ee96d1580c78d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Build system: Allow user to enable Intel CETYuhang Zhao2022-04-061-0/+15
| | | | | | | | | | | | | | | | | MSVC: https://docs.microsoft.com/en-us/cpp/build/reference/guard-enable-eh-continuation-metadata?view=msvc-170 https://docs.microsoft.com/en-us/cpp/build/reference/cetcompat?view=msvc-170 GCC: https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Instrumentation-Options.html Clang: Don't know where's the documentation but should use the same parameter with GCC. Change-Id: I654618e45743a5ad1394c930932b9d0044572725 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Reorganize work with graphical libraries on INTEGRITYTatiana Borisova2022-04-053-0/+33
| | | | | | | | | | | | - Currently we manually unpack all platform libraries, that are required for GUI apps, and pack it into single eglmegapack.a library. It could be better do not execute such additional step, but have possibility to add required graphical libs to cmake interface lib via toolchain file list variable. Pick-to: 6.2 6.3 Change-Id: Ic4122600f02e6828d528ee4f00075f8c27f42e38 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow specifying custom install dir for non-EP examplesAlexandru Croitor2022-04-041-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Originally, QT_INTERNAL_EXAMPLES_INSTALL_PREFIX was added to control the installation of examples when they are built as ExternalProjects, and was not considered for the non-EP case because we hoped to switch entirely to EP-based building. Due to some unsolved issues regarding using EP builds in CI, add the ability to control the installation of non-EP examples. This will be used in the CI to allow removing the hacky INSTALL_EXAMPLEDIR and INSTALL_EXAMPLESDIR assignments in example projects. It is also likely that we will not deprecate the non-EP based building, because it is useful for IDE integration (EP targets are not as developer-friendly to work with in an IDE in regards to rebuilding). Amends 98c89c8cc1c5ceb4bfbb5f5ed6c96ecdbab99afa Pick-to: 6.2 6.3 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I02264aaa1daa2c80bb9ef3d02b1831b4ca5d2b84 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Rename QT_INTERNAL_CUSTOM_INSTALL_DIRAlexandru Croitor2022-04-042-6/+8
| | | | | | | | | | | | | | | | to QT_INTERNAL_EXAMPLES_INSTALL_PREFIX so it's clear that the variable only affects the location of where examples are installed. And make sure the paths are passed as CMake paths. Amends 1031fa15472bba3f20691cda2305e0821391c5db Pick-to: 6.2 6.3 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: Ib92c55488b736d980da2bd88255de78e183de824 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow passing -v to ninja when building examples as EPsAlexandru Croitor2022-04-041-0/+7
| | | | | | | | | | | | | | | | | | | | By default when building ExternalProjects, even if the main ninja invocation has -v passed, that won't be passed to the nested ninja calls. When building examples in the CI, we want to see the full command line invocations. Allow passing -v to the nested EP ninja calls by configuring Qt with -DQT_INTERNAL_VERBOSE_EXAMPLES=ON, which we will use in our CI. We don't want to add -v by default because if the main ninja does not have one, the nested calls will still be verbose. Pick-to: 6.2 6.3 Change-Id: Ifd4b312c6eaa7354e8870f4fb0a77fadf0f33ab7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Pass -v to ninja when using ctest --build-and-testAlexandru Croitor2022-04-041-1/+3
| | | | | | | | | | | | | | | | | So we can see the command line invocations of the built cmake auto tests. To achieve that, we create a ninja shell script wrapper, because ctest --build-and-test does not currently allow specifying custom build tool options. Details at https://gitlab.kitware.com/cmake/cmake/-/issues/22443 Pick-to: 6.2 6.3 Change-Id: I7fb3b7f7f802943a7013c859b2cf39842a34e2e4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Make possible to set android SDK/NDK roots from environmentAlexey Edelev2022-04-041-0/+14
| | | | | | | | | Read the ANDROID_<SDK|NDK>_ROOT environment variables in qt toolchain file and use them to chainload the android toolchain file. Pick-to: 6.2 6.3 Change-Id: I1940ffbaa557974fc26005f4d051030f2cc5c7e0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add WASM testrunnerDavid Skoland2022-03-312-0/+5
| | | | | | | | | Add a python script that allows us to run wasm tests in CI, along with the necessary cmake logic to install the script and execute tests accordingly. Change-Id: I93b95c115538c4e27b2b833405acab8162be2a8a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* configure: Add mold to helpTasuku Suzuki2022-03-311-1/+1
| | | | | | | | Pick-to: 6.2 6.3 Task-number: QTBUG-99270 Change-Id: I08ee2b328a1dba2bf0172e5a03ddb32925401d3b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix picking of the binary_for_strip project locationAlexandru Croitor2022-03-292-20/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix binary_for_strip project not being found when the following conditions were met: - building a repo other than qtbase - qtbase sources are not available on the machine (usually happens in CI where only the current repo sources are available). The issue was that QT_CMAKE_DIR would always be defined, regardless of which repo was being built and the system would incorrectly assume the location of the project files. The fix is to always pick up the sources from qtbase's source dir if they are available (this time done with an appropriate check), otherwise use the installed files. Note that the behavior of always using the qtbase sources if available is not exactly the best, but it is a more general issue that affects other code too. In the name of consistency, make it so for the binary_for_strip project as well, but add TODOs in code to address the situation in a separate change. Amends 39f657032b5e65bfcb93472201f6607c0388ba37 Pick-to: 6.2 6.3 Fixes: QTBUG-102064 Task-number: QTBUG-88090 Task-number: QTBUG-101653 Change-Id: I0649f945e9ff0ab1f597c51bb5ab389fa665c021 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't hardcode the library directory nameChristophe Giboudeaux2022-03-291-1/+1
| | | | | | | | | | | Using INSTALL_LIBDIR is the only reliable way to get the library install directory. Amends: d1c56073b4cf3346168413e7d931c63355307e9d Pick-to: 6.2 6.3 Change-Id: Ib8c4fb8b4d339c63209393d7fdb3d1c3425b03a4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix handling of the CROSSCOMPILING_EMULATOR propertyJoerg Bornemann2022-03-251-2/+3
| | | | | | | | | CROSSCOMPILING_EMULATOR is a target property, not a test property. Fixes: QTBUG-87864 Pick-to: 6.2 6.3 Change-Id: Icb07e9ed71a6bcbfceb7aa2116bf56eaa0a545c6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix typo in configuration summary messageAlexandru Croitor2022-03-251-1/+1
| | | | | | | | Amends 384dfceb532cada5f4be96430c8c7c866f40c933 Pick-to: 6.2 6.3 Change-Id: Ica36551b64899848ab40e507ddf002af55b7db8c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Disable SAFE_HEAP_LOG for wasmDavid Skoland2022-03-251-1/+0
| | | | | | | | | | This option completely ruins the output when running test, as it logs every single safe heap operation. I don't think this detailed logging is necessary or reasonable in a normal debug build. Pick-to: 6.3 Change-Id: I4bb740299d631d21453f9b4a8959634801fb3a1e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* CMake: Generate and use a wrapper script for stripping binariesAlexandru Croitor2022-03-243-0/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MinGW 11.2.0 comes with a strip.exe that strips the ".gnu_debuglink" section in binaries, a section that is needed for the separate debug information feature. binutils version 2.34 mentions the feature for the first time: https://sourceware.org/binutils/docs-2.34/binutils/strip.html#strip To ensure the debuglink section is preserved, generate a shell wrapper that calls the original strip binary with an extra option to keep the required section. To determine if the option is supported, we build a real shared library on which strip will be called with the --keep-section option. If the option is not supported, a wrapper is not generated and the stock strip binary is used. This logic only applies when targeting Linux and MinGW + a shared library Qt. For other targets, the stock strip binary is used. Developers can opt out of this logic by passing -DQT_NO_STRIP_WRAPPER=TRUE when configuring each Qt repo. Pick-to: 6.2 6.3 Fixes: QTBUG-101653 Change-Id: Idd213d48d087d3c9600c853362aebaba348cde33 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Enable verbose autogen for cmake auto tests and EP examplesAlexandru Croitor2022-03-241-0/+1
| | | | | | | | | | | | | | So we can see the exact moc invocations when debugging issues in the CI. For ExternalProject examples, it is conditional on whether Qt is configured with QT_INTERNAL_VERBOSE_EXAMPLES set to ON, otherwise calling the main ninja without -v will end up cluttering the output with AUTOGEN output. Pick-to: 6.2 6.3 Change-Id: I6468ab0e461b3be283e2428e3515cae4d5986242 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Enable debug verbosity for cmake auto tests and EP examplesAlexandru Croitor2022-03-241-0/+3
| | | | | | | | | | | | | | | | | | | | Since e2a0ddbb69640c94b4ee107260a088d5c1c7e273 , if Qt is configured as a non-developer-build, some of the CMake tests that include QtSetup would have their CMAKE_MESSAGE_LOG_LEVEL set to the reduced NOTICE value. Make sure that tests always have a DEBUG level, so that if they fail in the CI, we have more info on what goes wrong. For ExternalProject examples, it is conditional on whether Qt is configured with QT_INTERNAL_VERBOSE_EXAMPLES set to ON, otherwise calling the main ninja without -v will end up cluttering the output a non default log level. Amends e2a0ddbb69640c94b4ee107260a088d5c1c7e273 Pick-to: 6.2 6.3 Change-Id: Icd3b6e0fcc6c73e4b53b6c4a6d8354c96077a050 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Mention where the configure summary can be foundAlexandru Croitor2022-03-231-0/+9
| | | | | | | | | | | | | | | | | | when configuring for the first time. Also mention how to increase output verbosity. Unfortunately there is no way to check what is the current log verbosity to only show the latter message conditionally. Setting --log-level does not assign the same value to CMAKE_MESSAGE_LOG_LEVEL. Amends e2a0ddbb69640c94b4ee107260a088d5c1c7e273 Pick-to: 6.2 6.3 Change-Id: I22101b9dc7c407cc54aa5e7964dec50c7490f8f5 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CI: QNX qemu need docker service ports explicitly defined for visibilityPasi Petäjäjärvi2022-03-211-0/+2
| | | | | | | | | | | | Network autotests cannot connect to services on docker containers from QNX qemu without all ports explicitly defined (both host and container) side. Pick-to: 6.2 6.3 Task-number: QTQAINFRA-4684 Change-Id: Iba44cfa17d42d43ecec3e29985e404f75d5fc232 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
* Install QtCopyFileIfDifferent as the 'public' cmake helperAlexey Edelev2022-03-211-1/+1
| | | | | | | | | | | QtCopyFileIfDifferent needs to be both installed and copied to a build folder as a public CMake helper. Otherwise it's not found when building tests inside the Qt build tree. Pick-to: 6.2 6.3 Fixes: QTBUG-101916 Change-Id: I8d081e594fe694f528ebac4c13bbdf6d3b8402b9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QtPlatformSupport: add support for detecting webOSJanne Juntunen2022-03-211-0/+4
| | | | | | | | | | Some autotest CMakeLists.txts need to know whether the target is webOS. This change enables that. Task-number: QTBUG-101933 Pick-to: 6.3 Change-Id: I7b4ebe89622a4ad8bc313e807d9fa50152c96d14 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Unify DEPFILE support checkAlexey Edelev2022-03-211-0/+14
| | | | | | | | | Add common function that unifies the check for the DEPFILE support. Update the check according to the recent CMake version. Task-number: QTBUG-99354 Change-Id: Ia2abf46fe3a9a3d17ea7a37eaf6c9c6a697c5b84 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Mitigate moc not finding correct headers in framework buildsAlexandru Croitor2022-03-181-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CMake generates compilation rules, it extracts the values from INTERFACE_INCLUDE_DIRECTORIES and checks if any of the values are framework paths. If they are, instead of adding an -I ./lib/My.framework to the compilation rules, it adds -iframework ./lib or -F ./lib. The same transformation does not happen when AUTOMOC passes include paths to moc, nor during a headersclean check. The values there are passed verbatim, with an -I prepended. This causes issues when the include file name is the same as the framework name. E.g. #include <QtQml> + -I ./lib/QtQml.framework because moc then ends up silently including the shared library ./lib/QtQml.framework/QtQml instead of the header ./lib/QtQml.framework/Headers/QtQml This can lead to a variety of silent issues during moc generation, because all the definitions of QtQml will be missing. Unfortunately, there does not seem to be a clean way to fix this in the build system due to CMake semantics. See https://gitlab.kitware.com/cmake/cmake/-/issues/23337 for details. We can mitigate the issue by ensuring that -I ./lib/QtQml.framework/Headers comes before -I ./lib/QtQml.framework by manipulating the order of values in INTERFACE_INCLUDE_DIRECTORIES. We might want to consider implementing an additional mitigation in AUTOMOC, so that it filters out include paths like -I ./lib/QtQml.framework, thus ensuring that a newer CMake version will not exhibit the same issue when used with an older Qt. We could consider doing the same in moc. The advantage of doing it in moc is that that moc will consider fewer invalid include paths when searching for headers. Amends 4b2de41b13eb71c0ce841ef357768a3913b49810 Amends d7efb2a419a88c8f512b98194c8f7bc81dbe942b Pick-to: 6.2 6.3 Fixes: QTBUG-89545 Fixes: QTBUG-101718 Fixes: QTBUG-101775 Change-Id: Ib2c25b5744bd2b5c9c83813bb04ad88c0179f6ec Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Bump QT_DEPRECATED_WARNINGS_SINCEMårten Nordheim2022-03-181-1/+7
| | | | | | | | | When building Qt we should have warnings of any internal use of deprecated API, so set it to Qt7. Also added comments to clarify what the macros do. Change-Id: Ib47278fed9ab1ec4411ed9f69a9a9c0f811db02d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove the LINK_LANGUAGE genex condition when generating .pc fileAlexey Edelev2022-03-171-0/+1
| | | | | | | | | | | | Conditions with the LINK_LANGUAGE genex are not parsed correctly when generating .pc file. So link options will be added unconditionally. Amends d1e02c385539ce971fbad207ba9aaa32be9c7bac Pick-to: 6.2 6.3 Fixes: QTBUG-101723 Change-Id: Ib837b3f3429d195a469450ef25af9630ad7d15e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add VERBATIM option to add_custom_command callsAlexey Edelev2022-03-174-3/+5
| | | | | | | | | | | Use VERBATIM option to prepare the correct command line for the add_custom_command. This especially sensitive when using build directories with names containing special symbols, that cannot be handled by shell correctly. Change-Id: I51d7041cb806411135fd59bf6273c04a3c695443 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't rely on CMAKE_FIND_ROOT_PATH_MODE_PACKAGE for examplesAlexandru Croitor2022-03-161-9/+4
| | | | | | | | | | | | | | | | | We shouldn't set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH when cross-building examples without ExternalProjects. Instead append the $build_tree_prefix to CMAKE_FIND_ROOT_PATH and $build_tree_prefix/lib/cmake to QT_EXAMPLES_CMAKE_PREFIX_PATH to circumvent the usual CMake path-rerooting issue. This ensures that the build-tree Config files are found by the in-tree find_package calls when cross-building examples. Pick-to: 6.2 6.3 Task-number: QTBUG-96232 Change-Id: I4e31f0bf3dbfeb4339823fe09addda3ae83f12c3 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix cross-building examples in prefix builds as ExternalProjectsAlexandru Croitor2022-03-161-13/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For examples to successfully find not yet installed Config files in a prefix cross-build, both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH need to be adjusted when toolchain files set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY. Before this change, we lacked two things. 1) If the chain-loaded toolchain file sets CMAKE_FIND_ROOT_PATH (instead of appending), then the initial value of CMAKE_FIND_ROOT_PATH that was passed by ExternalProject's initial cache would be overridden. 2) The prefixes we passed via QT_EXAMPLES_CMAKE_PREFIX_PATH did not end in lib/cmake, to work around the path re-rooting problem in CMake. We can handle both of these points by using QT_ADDITIONAL_PACKAGES_PREFIX_PATH which was introduced for Conan usage. Each value assigned to QT_ADDITIONAL_PACKAGES_PREFIX_PATH gets prepended to CMAKE_FIND_ROOT_PATH by qt.toolchain.cmake AFTER the original toolchain file is chain-loaded. And each value also gets lib/cmake appended and assigned to both CMAKE_PREFIX_PATH and _qt_additional_packages_prefix_paths (used by Qt6Config.cmake.in to work with find_package + NO_DEFAULT_PATH). This is exactly what we need to ensure examples build. Pick-to: 6.2 6.3 Task-number: QTBUG-96232 Change-Id: I11a52457ff795a6661a3a7b68e823e0615d0ce89 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add '-stdlib=libc++' only for c++ compilersAlexey Edelev2022-03-141-2/+6
| | | | | | | | | Pick-to: 6.2 6.3 Task-number: QTBUG-101602 Change-Id: I4ecbb73f845d94156189acfd1a3074b676c90fc4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Enable QT_TYPESAFE_FLAGS in headerscleanGiuseppe D'Angelo2022-03-121-0/+1
| | | | | Change-Id: Ie40a18af7f97b73ea79a09e0dea3fe08c56a1ebb Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* build system: support module local definitionsFabian Kosmale2022-03-115-0/+28
| | | | | | | | | | | | | | | | | | | This introduces a new helper function, qt_internal_add_repo_local_defines and makes use of it in qt_internal_add_{module,test,executable,benchmark,plugin}. That function checks whether QT_EXTRA_INTERNAL_TARGET_DEFINES is set. If it is, the defines listed in there will be aded to all targets passed to the functions mentioned above. The intended usage is that QT_EXTRA_INTERNAL_TARGET_DEFINES gets set in the repository local .cmake.conf. This allows e.g. opting in to source incompatible changes in leaf modules (as long as those are guarded by some define). Pick-to: 6.2 6.3 Fixes: QTBUG-101640 Change-Id: I06c3693ee69f46e95a48de724621f0c97e7cc3a8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake:Android: Use ANDROID_PLATFORM instead of ANDROID_NATIVE_API_LEVELAssam Boudjelthia2022-03-117-11/+18
| | | | | | | | | | | | | | | | | | | | ANDROID_NATIVE_API_LEVEL is an alias for ANDROID_PLATFORM and the Android's CMake docs [1] uses directly ANDROID_PLATFORM so let's use that as well. Also, NDK r23b seems to have removed the part of code from android.toolchain.cmake that handles ANDROID_NATIVE_API_LEVEL to set the correct value to ANDROID_PLATFORM. With this change, CMake will pass the value from the configure argument -android-ndk-platform as -DANDROID_PLATFORM instead of -DANDROID_NATIVE_API_LEVEL. Otherwise, if if -DANDROID_NATIVE_API_LEVEL is passed directly to CMake, it should work as before. [1] https://developer.android.com/ndk/guides/cmake#build-command Pick-to: 6.3 Task-number: QTQAINFRA-4837 Change-Id: I5c21af53ac91e11a27c4b033313d22d1115c1abc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* configure: Don't escape backslashes in passed configure argumentsAlexandru Croitor2022-03-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It broke drive-less (no C:\ prefix) paths passed to configure. Invoking configure on Windows with the following args qtbase/configure -- -DCMAKE_INSTALL_PREFIX=\Users\qt\work\install called CMake with -DCMAKE_INSTALL_PREFIX=\\Users\\qt\\work\\install saying Qt will be installed into '//Users/qt/work/install' and while the build succeeded, installation would fail with CMake Error at cmake_install.cmake:41 (file): file cannot create directory: //Users/qt/work/install/lib/cmake/Qt6BuildInternals. Maybe need administrative privileges. Note the double slash in the beginning is likely interpreted as a Windows share URI / UNC path. The same would happen when passing -prefix '\Users\qt\work\install' As a reminder, we want to support drive-less prefix paths because that's what Qt's Coin CI uses passes to ensure DESTDIR installation works correctly. Amends cb7f4030bc89471aa6489be60ac1c728a3dfd06b Pick-to: 6.2 6.3 Fixes: QTBUG-94366 Change-Id: I9267b6f784babfbdaeafc65267ba96c75fa24112 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Enable -mno-direct-extern-access and ELF protected visibilityThiago Macieira2022-03-102-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -mno-direct-extern-access tells the compiler and linker that references to symbols outside this ELF module mustn't be direct and must instead always go through the GOT or PLT (the PLT can additionally be disabled with -fno-plt). The ELF protected visibility tells the compiler and linker that this symbol is present in the dynamic symbol table as an export, but it cannot be interposed by another ELF module. This option is required for user code to link properly to Qt, otherwise they will get linker errors (assuming GNU binutils >= 2.39) or runtime failures (glibc >= 2.35). Both versions of glibc and binutils are older than GCC 12, so it's a safe assumption they are in use and downgrading the toolchain or libc is not supported. Adding this option to the compilation is assured for CMake and qmake-based projects. For example, all accessess to QCoreApplication::self in QtCore, after this change and with GCC 12 are relocation-free and direct: 000000000013ebf0 <QCoreApplicationPrivate::checkInstance(char const*)>: 13ebf0: cmpq $0x0,0x4f73d0(%rip) # 635fc8 <QCoreApplication::self> 13ebf8: setne %al 13ebfb: je a90fe <QCoreApplicationPrivate::checkInstance(char const*) [clone .cold]> 13ec01: ret Meanwhile, accesses to the same variable in other modules are indirect via the GOT: 66650: mov 0x876e1(%rip),%rax # edd38 <QCoreApplication::self@Qt_6> 66657: cmpq $0x0,(%rax) This replaces the -Bsymbolic and -Bsymbolic-functions (broken) functionality that Qt has been using or attempting to use since ~2006. See https://gitlab.com/x86-psABIs/x86-64-ABI/-/issues/8#note_606975128 Change-Id: Iad4b0a3e5c06570b9f5f571b26ed564aa0811e47 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: add detection of x86 VAES and AVX512VBMI2 featuresThiago Macieira2022-03-082-2/+6
| | | | | | | | We have VAES code in qhash.cpp that isn't getting compiled right now. Change-Id: Ibf4acec0f166495998f7fffd16d6961261dec361 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: Generate wrapper shell scripts for all hosts when requestedAlexandru Croitor2022-03-042-27/+70
| | | | | | | | | | | | | | | | | | | | | | | | This is useful for Qt for Android builds, where we want to build Qt on a single host, but make the Qt installation usable on any host (Windows, Linux, macOS). There are only two flavors of shell scripts, unix ones that use sh and Windows batch files. If Qt is configured with -DQT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS=ON then we generate both of them regardless of the current host platform. Note that the target_qt.conf file still needs to be patched to specify a correct HostSpec value so that qmake operates correctly. Other target_qt.conf values might also need path adjustments depending on use case (like HostPrefix and HostData). Pick-to: 6.2 6.3 Task-number: QTBUG-101357 Change-Id: Ic86caaa8b318467528cc82dc7fbfecde998cdb71 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Make configure less verbose by defaultAlexandru Croitor2022-03-042-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | Only show the more verbose configure output when configuring with -developer-build (which matches --log-level=STATUS) Otherwise in a non-developer build, restrict the output to NOTICE+ message (includes WARNINGs and ERRORs). Developers can still pass a custom log level when configuring. For example -DCMAKE_MESSAGE_LOG_LEVEL=STATUS or --log-level=STATUS. The former method will be cached, while the latter is only applied to the current configure invocation. Also show the build instructions hint message only when configuring for the first time. [ChangeLog][CMake][configure] The configure output verbosity of non developer-builds of Qt is now reduced by default. Pass "-- --log-level=STATUS" to configure to make it verbose again. Pick-to: 6.2 6.3 Change-Id: I7583a9c92142e0b1d7c5411b06403f40d8ebaf20 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* wasm: enable mobile native keyboardingLorn Potter2022-03-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This works on iOS and Android, and Windows with touchscreen. On Android, we need to listen to the input event of a hidden text element and synthesize Qt keyboard events from that in order to get input events into Qt. On Windows, we need to be more creative about bringing the native virtual keyboard up. Because the entire canvas is contenteditable, we need to specify the inputmode is set to 'none', otherwise the v keyboard pops up when user clicks anywhere on the canvas. Therefore we set a hidden element as contenteditable, which pops up keyboard when Qt needs it for editable widgets. On Android, this is the same element that is used to proxy the keyboard input. [ChangeLog][wasm] Add support for native mobile keyboard Done-with: Morten Johan Sørvig <morten.sorvig@qt.io> Fixes: QTBUG-83064 Fixes: QTBUG-88803 Change-Id: I769fe344fc10c17971bd1c0a603501040fe82653 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Bootstrap: Make compiler warnings fatalKai Köhne2022-03-021-5/+6
| | | | | | | | | Prevent compiler warnings from creeping into the bootstrap library. Pick-to: 6.3 Change-Id: I8054416564c91fee256cad616911dd4ad231d0df Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add the _qt_internal_android_executable_finalizer wrapper functionAlexey Edelev2022-03-021-4/+2
| | | | | | | | | | | | _qt_internal_android_executable_finalizer wraps Android-related function that are needed to created an Android package. The function is added to the INTERFACE_QT_EXECUTABLE_FINALIZERS property in Qt Core so it's called implicitly for user projects. Pick-to: 6.3 Change-Id: I140f53341691dcfdc6ae2ddea520818cf2834eb6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>