summaryrefslogtreecommitdiff
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* CMake: Rename FindZSTD to FindWrapZSTDAlexandru Croitor2022-02-281-16/+18
| | | | | | | | | | | | And the target ZSTD::ZSTD to WrapZSTD::WrapZSTD. This should allow building Qt with the -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON set. Pick-to: 6.2 6.3 Fixes: QTBUG-100537 Change-Id: I748601e4ad6f518323bf1034d6fc1de582c815e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake build: generate pkgconfig for public modulesMartin Reboredo2022-02-288-18/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the update to the CMake based build system the ability to generate pkgconfig files, like it was with QMake, was lost. This patch adds pkgconfig generation again via a new internal command named qt_internal_export_pkg_config_file. The functionality of this command consists in checking if the target is internal. Then gets the compile definitions. It performs a search for dependencies that is somewhat similar to qt_get_direct_module_dependencies, although it won't recurse down for more deps. Each dependency is then again, checked if it's internal or has a public interface. Later these deps get deduplicated and lastly a pkgconfig file is filled. The resulting pkgconfig files of many of the Qt6 packages were validated via invocations of `pkg-config --validate` and `pkg-config --simulate` commands and later used to build local projects plus tests that use the pkg-config provided details at compilation time. Although it has some limitations, with qt_internal_add_qml_module if it specifies non-public deps these won't be listed and with non-Qt requirements, notably in static builds, not being appended to the PkgConfig file. Task-number: QTBUG-86080 Change-Id: I0690bb3ca729eec328500f227261db9b7e7628f6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* configure: CMake: Add -no-prefix optionAlexandru Croitor2022-02-243-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new -no-prefix option that can be used to build Qt without having to install it. Currently, -no-prefix is already implied by -developer-build, but -developer-build also implies -warnings-are-errors and -feature-private-tests, which not everyone might want to use. Some Qt builders likely use -developer-build for the no-prefix behavior, hence we introduce a standalone -no-prefix option to offer a nicer user experience without -Werror and friends. Previously it was possible to achieve the same by specifying -prefix $PWD, but that relies on $PWD expanding property in the used shell. The new -no-prefix doesn't depend on the type of the shell and is shorter to type. Internally this gets passed by configure as -DINPUT_no_prefix=yes to CMake, and transformed into a -DQT_FEATURE_no_prefix=ON feature. The feature also gets automatically auto-detected to ON if developer-build is set, -prefix is either unset or $PWD. CMake code should still query QT_WILL_INSTALL to decide whether files need to be installed or not. As a drive-by, we now also export QT_FEATURE_developer_build to be available for querying during configuration of other repos (previously it was only possible to query FEATURE_developer_build). Pick-to: 6.2 6.3 Change-Id: Iaa6c8d8ae2b736282e9949d2a5d7f412e290a253 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Read QT_HOST_PATH from the environment tooJoerg Bornemann2022-02-242-5/+12
| | | | | | | | | | | For cross-compiled conan packages we need conan to export QT_HOST_PATH as an environment variable. The Qt build now picks up this environment variable if no QT_HOST_PATH cache variable was specified. Pick-to: 6.2 6.3 Change-Id: I0c3e15e82842061d5db81949ffcc1c240f6ed6a4 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Forward QT_ADDITIONAL_(HOST_)PACKAGES_PREFIX_PATH to try_compileJoerg Bornemann2022-02-241-0/+2
| | | | | | | | | | All variables that are used in qt.toolchain.cmake should be recorded in __qt_toolchain_used_variables. This is mostly done for consistency and to avoid surprises in future configure checks. Pick-to: 6.2 6.3 Change-Id: I1ae18c5dfe9677c5f46a102e434e32187cb0d703 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Fix the mapping between configure arguments and CMake variablesAlexey Edelev2022-02-241-3/+3
| | | | | | | Pick-to: 6.2 6.3 Fixes: QTBUG-101172 Change-Id: Ie1e01880911e771eedbf29b0d2d0607bc25b0549 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix QT_ADDITIONAL_(HOST_)PACKAGES_PREFIX_PATH environment variablesJoerg Bornemann2022-02-232-2/+12
| | | | | | | | | | | | | | | | | Except on Windows, the values in CMake environment variables that contain path lists are separated by colons, not semicolons. See documentation of CMAKE_PREFIX_PATH. This is necessary for conan's virtualenv generator which sets these environment variables with native list separators. This amends commit e044c94a61f0cd2bdea1e89be4ec3c68007f7a5c. Pick-to: 6.2 6.3 Task-number: QTBUG-94524 Change-Id: I7f3d140a8462347b181f1d9601fd11cc1ba449db Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix exclusion of QtFoo in QtBarDepends for 3rd party libsAlexandru Croitor2022-02-233-22/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When configuring a static Qt with the -qt-zlib option and the build system creates a 3rd party header module QtZlib, syncqt does not generate a QtZlib header file that would include all its public headers. Then when the QtSvgDepends header is generated, it would add an #include <QtZlib> which would break compilation of the QtSvg PCH file (which compiles QtSvgDepends). We have logic to exclude addition of headers from regular 3rd party static libraries, but not header only 3rd party libraries. Adjust the code to handle header-only 3rd party libraries, as well as make sure it works across repos by exporting the relevant properties. As a drive-by, also rename and export some other informational properties. Amends af00402d6446c0f8f085a2a482fc83c4318aa457 Amends 6fdeaea24f9035ad53ba2548a9467b3264cf01ad Amends be2745e4788cecb0d3122081e3328e4b66923609 Pick-to: 6.2 6.3 Change-Id: I087f50b193dd845e4a5ec906e8851d63122faf80 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* wasm: move user configurable settingsLorn Potter2022-02-231-25/+0
| | | | | | | | | | | Both INITIAL_MEMORY and PTHREAD_POOL_SIZE are settings users can change, they are not interface settings. Fixes: QTBUG-100693 Pick-to: 6.3 6.2 Change-Id: Ie1547c7f52c9fe109a313260616705728024b6b8 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* CMake: Add INSTALL_DIR argument to qt_internal_add_appJoerg Bornemann2022-02-221-3/+10
| | | | | | | | | | | | | | Add the possibility to install a Qt app into a directory different from ${INSTALL_BINDIR}. If INSTALL_DIR is not specified, qt_internal_add_app still installs to ${INSTALL_BINDIR}. Pick-to: 6.2 6.3 Task-number: QTBUG-99295 Task-number: QTBUG-100047 Change-Id: I52371aa0f770d80c32bb0b3442ce3c463916be63 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: avoid unused parameters in cmake testsTim Blechmann2022-02-223-3/+3
| | | | | | | | | | unused parameters in cmake tests cause the tests to fail when the project is configured with `-Werror,-Wunused-parameter` Change-Id: If3065d008753a7718282dfc6ba0d79d46576cb34 Pick-to: 6.2 6.3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Install 3rdparty headers for static buildsMichal Klocek2022-02-194-1/+93
| | | | | | | | | | | | | | | | | | | | | | | | | For static builds we need 3rdparty headers to be installed. Leaf modules like qtwebengine needs 3rdparty libs and header for zlib, freetype, harfbuzz, png, jpeg. Without those the Chromium bundled versions are used, however it might end up badly if qt has already bundled one. Introduce new header only modules with additional arguments for qt_internal_add_module: * EXTERNAL_HEADERS to pick exactly which headers are public * EXTERNAL_HEADERS_DIR to include whole directory preserving the files directory structure Fix qtsync so it keep directory structure for all non-qt modules when syncing headers and do not generate warnings for headers files. Task-number: QTBUG-87154 Task-number: QTBUG-88614 Change-Id: If1c27bf8608791cd4e0a21839d6316a445a96e9f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix cross-build without qt.toolchain.cmakeJoerg Bornemann2022-02-181-3/+4
| | | | | | | | | | | | If there's no qt.toolchain.cmake used, QT_HOST_PATH_CMAKE_DIR is not set. Use the location calculated from the Qt6HostInfo package in that case. This amends commit e044c94a61f0cd2bdea1e89be4ec3c68007f7a5c. Pick-to: 6.2 6.3 Change-Id: I99aed8e920b8c1aa6efd8f18301cc34aca5559ca Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Add default launch screen storyboard for iOS appsAlexandru Croitor2022-02-164-3/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bundle a default LaunchScreen.storyboard file for an iOS app and make sure it's referenced in the generated Info.plist file. When launching Qt examples, it ensures the app uses the whole screen space on the device rather than just a square-ish part of it. The storyboard file is a copy of the qmake one, which qmake adds to the Xcode projects it generates. A custom launch screen can be provided either by setting the QT_IOS_LAUNCH_SCREEN variable or by setting the QT_IOS_LAUNCH_SCREEN target property. The value must be an absolute path to the launch screen file. The automatic addition of the launch screen entry in the Info.plist file can be prevented by setting the QT_NO_SET_IOS_LAUNCH_SCREEN variable to TRUE. The automatic bundling of the launch screen file in the application bundle can be prevented by setting the QT_NO_ADD_IOS_LAUNCH_SCREEN_TO_BUNDLE variable to TRUE. The current implementation has a limitation that only one launch screen storyboard and one iOS executable can exist within a project. If there are multiple executables in the project, all of them will use the launch screen that is specified last (the last qt_add_executable call). Because of this limitation, the API is marked as Technical Preview, to be improved upon in the future. For now it simply serves as an improvement to the out-of-the-box experience of iOS apps built with CMake. Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e Pick-to: 6.2 6.3 Fixes: QTBUG-95837 Change-Id: I6b067d703d635122959a1ef17fcca713da694a86 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Introduce QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATHJoerg Bornemann2022-02-154-24/+77
| | | | | | | | | | | | When installing conan packages we have one installation prefix per package. When cross-building a conan package, we need to make known those multiple host prefixes to Qt, analogous to QT_ADDITIONAL_PACKAGES_PREFIX_PATH. Pick-to: 6.2 6.3 Fixes: QTBUG-94524 Change-Id: I68cbede350f95266a5fd3559e9b9c214c5858eed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add BUILTIN_TESTDATA option to qt_internal_add_testAlexey Edelev2022-02-111-4/+31
| | | | | | | | | | | Multiple tests use qt_internal_add_resource that copies the functionality that is already implemented inside the qt_internal_add_test function. Simplify these test by replacing the qt_internal_add_resource call with the new BUILTIN_TESTDATA option. Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: enable machine_tuple also on GNU/HurdPino Toscano2022-02-111-1/+1
| | | | | | | | 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>
* Add missing include of QtPublicCMakeHelpersAlexey Edelev2022-02-101-0/+1
| | | | | | | | | | Amends 2201934efa1b9889d474347e705784bf6925e120 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>
* Use 'copy' but not 'copy_if_different' on Windows platformsAlexey Edelev2022-02-104-0/+38
| | | | | | | | | | | | | | 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>
* CMake: Handle slashes in qt_internal_add_exampleAlexandru Croitor2022-02-091-0/+13
| | | | | | | | | | | | | | 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>
* configure: Switch error to warning when -skip used in per-repo buildAlexandru Croitor2022-02-091-6/+4
| | | | | | | | | | | | | Yield a warning instead of an error that -skip and -submodules have no effect in a per-repo build. Amends acaba632605ac22aa3da4c3cf8e5891cb9cde657 Adjusts to 11ae0e772cccd3028771c1380f077c605224cc19 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>
* Fix the run of _check targets in multi-config buildsAlexey Edelev2022-02-091-2/+8
| | | | | | | | | | | 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>
* CMake: Assign proper postfixes in multi-config buildsAlexandru Croitor2022-02-091-2/+29
| | | | | | | | | | | | | | | | | | | | | | 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>
* 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>