summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-enable QT_NO_NARROWING_CONVERSIONS_IN_CONNECT for QtGiuseppe D'Angelo2021-10-131-0/+1
| | | | | | | | | | This define used to be set for the entirety of the Qt build but was lost during the qmake->CMake transition. Re-enable it. Change-Id: Idc4cb6ada485158559485b60f62f76439550b255 Pick-to: 6.2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix config tests not finding module-provided CMake packagesJoerg Bornemann2021-10-131-1/+6
| | | | | | | | | | | | | | | | This amends commit 165e01d5d51d16377542c1b3ffbc22f03fb75e97. Above commit broke the code that adds "${PROJECT_SOURCE_DIR}/cmake" to CMAKE_MODULE_PATH. The semicolon that separates entries of CMAKE_MODULE_PATH must be escaped. Otherwise, the semicolon separates elements of the flags list. Additionally, fix the QT_AVOID_CUSTOM_PLATFORM_MODULES code path which lacked the addition of "${PROJECT_SOURCE_DIR}/cmake". Pick-to: 6.2 Change-Id: I72f78cf066cabe6b0002dce1aa0294aa0dc9cbf0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix build with CMake 3.16Joerg Bornemann2021-10-131-3/+7
| | | | | | | | | | | Do not read the target property LINK_LIBRARIES from interface libraries as this leads to errors with CMake 3.16. This amends commit 326b91ea788b013512ae911c51cc19497d88916d. Pick-to: 6.2 Change-Id: I44251c7633d5ecd977cd05746ac311dd1285d1e3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix missing QT.<module>.run_depends entries in module .pri filesJoerg Bornemann2021-10-121-17/+118
| | | | | | | | | | | | | | | | | | | | | | | | | The .pri files for public Qt modules were missing run_depends entries. Those entries are used by qmake when linking plugins of a static Qt build. In shared builds, run_depends entries are used to decide whether to add the -rpath-link argument to the linker. In that matter, run_depends entries serve a similar purpose as CMake's IMPORTED_LINK_DEPENDENT_LIBRARIES. In Qt5, run_depends entries consist of the qmake values QT_PRIVATE and QT_FOR_PRIVATE. QT_PRIVATE contains the Qt modules that are privately linked to the public module, and QT_FOR_PRIVATE are the dependencies of the private module. That loosely translates to LINK_LIBRARIES of the public module and INTERFACE_LINK_LIBRARIES of the private module. Private modules whose public counterparts are already public dependencies don't have to be added to run_depends. Pick-to: 6.2 Fixes: QTBUG-84310 Change-Id: If7025c98ea462a2d5a143202df3d98d88e4fee08 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't use libs in /usr/local for configure tests by default on macOSJoerg Bornemann2021-10-081-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit f3c7d22dd04afe8d889585fb5d6426f3d4591e74 we do not use libraries from /usr/local and other non-system locations on macOS. But our configure tests still did. This led to discrepancies between find_package calls in configure tests and the Qt project itself. Mentioned commit removed /usr/local and friends from CMAKE_SYSTEM_PREFIX_PATH. But we can't pass this variable to the configure tests, because CMake sets it up and overwrites our value. Pass CMAKE_SYSTEM_PREFIX_PATH and CMAKE_SYSTEM_FRAMEWORK_PATH as QT_CONFIGURE_TEST_CMAKE_SYSTEM_{PREFIX|FRAMEWORK}_PATH variables to tests. Tests with separate project files that call find_package() must add code like this after the project() command: if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH) set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH}") endif() if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH) set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}") endif() Adjust pro2cmake accordingly. Task-number: QTBUG-97076 Change-Id: Iac1622768d1200e6ea63be569eef12b7eada6c76 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Generate relative #line directives in qlalr outputJoerg Bornemann2021-10-081-1/+10
| | | | | | | | | | | | | When passing an absolute input file name to qlalr, the #line directives in the output will contain absolute paths. For reproducible builds, it's desirable to have relative paths. Pass the input file as relative path to qlalr to produce relative #line directives. Fixes: QTBUG-96267 Change-Id: I4ef1e4d5be7cbaf25a54a34ab7c2dbec06411a1d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Ensure that UNIX is set for INTEGRITYJoerg Bornemann2021-10-055-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain platform-related variables, in this case UNIX, must be set in a platform module, because they get cleared after the toolchain file is loaded. Such platform modules live in upstream CMake, but there is none yet for INTEGRITY. This manifests in an undefined UNIX variable and "System is unknown to CMake" warnings for the project and every configure test. Add the CMake module "Platform/Integrity" in the cmake/platforms directory. Add this directory to CMAKE_MODULE_PATH to let CMake load Platform/Integrity when the toolchain file set CMAKE_SYSTEM_NAME to "Integrity". CMake's module directory takes precedence, when loading platform modules. This is special for platform modules and different from the documented behavior of CMAKE_MODULE_PATH and include(). In case the user wants to provide their own platform modules via CMAKE_MODULE_PATH, they can instruct Qt to not add its path by setting QT_AVOID_CUSTOM_PLATFORM_MODULES to ON. Make sure that configure tests with project files also load the custom platform module. Pick-to: 6.2 Fixes: QTBUG-96998 Change-Id: I9855d620d24dc66353cec5e847a2675b464ace26 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: add simd supportLorn Potter2021-10-053-0/+12
| | | | | | | | | | | | | | | | | | Emscripten only supports SSE1, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, and 128-bit AVX instruction sets at this time. https://emscripten.org/docs/porting/simd.html Browsers might need to enable simd support in the advanced configurations about: config or chrome:flags Enable by configuring Qt with -sse2 Pick-to: 6.2 Fixes: QTBUG-63924 Change-Id: Ifeafae20e199dee0d19689802ad20fd0bd424ca7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Revert "CMake: Warn if cmake_minimum_required has an unsupported low version"Alexandru Croitor2021-10-046-114/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 657525965b86cfa135bb5a814a537443163acb14. The change relied on reading the last value of the CMAKE_MINIMUM_REQUIRED_VERSION variable before one of the Qt packages is found to use it for the version check. Even if a user project has a cmake_minimum_required() right at the beginning of the project with a supported version specified, the first project() call which loads a CMake toolchain file could contain another cmake_minimum_required() call with a lower (unsupported) version and that version would be used for the check, failing the project configuration. The Android NDK ships such a toolchain file, which requires version '3.6'. Thus, relying on the last value of CMAKE_MINIMUM_REQUIRED_VERSION is not robust enough. Pick-to: 6.2 Task-number: QTBUG-95018 Task-number: QTBUG-95832 Change-Id: Iff3cb0a46e6e878569dce9c5fe915a714a034904 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Don't export Qt6::ATSPI2_nolink target in Qt6GuiTargets.cmakeJoerg Bornemann2021-10-011-9/+21
| | | | | | | | | | | | | | We don't have any APSPI2 includes in our public headers and should therefore not export the target that provides ATSPI2 include paths for consumers. Link against PkgConfig::ATSPI2 instead of the _nolink target. The former will not be exported. Pick-to: 6.2 Fixes: QTBUG-97023 Change-Id: I4b12e0c2230917feeb963c02565e6db24f757bd3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Warn if cmake_minimum_required has an unsupported low versionAlexandru Croitor2021-10-016-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt6Config.cmake calls cmake_minimum_required to ensure a recent enough CMake version is used in projects. That call does not set policies in the calling subdirectory scope, because find_package introduces a new policy scope. If a project using Qt has a 'cmake_minimum_required(VERSION 3.1)' call and is configured with a recent CMake, many policies will still be set to OLD. One such policy is CMP0071 (Run AUTOMOC on GENERATED files). The policy value is queried at generation time rather than at target definition time, which means we can't influence the policy value (e.g. inside the implementation of qt_add_executable for example) The inability to influence the policy value for targets created by our own CMake functions is unfortunate and can lead to issues (in the case of the above policy to compilation / linker issues). Record the version of the last cmake_minimum_required call before the Qt packages are found and error out if the version is lower than the minimum supported one. A project can reduce the error into a warning by specifying a -DQT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT_IN_CMAKE_MIN_REQUIRED=3.xyz option when configuring the project. If the option is used and build issues arise, no official support is given. All the CMake example projects shipped with Qt specify a minimum version of 3.16 already (which is the minimum for shared Qt builds), so it shouldn't be an issue to require that in other user projects as well. Implementation wise, we follow the existing pattern to record what the minimum and computed versions for static and shared Qt builds are at qtbase configure time. These are then checked before the Qt6 or QtFoo packages are find_package'd. Amends 6518bcc167d47e1c27d082c21551b9a838b04e5d Pick-to: 6.2 Task-number: QTBUG-95018 Task-number: QTBUG-95832 Change-Id: I1a1d06d82f566c92192a699045127943604c8353 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Introduce QT_BUILD_ONLINE_DOCS flag for documentation buildsTopi Reinio2021-09-301-2/+10
| | | | | | | | | | | | | | | | | QDoc modifies its linking behavior depending on whether the -installdir command line option was set or not; Without -installdir, QDoc will use 'https://<url>' to link to targets loaded from external documentation modules, instead of using relative paths. Drop the -installdir if QT_BUILD_ONLINE_DOCS was set. This behavior matches the 'build_online_docs' scope that was used for qmake documentation targets, and is useful for documentation projects that are not part of Qt but want to link to Qt docs simply by loading the index files of Qt's modules. Pick-to: 6.2 Change-Id: Ib1bbf7b9d784e0c276d2bc520240af4a6c8ba903 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Only write device prefix to target_qt.conf if necessaryJoerg Bornemann2021-09-281-1/+3
| | | | | | | | | | | | | | | | The device prefix in target_qt.conf is necessary if and only if the prefix on the host is different from the prefix on the device - in CMake terms: if CMAKE_STAGING_PREFIX is different from CMAKE_INSTALL_PREFIX. This removes the [Devices] section from target_qt.conf from our iOS and Android packages, because we don't set CMAKE_STAGING_PREFIX for those platforms. Pick-to: 6.2 Fixes: QTBUG-96906 Change-Id: I1390e952e544e57d5dd3bc09d688a612db9b4247 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix separate_debug_info configure test for cross-compilationJoerg Bornemann2021-09-281-0/+1
| | | | | | | | | | | | | | | The separate_debug_info configure test uses the CMake variable CMAKE_OBJCOPY. CMakeFindBinUtils in the test project finds the host's objcopy despite CMAKE_TOOLCHAIN_FILE being correctly set. We now add CMAKE_OBJCOPY to the list of variables that are passed to configure test projects and remove the CMakeFindBinUtils include, which looks rather internal anyways. Pick-to: 6.2 Fixes: QTBUG-96798 Change-Id: I164c6bd1771e8789e9dd19b50573b33b8866bd3b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Show error in user projects if wasm toolchain file not foundAlexandru Croitor2021-09-274-5/+31
| | | | | | | | | | | Rather than fail with obscure can't find Qt packages errors when the Webassembly CMake toolchain file can not be found, error out with a clear error on how to ensure it is found. Pick-to: 6.2 Task-number: QTBUG-96843 Change-Id: I0f34cdcde05efb25c93017f3fd365186335ed52c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Get toolchain file path from EMSDK env for Wasm user projectsAlexandru Croitor2021-09-272-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Try to to chainload the emscripten CMake toolchain file from the EMSDK env var if it is set, instead of requiring the user to explicitly specify a path to the file via QT_CHAINLOAD_TOOLCHAIN_FILE. The order in which the toolchain file is chainloaded becomes is as follows: 1) The initial toolchain file path that was specified when configuring qtbase is set written as the initial value of __qt_chainload_toolchain_file in qt.toolchain.cmake 2) If EMSDK env var is set, it overrides the value from 1) 3) If QT_CHAINLOAD_TOOLCHAIN_FILE cache var is supplied it overrides the value from 2) Whichever value ends up in __qt_chainload_toolchain_file is checked too see if the file exists. If it exists it gets included, if it doesn't, a warning is issued. This checking logic is a bit crude and should be improved and unified with the Android chainload checking, but the current change already improves the behavior for users of Qt. Pick-to: 6.2 Task-number: QTBUG-96843 Change-Id: I5da58a329f659086aaaee765c9399d0369021b22 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Split and clean up WebAssembly auto-detection codeAlexandru Croitor2021-09-273-35/+83
| | | | | | | | | | | | | | Split qt_auto_detect_wasm into multiple helper functions and place them in a new QtPublicWasmToolchainHelpers.cmake file. We want to use them to try and detect the CMake toolchain file location from within the generated qt.toolchain.cmake file whem configuring a user project. Pick-to: 6.2 Task-number: QTBUG-96843 Change-Id: Id8c2350e6dbe3c994b435681353bdaee114249a7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Skip unnecessary commands when cross-building toolsJoerg Bornemann2021-09-271-0/+8
| | | | | | | | | | | | | | | Introduce a new macro qt_internal_return_unless_building_tools which simply calls return() if tools are not built. This macro is supposed to be called after qt_internal_add_tool(). Using this macro avoids having to special-case code for when qt_internal_add_tool() creates imported targets in cross-builds. Adjust pro2cmake accordingly. Task-number: QTBUG-85084 Change-Id: I9e1c455c29535dd8c318efa890ebd739c42effc1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Bump almost all cmake_minimum_required calls to 3.16Alexandru Croitor2021-09-223-3/+3
| | | | | | | | | | | | Needed for subsequent change that will check and error out if the version is lower than 3.16. We do that to ensure all policies introduced by CMake up to version 3.16 have their behavior set to NEW. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: Ieaf82c10987dd797d86a3fd4a986a67e72de486a Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Rework how installation is prevented in non-prefix buildsJoerg Bornemann2021-09-223-41/+17
| | | | | | | | | | | | | | | | | In non-prefix builds, we want to prevent users from accidentally running "cmake --install". We did that by replacing cmake_install.cmake with an empty file. The responsible target remove_cmake_install is visible in IDEs, appears in the build output, and the approach is hacky. It's cleaner and easier to add bail out code at the top of cmake_install.cmake. This is now done when calling qt_build_repo_begin. As a bonus, print an informative message on installation. Change-Id: I022b36289358ba09cac8b79781f44cd7b93113f7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use only supported values when setting internal QT_FEATURE_ valuesAlexey Edelev2021-09-211-1/+5
| | | | | | | | | | | When setting QT_FEATURE_ values we need to convert the user-provided FEATURE_ values to the one that is supported by QT_FEATURE_. Pick-to: 6.2 Fixes: QTBUG-96300 Change-Id: Idd19fbf7f23f351a6c1cfdcedccfaaf6b0aa6e44 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add missing framework paths to header check targetsAlexey Edelev2021-09-201-0/+15
| | | | | | | | | | | | | | | | | CMake doesn't add framework include paths for the includes if add_custom_command is used. When all Qt modules are installed to a single directory, frameworks could be found under QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX, but for Conan builds each module is installed to the separate directory. These directories need to be listed in the QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables family. This takes into account directories that are listed in the QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables and considers they can contain frameworks. Pick-to: 6.2 Fixes: QTBUG-96511 Change-Id: I664381df4859a2e85c399cd94dc2f3996e452c03 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Pass CMAKE compiler flags to arch detectionAllan Sandfeld Jensen2021-09-201-0/+10
| | | | | | | | | | This fixes the detection of always available architecture based on user set CMAKE flags. Change-Id: I541ac9569766a0fe05f4395c06f2ee3bcd77b035 Fixes: QTBUG-91090 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix main() not being visible on AndroidCraig Scott2021-09-201-0/+8
| | | | | | | | | | | | | | A recent change refactored the call to qt_internal_add_executable(), but that had the unintended side-effect of changing the symbol visibility from public to hidden. That meant that main() became hidden, so while apps still built successfully, they could not be run. Restore the original symbol visibility to fix this regression. Amends d47278fd09f73ddc34011ab980dafc23aa453e71 Pick-to: 6.2 Change-Id: I27d84ab2b0dd013d5c38dcfe55e88f307c4bc5dd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove unused EXE_FLAGS option from qt_internal_add_executable()Craig Scott2021-09-182-3/+1
| | | | | | | | | | The EXE_FLAGS option wasn't being used anywhere in any Qt repo and it had no documentation as to its intended use. Remove it. Pick-to: 6.2 Change-Id: I2f67ec57c1da7dc6eab81d5351361e770d19d7d5 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove TODOs related to checking CMake 3.21 features post-releaseCraig Scott2021-09-182-4/+0
| | | | | | | | | | | These TODOs were left as a marker to be checked once the official CMake 3.21.0 release was made. The things they refer to were included in the CMake 3.21.0 release, so the TODOs can be removed. Fixes: QTBUG-94528 Pick-to: 6.2 Change-Id: I769605de85df657ad056123e787ec9849b77e42f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Do not generate cpp exports for pure STATIC modulesAlexey Edelev2021-09-171-1/+4
| | | | | | | | | | | Static libraries don't need to export their symbols, and corner cases when sources are also used in shared libraries, should be handled manually. Task-number: QTBUG-90492 Change-Id: I5cb0a3f7e280b042b678bdbe4475f2bbf9f6b9ba Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add explicit install rules for the autogenerated cpp exportsAlexey Edelev2021-09-171-8/+38
| | | | | | | | | | | | | | | | | | | If qt_internal_generate_cpp_global_exports is called outside the qt_internall_add_module function scope, install rule that is generated by qt_internall_add_module won't include generated cpp export header files. This adds the explicit file-based install rule for the generated cpp exports. Since qt_internal_generate_cpp_global_exports now encapsulates all install rules related to the generated cpp exports, no need to expose the generated filenames outside the function. It's expected that module public headers now could be added outside the qt_internal_add_module function. Tune generating of the module timestamp by replacing the DEPENDS value with generator expression. Task-number: QTBUG-90492 Change-Id: I0f086abc8187c5d51117c3a75c47b58580f6913f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Ensure _qt_is_android_executable is set for internal executables tooCraig Scott2021-09-171-13/+2
| | | | | | | | | | | | | | | | | The _qt_is_android_executable property is normally set by the _qt_internal_create_executable() command. But various other internal commands don't route through that and go through qt_internal_add_executable() instead. The former is used only by the public API, the latter only by the internal API. Refactor both so that the internal one calls the public one. This ensures all targets receive the same base settings, including the _qt_is_android_executable property. Fixes: QTBUG-96085 Pick-to: 6.2 Change-Id: I157356872c9d942d7be5f1abbbcbac97961b1f40 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Make standalone tests TestsConfig file repo-target-set specificAlexandru Croitor2021-09-162-3/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conan CI builds can built a qt repository in a repo-target-set configuration. An example of that is qtscxml. When building standalone tests, qt_build_tests includes a repo specific TestsConfig.cmake file to call find_package on the modules that were built as part of that repo. That doesn't quite work with a repo-target-set build which is enabled when the repo is built with a QT_BUILD_SINGLE_REPO_TARGET_SET value. The TestsConfig.cmake file would be overridden with different contents on each configuration. Fix that by including the QT_BUILD_SINGLE_REPO_TARGET_SET value as part of the TestsConfig.cmake file to be generated and included. This means that when configuring the standalone tests, the same QT_BUILD_SINGLE_REPO_TARGET_SET value should be passed, so that the correct packages are found. Add some debug statements to allow checking which TestsConfig.cmake file is loaded when the standalone tests are configured with --log-level=DEBUG. Adjusts to 4b09522c23e9efdf83ba8d4af436d8a700ccb66e Amends de3a806def4b9a754825a2233c9d4952a9b2d0eb Amends e7f188b2d2f10941006be7b0e7197b3c1ebdefdb Pick-to: 6.2 Task-number: QTBUG-96253 Change-Id: I7c22aaad88fe8e6fce23046543363316203f6e8d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add missing private cpp exports template to install setAlexey Edelev2021-09-161-0/+1
| | | | | | | | | | | Add missing modulecppexports_p.h.in template to install set. Amends e1fe816d4662875032946844fadfed3ea691fdd8 Task-number: QTBUG-90492 Change-Id: I25db6f98637bd33a1c56f6b098ac76c4292de581 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Expose cpp export related arguments for qt_internal_add_module usersAlexey Edelev2021-09-161-43/+8
| | | | | | | | | | Functions that use qt_internal_add_module under the hood might need to generate cpp exports, e.g. qt_internal_add_qml_module. Append cpp exports related arguments to the qt_internal_add_module arguments set. Task-number: QTBUG-90492 Change-Id: I4fd539bd1d8be4d3e57ed5b1b88dd2dbc2f5ca24 Reviewed-by: Craig Scott <craig.scott@qt.io>
* qdevice.pri: Use cmake separators for the pathMårten Nordheim2021-09-101-0/+2
| | | | | | | | | Because otherwise we may end up with trailing backslashes Pick-to: 6.2 6.2.0 6.1 Change-Id: I7ad24ec34c35f0a7b32241751bbcd2b26a8a23ea Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Avoid implicit linking of plugin init library if finalizers were calledAlexey Edelev2021-09-081-0/+2
| | | | | | | | | | | Propagating of plugin init libraries should take into account plugin finalizers to avoid duplicating of object files in a linker line. Pick-to: 6.2 Fixes: QTBUG-96062 Change-Id: I48feac94b08a7eb08d84134e9e9ae6e7214f5bdd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Remove unnecessary IF DEFINED HOST_PERL checkAlexandru Croitor2021-09-081-3/+0
| | | | | | | | | The variable might be defined to HOST_PERL-NOTFOUND which will return early instead of issuing an error. Change-Id: Id49dfd0fec8f477dad9e816e6128e36059e68702 Pick-to: 6.2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow opting out of building examples as ExternalProjectsAlexandru Croitor2021-09-063-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We default to configuring examples as separate ExternalProjects when using a developer / non-prefix Qt build. This ensures we test that the examples configure successfully without the pollution of the main Qt build (e.g. already found packages). One down-side of this is that a developer's IDE doesn't see these example targets, unless each project is loaded into the IDE separately. This is cumbersome to do when refactoring or renaming code across multiple example projects. Allow configuring the example projects as part of the main Qt build by setting QT_BUILD_EXAMPLES_AS_EXTERNAL to FALSE when configuring Qt. Save the value of the variable in QtBuildInternalsExtra.cmake.in so it's propagated to leaf repositories as well. Amends dab8f64b6d5d4241b678d0227355858071376496 Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Task-number: QTBUG-90820 Task-number: QTBUG-94608 Task-number: QTBUG-96232 Task-number: QTCREATORBUG-26168 Pick-to: 6.2 Change-Id: Ie1f724f74365b3a788b04c3fffe9eb2d0611dd50 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix 'Cannot find source file' error with older CMakesAlexandru Croitor2021-09-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Configuring a static plugin init library with CMake versions earlier than 3.18.0 fails at generation phase with CMake Error at Qt6CoreMacros.cmake:2071 (add_library): Cannot find source file: example/plugins/basictools/pnp_basictools_init.cpp Call Stack (most recent call first): qtbase/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:1998 (_qt_internal_add_library) qtbase/lib/cmake/Qt6/QtPublicPluginHelpers.cmake:243 (qt6_add_library) qtbase/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:1967 (__qt_internal_add_static_plugin_init_object_library) qtbase/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:1989 (qt6_add_plugin) qtbase/plugins/basictools/CMakeLists.txt:1 (qt_add_plugin) Marking the generated file as GENERATED explicitly solves the issue. Similar to e2c6f2ba7ed72195d12e9882c174e59a53317097 Fixes: QTBUG-96197 Pick-to: 6.2 Change-Id: If730a1fcbe6910d6041eb6eba03d6e45a025c424 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't cache QT_SYNCQT across buildsJoerg Bornemann2021-09-032-10/+13
| | | | | | | | | | | | | | | | | | | | | | There is no need for this variable to be stored in CMake's cache. We don't perform expensive operations to set up QT_SYNCQT, and we even unset the cache variable to ensure it gets recomputed on reconfiguration. We still store QT_SYNCQT in a global property, because the function qt_ensure_sync_qt is called in different directory scopes, and we want to avoid re-calculations for every subdir. It's now possible for the user to set QT_SYNCQT (see QTBUG-88088 for motivation). Also, in a non-prefix build, changes to syncqt.pl in the source dir are reflected upon re-configuration in the build tree (because qt_copy_or_install is called on every configure). Pick-to: 6.2 Fixes: QTBUG-88088 Task-number: QTBUG-75290 Change-Id: I6137b060d200d3dafd4a64d5a6c1bd2549723d78 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: fail when configuring for wasm and EMSDK is not foundLorn Potter2021-09-011-1/+6
| | | | | | Pick-to: 6.2 Change-Id: Ic7fb933d8c2b42c3ba84a3b5a6c89a808d971bd1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Update Android default SDK from 29 to 30Juha Vuolle2021-08-271-1/+1
| | | | | | | | | | | By the time of Qt 6.2 release all new apps targeting Play store must target API level 30 (Android 11) or above (starting in 08/2021 for new apps and 11/2021 for existing apps' updates). Pick-to: 6.2 5.15 Task-number: QTBUG-94451 Change-Id: Id7fa2fd62899a7259e365c917292c6c3ac0d2b0d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* CMake: Error out if ccache is requested but not foundJoerg Bornemann2021-08-271-1/+1
| | | | | | | | | | | | | Before, we would just issue a warning which is likely to get overlooked in CMake's output. Also, the configure summary would report "Using ccache ... yes" but CMAKE_<LANG>_COMPILER_LAUNCHER stays unset, which is inconsistent. Make QT_USE_CCACHE=ON and missing ccache a hard error. Task-number: QTBUG-88308 Change-Id: Iddc7f3a91428fd96ad0defbb1ca72bd46a90aa98 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Call MinGW's ld with -Bstatic when requesting static runtime linkageJoerg Bornemann2021-08-271-1/+1
| | | | | | | | | | | The -static argument we used before is supported by ld, but not lld. The latter requires --static or -Bstatic. Use -Bstatic, which is supported by both. Pick-to: 6.2 Fixes: QTBUG-89549 Change-Id: I3c3069661bf4cd20e3298aff4714163b7419d3ef Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Implement generating of private cpp exportsAlexey Edelev2021-08-273-24/+149
| | | | | | | | | | | | | | | | | | | | | | | | | Add the generating of private cpp exports for Qt modules. Add the GENERATE_PRIVATE_CPP_EXPORTS option to qt_internal_add_module that is the manual switch for private exports generator. Existing modules in qtbase doesn't follow any strict convention of using private cpp export. So there is no clue how to detect if generating of the private exports is required or not for the module. Use autogenerated private cpp exports in QtNetwork module. CPP_EXPORT_HEADER_NAME argument of the qt_internal_add_module function is replaced by the CPP_EXPORT_HEADER_BASE_NAME and has a different meaning. The provided name is used as a base name for the private and non-private headers that contains cpp exports. Header files suffixes are constant: .h and _p.h for the non-private and private header files accordingly. Pick-to: 6.2 Task-number: QTBUG-90492 Change-Id: Icf11304e00379fb8521a865965c19b974e01e62f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use correct module include name across the projectAlexey Edelev2021-08-274-53/+161
| | | | | | | | | | | | | | | Module may have specific module include name that should be taken into account when specifying module include directories in different places. The INTERFACE_MODULE_INCLUDE_NAME module property name is aligned to the common naming rules and the property is used to preform include paths instead of the direct use of the module name. Add additional paths generated by qt_internal_module_info to keep them consistent across all cmake files. Pick-to: 6.2 Change-Id: I4c94017abc322c48616f47e65e371bd863bb087d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Warn when PRIVATE_MODULE_INTERFACE is provided with no targetAlexandru Croitor2021-08-261-2/+10
| | | | | | | | | | | | Warn if the PRIVATE_MODULE_INTERFACE option is provided a value, but there is no ${target}Private target to set the interface dependencies on. Pick-to: 6.2 Task-number: QTBUG-95921 Change-Id: I7d4df9cb3aa9b7746d836b82019ecdd9c8f50fdc Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Properly export MODULE_PLUGIN_TYPESAlexandru Croitor2021-08-262-1/+4
| | | | | | | | | | | | | | | | Don't export the MODULE_PLUGIN_TYPES property only when a module has an associated configure.cmake file with features. Instead, always export it if a module defines a plugin type. This fixes qttools DesignerTargets.cmake file to contain the plugin types it defines, given that the Designer lib does not declare any features via a configure.cmake file. Pick-to: 6.2 Task-number: QTBUG-95668 Change-Id: Ic036c31768e03b51d3bce9c2afe48e04f69f435b Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add missing PRIVATE_MODULE_INTERFACEs to INTERNAL_MODULEsAlexey Edelev2021-08-242-0/+10
| | | | | | | | | | | | | | To detect the internal module ouside the qt_internal_add_module function need to mark it with the property. This adds _qt_is_internal_module property to the Qt internal modules. Since PRIVATE_MODULE_INTERFACE only was applicable to pure Private modules, INTERNAL_MODULEs is missing those dependencies if they were specified. Add extra condition to qt_internal_extend_target to link PRIVATE_MODULE_INTERFACE libraries to internal modules as well. Pick-to: 6.2 6.1 Change-Id: I9c32fa5bad3aff365f5d7663349e5365d5f1d72d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Create plugin initializers for static user pluginsAlexandru Croitor2021-08-241-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we only created object library static plugin initializers for Qt plugins only, not user-project plugins. The reason was that if a user tried to install the plugin target via an export set, CMake would error out saying that the _init library is not part of the same export set. Introduce an OUTPUT_TARGETS option that would allow projects to get the name of the generated _init target, so they can install it if needed. This was already done for qt6_add_qml_module, so we just introduce the same option for qt6_add_plugin. Now user static plugins will have an _init target created, which will be propagated to consumers whenever the consumers link against the plugin itself. We also need an internal option to disable this propagation, because it's handled a bit differently for Qt plugins which can be linked either via finalizers or via usage requirements. Amends 91c65dd80cdd2de666448c14202c0c63718152b6 As a result of the implementation change, cleanup example projects to ensure that they build successfully (the important part is specifying the CLASS_NAME). Only plugandpaint works properly with both shared and static Qt builds. echoplugin works with a shared Qt build, but not a static one due to some assumptions in the C++ code about shared plugins. styleplugin doesn't seem to work properly neither with shared Qt builds nor static Qt builds, at least on macOS. But it builds fine. For some reason even if the plugin is found, the style is not applied. Amends 4caac1feea025b0ad496141e8f16ab88c04c2caa Pick-to: 6.2 Task-number: QTBUG-80863 Task-number: QTBUG-92933 Change-Id: I6f631cda9566229b7a63992b23d7d7fa50303eeb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix excessive size of precompiled header filesJoerg Bornemann2021-08-241-3/+3
| | | | | | | | | | | | | | | Do not add catch-all header files like QtCore, QtGui, etc. to precompiled headers for targets that already define their own set of precompiled header files. This reduces the size of the precompiled headers and brings the pch file sizes down into the region of the qmake build. Pick-to: 6.2 Task-number: QTBUG-89122 Change-Id: I8e4d17aa6829c7d7b1aa01a01a61b6677e22c460 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add missing -help argument to qt-configure-moduleJoerg Bornemann2021-08-201-0/+22
| | | | | | | | | | | Now it's possible to display a configure help screen per module with qt-configure-module <module-source-dir> -help Pick-to: 6.2 Fixes: QTBUG-95943 Change-Id: I7d26006246af4b38b5a2ec6deca3f45c5313afec Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>