summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
...
* CMake: Improve Apple SDK name and path reportingAlexandru Croitor2025-06-021-9/+40
| | | | | | | | | | | | | | | | | | If CMAKE_OSX_SYSROOT or QT_APPLE_SDK was set, we still reported the default platform sdk path, rather than taking into account the set value. Improve the reporting by considering these values. The implementation is incomplete because we don't handle explicit sdk paths, but this is not critical for the current use cases, because the value of the function is only used for reporting purposes. Amends ab7eb492cba64fe985ea80b2f0be22c1c18f3c5e Pick-to: 6.8 6.9 6.10 Change-Id: Ic69aec3641d435736018c96f72ba7f75a0f74508 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Introduce INSTALL_QT_SHAREDIRCristian Le2025-06-024-4/+8
| | | | | | | | | | | | | | | | | | | Normally `INSTALL_DATADIR` is the canonical place for `share`/`CMAKE_INSTALL_DATADIR`, but this standard is not well enforced. In 834d92a, `INSTALL_SHAREDIR` was introduced to better enforce this standard and allow to install into third-party program's `CMAKE_INSTALL_DATADIR` (e.g. wayland). This ended up being used as `INSTALL_SHAREDIR/qt6` instead, but this leaves little room for configuration and renaming. This change introduces a namespaced variant that is guaranteed to be owned by Qt. Pick-to: 6.10 Change-Id: I25c0e5b47c402b178120e9e628fdfaf4aaad27ad Reviewed-by: Alexandru Croitor <[email protected]>
* Introduce qt_internal_set_module_transitive_propertiesAlexey Edelev2025-05-311-0/+97
| | | | | | | | | | | | | The function sets properties on target that then are propagated transitively. This only works with Qt modules, but can be extended for other Qt targets later. These transitive properties not necessarly require Qt be built using CMake versions supporting transitive properties(>= 3.30). Properties are stored and exported within the Qt module unconditionally and can be used in user projects, if CMake version allows this. Change-Id: I1ff6f1099753784c721dc1e3cd972dcd9dafedc4 Reviewed-by: Alexandru Croitor <[email protected]>
* Introduce Qt<Module>TransitiveExtras.cmake for Qt modulesAlexey Edelev2025-05-313-0/+65
| | | | | | | | | | | | | | This file sets the transitive module properties provided by Qt Module that is built using CMake versions < 3.30. The idea is to not limit user projects capabilities and allow using transitive Qt Module properties if user CMake version allows it. If Qt Modules are built using CMake versions >= 3.30 this code is noop, since values are stored directly in the respective INTERFACE_properties. Change-Id: I5a0bc0aa4f79a04c81dfa0fee1d37cfee5935b0f Reviewed-by: Alexandru Croitor <[email protected]>
* QtFlagHandlingHelpers.cmake: account for GCC when producing errorMitch Curtis2025-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the error message I get when configuring with -DFEATURE_sanitize_thread=ON from: CMake Error at cmake/QtFlagHandlingHelpers.cmake:183 (message): Platform linker doesn't support erroring upon encountering undefined symbols. Target:"Core". Call Stack (most recent call first): cmake/QtModuleHelpers.cmake:898 (qt_internal_add_link_flags_no_undefined) src/corelib/CMakeLists.txt:30 (qt_internal_add_module) to: ERROR: detected a std::atomic implementation that fails for function pointers. Please apply the patch corresponding to your Standard Library vendor, found in qtbase/config.tests/atomicfptr CMake Error at cmake/QtBuildInformation.cmake:240 (message): Check the configuration messages for an error that has occurred. Call Stack (most recent call first): cmake/QtBuildInformation.cmake:59 (qt_configure_print_summary) cmake/QtBuildRepoHelpers.cmake:393 (qt_print_feature_summary) cmake/QtBaseHelpers.cmake:287 (qt_build_repo_end) CMakeLists.txt:36 (qt_internal_qtbase_build_repo) Pick-to: 6.8 6.9 Change-Id: If6243362521802d8b1348ae53d744c33add814f1 Reviewed-by: Alexandru Croitor <[email protected]>
* Revert "CMake: Make generated pkgconfig files relocatable"Joerg Bornemann2025-05-282-4/+1
| | | | | | | | | | | | | | | This reverts commit 731d9a13956ef40e3f563f5ff5ff5c250b8d6d94. Reason for revert: ${pcfiledir} cannot be used, because this leads to wrong prefix values if PKG_CONFIG_SYSROOT_DIR is set. See the comments of the associated task for instances of this problem in other projects. Pick-to: 6.8 6.9 Task-number: QTBUG-136210 Change-Id: I2a60946828f07866b931dacfe0ef81346f1aac9d Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Stop spamming CMP0156 debug messagesAlexandru Croitor2025-05-281-3/+13
| | | | | | | | | | | | | We set the CMP0156 policy to NEW for Apple platforms for each created Qt target, but the debug message is generic, so we should only show it once. Amends c20d7bcb86361d0c9f8af3807dcad9db1a3a5ca0 Pick-to: 6.8 6.9 Task-number: QTBUG-135978 Change-Id: I332bd357999647df1d5f715d154fb568911889b1 Reviewed-by: Joerg Bornemann <[email protected]>
* CMake: Prefer target arch qmltestrunner when searching for itAlexandru Croitor2025-05-281-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | Currently qmltestrunner is built as a tool, instead of an app. That means that for most cross-compiling platforms (aside from Yocto), the build system will look for a host binary when referring to the qmltestrunner target. We want to look for the target platform binary instead. Switch the code around to prefer looking for the target platform binary via find_program, before falling back to referring to it by target name. In the future when we change qmltestrunner to be an app, and also expose its target platform binary as a target name, this should not be needed anymore, and we could rely solely on the target name. Amends 9edcc4690665496c2b6f15876b3979487dbad22a Task-number: COIN-1211 Task-number: QTBUG-137005 Change-Id: If2eb93d8832a17aae3d0648d1d0f5997805796fa Reviewed-by: Joerg Bornemann <[email protected]>
* CMake: Skip sbom file checksum checks for excluded test targetsAlexandru Croitor2025-05-262-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a developer configured Qt with -DQT_GENERATE_SBOM=ON -DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF The would get the following error upon installation of qtmultimedia: CMake Error at qt_sbom/SPDXRef-PackagedFile-qt-plugin-MockMultimediaPlugin.cmake:5 (message): Cannot find 'plugins/multimedia/libmockmultimediaplugin.a' to compute its checksum. This happens because QT_BUILD_TESTS_BY_DEFAULT == ON sets the EXCLUDE_FROM_ALL directory property on the tests directory, which means all plugins created under tests/ subdir are not installed by default, and the SBOM code could not read the installed files to check the checksums. In such a case, set a QT_INTERNAL_TEST_TARGETS_EXCLUDE_FROM_ALL directory-scoped variable in the tests/ subdir, and use that as a marker for the sbom code to know it should skip the checksum check. Pick-to: 6.8 6.9 Fixes: QTBUG-137168 Change-Id: I970c3bc5732cc648549e5099fa1d50b3b39cb26f Reviewed-by: Alexey Edelev <[email protected]>
* CMake: Fix backup/restore of QT_NO_PRIVATE_MODULE_WARNINGJoerg Bornemann2025-05-211-4/+3
| | | | | | | | | | | | | | ...in _qt_internal_find_qt_dependencies. In the case where a package is loaded via its own dependencies (Qt6FooPrivate -> Qt6Foo -> Qt6FooPrivate) the inner _qt_internal_find_qt_dependencies call did unset the backup value of QT_NO_PRIVATE_MODULE_WARNING. This could lead to an unwanted display of the private module warning. Treat the backup variable as a stack to deal with this situation. Pick-to: 6.9 Change-Id: I0ee3700a040b0df8c6090470ea6fc515cb93a7d6 Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: don't install wayland files in standalone buildSamuli Piippo2025-05-211-2/+1
| | | | | | | | The test and example standalone builds should not install the wayland files. Change-Id: If313479c8e17325cc3761fea093368f14d484d74 Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: fix __qt_internal_collect_additional_module_pathsSamuli Piippo2025-05-201-1/+1
| | | | | | | | | When the additional path did not point to cmake path, the loop was using non-existing variable. Pick-to: 6.9 6.8 Change-Id: Ie9599231599c3b90125825414956e345634c85ef Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: try to find qmltestrunner from additional pathsSamuli Piippo2025-05-191-0/+8
| | | | | | | | | Use QT_ADDITIONAL_PACKAGES_PREFIX_PATH to look for qmltestrunner. Needed if module install is using separate staging prefix, like is done on Yocto builds. Change-Id: Icfe972a7ab1d0c99518383eab1c885e490cdb4d6 Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Include WaylandCompositorMacros for qtbase in-tree testsAlexandru Croitor2025-05-161-0/+2
| | | | | | | Amends 2d790125429123aec4fb3dbee8335732f2d122eb Change-Id: Ie1c9f10d9fb03cb6397b70470f8671b4c0a5eb26 Reviewed-by: Alexey Edelev <[email protected]>
* CMake: Adjust CMP0156 policy handling for Apple platformsAlexandru Croitor2025-05-155-15/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backstory. 1) Starting with Qt 6.8, the prebuilt Qt for iOS SDK is built as static framework bundles instead of static libraries. That is done so that we can embed a privacy manifest into each framework bundle. 2) Up until CMake 3.28, CMake would not attempt to de-duplicate static libraries (or frameworks) on the command line. Starting with CMake 3.29, the CMP0156 policy was introduced to allow such de-duplication. 3) Since a while ago, Qt had its own policy handling for CMP0156, which it force sets to OLD, to disable any de-duplication. That was done to avoid possible regressions on platforms where link order matters. 4) A developer might add the -ObjC linker flag to a project, to ensure the linker retains all Objective-C categories it encounters in all the static libraries that were provided on the link line. Retaining in this case means that the /whole/ object file of a static library will be linked to the final executable. 5) The Apple ld linker (both the legacy and the new ld_prime one) can't cope with duplicate static frameworks on the link line when the -ObjC flag is used. It ends up throwing duplicate symbol errors, from trying to link the same object file from the same static framework more than once. The linker works just fine if the link line contains duplicate static libraries, rather than static frameworks. 6) When a project links against Qt6::Gui and Qt6::Core, the link line will contain Qt6::Core twice. This gets even more involved, when linking plugins, which cause static framework cycles, and thus a framework might appear multiple times. Thus, we have the situation that Qt forces the CMP0156 policy to OLD, Qt6::Core appears multiple times on the link line, no de-duplication is performed, the project adds the -ObjC flag, and the linker throws duplicate symbol errors. We can fix this by force setting the CMP0156 policy to NEW when targeting Apple platforms and using CMake 3.29+. A potential workaround for a project developer is to set the policy to NEW manually in their project. Unfortunately that doesn't work for older Qt versions. That's because CMake applies the policy value when add_executable is called, and the policy value in qt_add_executable is the one that is recorded when the function is defined. And the recorded policy is always OLD, because Qt6Config.cmake calls cmake_minimum_required with VERSION up to 3.21, which resets the policy value to OLD. So we have to force set the policy in qt_add_executable / qt_add_library via the existing __qt_internal_set_cmp0156 function. The __qt_internal_set_cmp0156 had some diagnostics to show a warning when the user modifies the policy themselves, but this never worked because of reason stated above: the policy value was always overridden in Qt6Config.cmake. To actually make the diagnostic work, there is now new code to save the policy value in the current directory scope, before Qt resets it. This only works if a project uses the find_package(Qt6 COMPONENTS Foo) signature. It won't work with a find_package(Qt6Core)-like signature. The policy value is not modified for platforms other than Apple ones for now. Amends 9702c3c78b2c16db6a9d0515d7d7698d9b064cd8 Pick-to: 6.5 6.8 6.9 Fixes: QTBUG-135978 Change-Id: I4d6e6c2a01e7092b417fc669d2aea40cf2dca578 Reviewed-by: Alexey Edelev <[email protected]>
* CMake: Conditionally pass PATHS to FindWrapHelper package lookupAlexandru Croitor2025-05-151-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The setup: - build Qt with '-static -qt-zlib' - configure a user project with plain cmake and -DQt6_DIR pointing to the Qt6 package In this case, the implicit find_dependency(BundledZlib) call will fail with: CMake Error at lib/cmake/Qt6/QtFindWrapHelper.cmake:120 (message): Can't find Qt6::BundledZLIB. Call Stack (most recent call first): lib/cmake/Qt6/FindWrapZLIB.cmake:6 (qt_find_package_system_or_bundled) cmake/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package) lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:36 (find_dependency) lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:39 (_qt_internal_find_third_party_dependencies) lib/cmake/Qt6Core/Qt6CoreConfig.cmake:42 (include) lib/cmake/Qt6/Qt6Config.cmake:233 (find_package) CMakeLists.txt:7 (find_package) For example it would fail for the rasterwindow example configured with: cmake ~/qtbase/examples/gui/rasterwindow \ -DQt6_DIR=$HOME/builds/dev-mac-static/qtbase/lib/cmake/Qt6 The failure happens because we don't pass any additional paths to the find_package call that looks for BundledZlib, as opposed to how we do it for module packages. The project configuration does not fail if it is configured with any of the following variables: - Qt6_ROOT or - CMAKE_PREFIX_PATH or - the Qt generated toolchain file. That's because these implicitly add relevant paths where to look for Qt packages. This came up in qtdeclarative RunCMake CI tests, where we only pass Qt6_DIR to the test projects. It didn't come up in qtbase, because none of the current qtbase RunCMake tests try to find Qt6Core. To fix this particular case, conditionally pass the same paths that Qt6Config.cmake uses when looking for module packages, to the find_package call that looks for the bundled target. We do it conditionally for bundled targets only, because for system libraries we want to default looking for the module FindWrapSystemFoo.cmake files. Add a RunCMake test which will try to find a few Qt modules solely based on having only Qt6_DIR set. Pick-to: 6.8 6.9 Change-Id: I4d4e548f4c10370c4964ab8968b5772e26855dd4 Reviewed-by: Alexey Edelev <[email protected]>
* Merge "Merge Wayland client from qtwayland repository into qtbase"Tor Arne Vestbø2025-05-141-0/+58
|\
| * Merge Wayland client from qtwayland repository into qtbaseLiang Qi2025-05-131-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The qtwayland repository has been filtered for commits relating to the Wayland client, via the following git-filter-repo command: git filter-repo --paths-from-file wayland-move.txt --force --refs HEAD And then merged into the qtbase repository via git merge --allow-unrelated-histories The following git-filter-repo instructions have been used: src/CMakeLists.txt src/CMakeLists.txt==>src/platformsupport/wayland/CMakeLists.txt src/configure.cmake src/configure.cmake==>src/platformsupport/wayland/configure.cmake src/client/Qt6WaylandClientMacros.cmake src/client/Qt6WaylandClientMacros.cmake==>src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake src/compositor/Qt6WaylandCompositorMacros.cmake src/compositor/Qt6WaylandCompositorMacros.cmake==>src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake src/3rdparty/ src/3rdparty/patches/==>src/3rdparty/wayland/patches/ src/3rdparty/protocol/ivi/REUSE.toml==> src/3rdparty/protocol/ivi/ivi-application.xml==> src/3rdparty/protocol/ivi/ivi-controller.xml==> src/3rdparty/protocol/ivi/qt_attribution.json==> src/3rdparty/protocol/ src/3rdparty/protocol/==>src/3rdparty/wayland/protocols/ src/extensions/qt-shell-unstable-v1.xml==> src/extensions/ src/extensions/==>src/3rdparty/wayland/extensions/ src/client/ src/client/==>src/plugins/platforms/wayland/ src/global/ src/global/==>src/plugins/platforms/wayland/globalprivate/ src/shared/ src/shared/==>src/plugins/platforms/wayland/shared/ src/plugins/decorations/adwaita/==> src/plugins/decorations/ src/plugins/decorations/==>src/plugins/platforms/wayland/plugins/decorations/ src/plugins/hardwareintegration/client/ src/plugins/hardwareintegration/client/==>src/plugins/platforms/wayland/plugins/hardwareintegration/ src/plugins/platform/ src/plugins/platform/==>src/plugins/platforms/wayland/plugins/platform/ src/plugins/shellintegration/qt-shell/==> src/plugins/shellintegration/ivi-shell/==> src/plugins/shellintegration/ src/plugins/shellintegration/==>src/plugins/platforms/wayland/plugins/shellintegration/ src/plugins/CMakeLists.txt src/plugins/CMakeLists.txt==>src/plugins/platforms/wayland/plugins/CMakeLists.txt src/qtwaylandscanner/ src/qtwaylandscanner/==>src/tools/qtwaylandscanner/ tests/auto/client/iviapplication/CMakeLists.txt==> tests/auto/client/iviapplication/tst_iviapplication.cpp==> tests/auto/client/shared/iviapplication.h==> tests/auto/client/shared/iviapplication.cpp==> tests/auto/client/ tests/auto/client/==>tests/auto/wayland/ tests/auto/cmake/test_waylandclient/ tests/auto/cmake/test_waylandclient/==>tests/auto/cmake/test_waylandclient/ Done-with: Alexandru Croitor <[email protected]> Done-with: Tor Arne Vestbø <[email protected]> Task-number: QTBUG-133223 Change-Id: I46c325724141fdbfcc117d12fb5f92852613e72a
* | CMake: Fix showing exit code when SBOM NTIA verification failsAlexandru Croitor2025-05-141-1/+1
| | | | | | | | | | | | | | | | | | The code was missing an escaped dollar sign. Pick-to: 6.8 6.9 Task-number: QTBUG-122899 Change-Id: I51bff0a128546085e9418682b540d92eacfdbbe4 Reviewed-by: Joerg Bornemann <[email protected]>
* | CMake: Allow skipping the fake install prefix for examplesSamuli Piippo2025-05-131-1/+1
|/ | | | | | | | | | | Add CMake variable to allow use of DESTDIR when installing examples in a standalone example build and skipping the fake prefix that would be otherwise used. Similar variable is already used for tests. Pick-to: 6.9 6.8 Change-Id: I427cbb5c198f8e89b1685792b7c1d90413213254 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]>
* cmake: add INSTALL_SHAREDIRLiang Qi2025-05-123-0/+3
| | | | | | | | | | For Wayland protocols, "/usr/share/wayland-protocols/" is used on Ubuntu/Debian derived, and same for arch. The share directory is different with data and archdata directories. Change-Id: I3bdd5bdc60bd4f66de66aecc943893978c86f19b Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* CMake: Make generated pkgconfig files relocatableJoerg Bornemann2025-05-112-1/+4
| | | | | | | | | | | Don't write an absolute prefix into generated .pc files but one that's relative to ${pcfiledir}. This makes the files relocatable, and we don't have to patch them in the Qt online installer. Pick-to: 6.8 6.9 Fixes: QTBUG-136210 Change-Id: I5c2f9398917be03f6c63286e553c87ff52971285 Reviewed-by: Alexey Edelev <[email protected]>
* Fix check for aliasesCristian Le2025-05-081-1/+1
| | | | | | | Amends 4bbd324a0a4a488b9ff4272888cc6b7f516d78ff Change-Id: I1b887c17a442398695fdebc20c7b54b068061f24 Reviewed-by: Alexandru Croitor <[email protected]>
* Fix qmltestrunner executable location and nameMichal Klocek2025-05-061-1/+16
| | | | | | | | | | | | | As qmltestrunner is not any longer qt tool. Adjust the executable name and add the way to find it outside the qtdeclarative. Reflects the change in: https://codereview.qt-project.org/c/qt/qtdeclarative/+/642618 Task-number: COIN-1211 Change-Id: I628de79f09cc27fb4d4fc43f297fcfb0c808ee19 Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Don't unconditionally enable the ASM languageJoerg Bornemann2025-05-021-1/+1
| | | | | | | | | | | | | CMake MR #10626 doesn't consider the MSVC compiler as valid assembler anymore, thus unconditionally requiring ASM breaks with CMake > 4.0.1 on MSVC. Enable ASM only on non-Android Unix. Remove the ASM language where it's not needed. Pick-to: 6.5 6.8 6.9 Change-Id: I5df71edfce0f4920e39262f722e4bf95a735f31b Reviewed-by: Alexandru Croitor <[email protected]>
* configure: Bail out early if Xcode is not installed on macOSKai Köhne2025-04-301-0/+6
| | | | | | | | | | | Currently, configure fails late with Qt requires at least version 15 of Xcode, you're building against version . Please upgrade. Pick-to: 6.9 Change-Id: Ic4f44d37429ac9def785a50909a25b0bcb4b72a5 Reviewed-by: Alexandru Croitor <[email protected]>
* Fix typos in qt_internal_add_plugin in the TEST_PLUGIN related warningAlexey Edelev2025-04-281-2/+2
| | | | | | | | Amends 40def717978f832027542dad507e7873ccc0e1f6 Pick-to: 6.9 Change-Id: I807b1b7db8c2d473355759c1db12cc2a9ead802d Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Skip walking empty targets in __qt_internal_walk_libs()Alexandru Croitor2025-04-251-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | If one of the interface link libraries of a target is "$<LINK_ONLY:$<BUILD_LOCAL_INTERFACE:Foo>>" this will be exported by cmake as "$<LINK_ONLY:>" in the exported INTERFACE_LINK_LIBRARIES property. When walking the dependent libraries of a target using __qt_internal_walk_libs(), this value will become empty after unwrapping the LINK_ONLY genex. In such a case, we should skip further processing of the library. Otherwise in some weird unknown conditions, CMake might consider the empty name to be a valid target, and cause errors when trying to read properties from it. Amends ad7b94e163ac5c3959a7e38d7f48536be288a187 Pick-to: 6.9 Fixes: QTBUG-136039 Change-Id: I143dec697e10530379486462697cd299940ee463 Reviewed-by: Alexey Edelev <[email protected]>
* CMake: add Photos.framework to framework helpersTimur Pocheptsov2025-04-251-0/+1
| | | | | | | | | This would allow us using Photos.framework/PHAssets on iOS (instead of now-deprecated 'Assets' library). Change-Id: I922e4765e8fdadf872f801b55a1e4ef4368e65b0 Reviewed-by: Alexey Edelev <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* Add support for _qt_internal_configure_file(GENERATE ... INPUTAlexey Edelev2025-04-251-5/+5
| | | | | | | | | | Allow generating files from template file. The signature first expands the '@' wrapped variables in template file and then generates the resulting file using file(GENERATE command. Pick-to: 6.8 6.9 Change-Id: I0b4cf557da1d5161ffcde1c44aea98c440427980 Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Fix SBOM PROJECT_COMMENT CMP0174 related warningAlexey Edelev2025-04-241-1/+7
| | | | | | | | | | | We should only pass PROJECT_COMMENT if it has a value. We also need to escape semicolons, because the project comment might contain the qt configure line, and that might have passed arguments like -qpa offscreen\;xcb Pick-to: 6.8 6.9 Change-Id: I934cf75c376b3466ba91a433d009e6eaa77a60fa Reviewed-by: Alexey Edelev <[email protected]>
* CMake: Clean up leftover attribution values during SBOM generationAlexandru Croitor2025-04-241-0/+3
| | | | | | | | | | | | | | | | When processing multiple attribution files to collect all attribution ids, the values of the previous iteration extracted keys were not reset. This caused the values to leak to the next processed attribution id target if the specific id key was empty. Make sure to clean up the values before parsing the next attribution key. Pick-to: 6.8 6.9 Change-Id: I386fc9c09276c49207382b06605efeb0d939b6da Reviewed-by: Alexey Edelev <[email protected]>
* Ensure that plugin class name is a valid C indentifierAlexey Edelev2025-04-231-0/+23
| | | | | | | | | We should prevent using the invalid plugin class names at CMake configure stage already, so users receive the early error. Fixes: QTBUG-135860 Change-Id: I259539f6cce70a035ccf458a62d9e5a02f238ef8 Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Show the active Apple SDK path when configuring qtbaseAlexandru Croitor2025-04-093-0/+23
| | | | | | | | | | | | | | | | | | | | | Starting with CMake 4.0, CMake doesn't initialize the CMAKE_OSX_SYSROOT variable with any value when running on a macOS host and no explicit CMAKE_OSX_SYSROOT or CMAKE_SYSTEM_NAME is set. CMake expects the platform compiler wrapper /usr/bin/c++ to pass an appropriate -isysroot flag to the underlying compiler, without CMake explicitly setting one. This mostly works, but the configure output will not show anymore the active sysroot path. Query the active path from xcrun, and display it in the configure output. Pick-to: 6.8 6.9 Task-number: QTBUG-135621 Change-Id: Ic9b9a43e25bb88bb83165dce52356c77ea8fffe1 Reviewed-by: Alexey Edelev <[email protected]>
* CMake: Refactor _qt_internal_get_apple_sdk_versionAlexandru Croitor2025-04-091-10/+57
| | | | | | | | | | | | | | | | Introduce two new functions _qt_internal_get_apple_xcrun_output and _qt_internal_get_apple_sdk_name, to allow reusing them in the future. Make sure to set the output variables to empty even outside Apple platforms. Show an error when xcrun is called when targeting a non-Apple platform. Pick-to: 6.8 6.9 Change-Id: Ic3895f74cfcac337bff069f8e6ec1517aec6c8d0 Reviewed-by: Alexey Edelev <[email protected]>
* CMake: Rework deployment of Qt pluginsJoerg Bornemann2025-04-091-43/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][CMake] qt6_import_plugins doesn't have any effect anymore on plugin deployment with the CMake deployment API on Linux. [ChangeLog][CMake] qt6_deploy_runtime_dependencies now supports the following plugin selection flags on Linux: INCLUDE_PLUGINS, INCLUDE_PLUGIN_TYPES, EXCLUDE_PLUGINS, EXCLUDE_PLUGIN_TYPES. Before this patch, we were deploying the plugins of every Qt module we discovered when walking the dependencies of the target to be deployed. That doesn't work if the target links against a shared library that privately links against another Qt module, i.e. QtMultimedia like in the bug report. We need to take into account the Qt modules that are discovered when retrieving the runtime dependencies at deployment time and deploy their plugins. Also, we now run file(GET_RUNTIME_DEPENDENCIES) and plugin discovery in multiple passes. Every pass might discover new Qt plugins whose runtime dependencies must be resolved. We stop if a pass did not discover new plugins or after a certain number of passes. Plugin discovery works like this: - identify the Qt modules within resolved libraries, - read the plugin types for the module from the corresponding, module JSON file in Qt's installation, - glob the files in Qt's plugins directory, - select the files according to the plugin types from the Qt modules and the INCLUDE.../EXCLUDE... arguments passed by the user. We also read the default QPA platforms from modules/Gui.json and deploy those. Fixes: QTBUG-117731 Change-Id: I62ec96ab6de8327941c4c5a0ba83fd89f1733768 Reviewed-by: Alexey Edelev <[email protected]>
* Add jemalloc supportAurélien Brooke2025-04-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Large graphical Qt applications heavily rely on heap allocations. Jemalloc is a general-purpose malloc(3) implementation designed to reduce heap fragmentation and improve scalability. It also provides extensive tuning options. Add a -jemalloc configure option, disabled by default. When enabled, Qt and user code link to jemalloc, overriding the system's default malloc(). Add cooperation with jemalloc for some Qt key classes: QArrayData (used by QByteArray, QString and QList<T>), QBindingStoragePrivate, QDataBuffer (used by the Qt Quick renderer), QDistanceFieldData, QImageData, QObjectPrivate::TaggedSignalVector, QVarLengthArray. This cooperation relies on two jemalloc-specific optimizations: 1. Efficient allocation via fittedMalloc(): Determine the actual allocation size using nallocx(), then adjust the container’s capacity to match. This minimizes future reallocations. Note: we round allocSize to a multiple of sizeof(T) to ensure that we can later recompute the exact allocation size during deallocation. 2. Optimized deallocation via sizedFree(): Use sdallocx(), which is faster than free when the allocation size is known, as it avoids internal size lookups. Adapt the QVarLengthArray auto tests on capacity. Non-standard functions docs are at https://jemalloc.net/jemalloc.3.html [ChangeLog][QtCore] Added optional support for the jemalloc allocator, and optimized memory allocations and deallocations in core Qt classes to cooperate with it. Change-Id: I6166e64e66876dee22662d3f3ea3e42a6647cfeb Reviewed-by: Thiago Macieira <[email protected]>
* CMake: make ccache + pch + clang build more robustJoerg Bornemann2025-04-091-0/+9
| | | | | | | | | | | | The ccache man page says we have to compile with -fno-pch-timestamp when using clang and precompiled headers. "Professional CMake" also recommends this approach, and the ccache statistics report a marginally better hit rate with this patch. Task-number: QTBUG-131650 Change-Id: Ic1c17a3977771673ac256674143dbdf8d5ffa28c Reviewed-by: Alexey Edelev <[email protected]>
* Default initialize the statep pointer in the resolv compile checkAlexey Edelev2025-04-071-1/+18
| | | | | | | | | | Initialize the variable with the default value, to avoid the type mismatch warnings. Fixes: QTBUG-135648 Pick-to: 6.8 6.9 Change-Id: I3ae2c59fb42676b373bcbbe06d3e6636203e283b Reviewed-by: Alexandru Croitor <[email protected]>
* Introduce _qt_internal_configure_fileAlexey Edelev2025-04-042-44/+83
| | | | | | | | | | | | | | | | | The function is the internal public counterpart of the qt_configure_file command, but also supports two modes: GENERATE and CONFIGURE. The CONFIGURE mode is plain replacement of file(CONFIGURE or configure_file command depending of specified arguments. In the GENERATE mode the function allows using the generator expressions when evaluating the CONTENT. The function doesn't support INPUT argument as its counterpart(there are no limitations, author left this unimplemented). Pick-to: 6.8 6.9 Change-Id: I9bef2265210404113596db95085b6e0d5f03ae13 Reviewed-by: Alexandru Croitor <[email protected]>
* Dealias the target implicitly in _qt_internal_add_transitive_propertyAlexey Edelev2025-04-041-0/+1
| | | | | | | | | Ensure the target is not an ALIAS target when adding the transitive properties. Pick-to: 6.8 6.9 Change-Id: Ic9cb4f1a6e110596e430176cfa9b7f742d2c3446 Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Fix CMP0177 warnings by adjusting qt_join_pathAlexandru Croitor2025-04-031-1/+7
| | | | | | | | | | | | | | | | | | INSTALL_DATADIR and INSTALL_ARCHDATADIR have the value "." by default. CMP0177 in CMake 3.31 now warns when paths that have "." as a component are passed to install(). To avoid the warning, change the implementation of qt_path_join, to filter out "." components. That way all install() calls that build up their paths via qt_path_join() will avoid the warning. Pick-to: 6.8 6.9 Change-Id: Ib82aa9fe6b5d32e374e8b1acf05402312b6dbe1a Reviewed-by: Alexey Edelev <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]>
* cmake: Respect CMAKE_MACOSX_BUNDLE and CMAKE_WIN32_EXECUTABLETor Arne Vestbø2025-03-312-9/+20
| | | | | | | | | | | | | The user may set different global defaults for CMAKE_MACOSX_BUNDLE and CMAKE_WIN32_EXECUTABLE, so we shouldn't unconditionally override them on a target level. This allows cmake ~/foo/ -DCMAKE_MACOSX_BUNDLE=ON to build a project as a GUI app without needing to modify the CMakeLists.txt with target specific overrides. Change-Id: Id49adb1c0aedfe82a2b1d919d086c5112ba92b93 Reviewed-by: Alexandru Croitor <[email protected]>
* Call xcrun from PATHJoni Poikelin2025-03-311-2/+2
| | | | | | | | The xcrun binary may be installed in a different location when cross compiling to macOS using osxcross. Change-Id: I47398e8da19c42e5e9d1b595673048c56662ea2e Reviewed-by: Tor Arne Vestbø <[email protected]>
* Teach syncqt to look for module headers in install pathAlexey Edelev2025-03-271-0/+8
| | | | | | | | | | | | | | If we build the specific module against installed Qt syncqt cannot detect the installed module headers, since it only checks the build paths. This adds the installIncludeDir argument for syncqt so it now attempts looking for the included header file in Qt install path. This will raise early warnings in Qt per-module builds too, but not only when building top-level Qt or for non-prefixed builds. Pick-to: 6.5 6.8 6.9 Change-Id: I5a28ec35a776b5b39f4a8923c9bf91e857f45e4a Reviewed-by: Alexandru Croitor <[email protected]>
* Build system: further reduce verbosity for doc buildsVolker Hilsheimer2025-03-261-1/+3
| | | | | | | | | Amends 87965f05567d1d65af705fd61b68a02710a4fa52 by adding a comment to the qdoc invocation that generates the documentation. Change-Id: I7e3e0a1386d54da0fb35b1853a6032dd2949da16 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>
* Use 'file(CONFIGURE' in qt_configure_file for CMake >= 3.18Alexey Edelev2025-03-261-0/+5
| | | | | | | | | Use the original functionality as the fall back solution for the introduced by CMake 'file(CONFIGURE' command. Pick-to: 6.8 6.9 Change-Id: I2be7e3bf80a577cdf8292c9f47bb127fa71615b6 Reviewed-by: Alexandru Croitor <[email protected]>
* Change _qt_internal_android_get_target_android_build_dir signatureAlexey Edelev2025-03-261-1/+1
| | | | | | | | | Swap the argument order so the "output" is the first argument. Pick-to: 6.5 6.8 6.9 Change-Id: I1325af97f1d6540c6897b51f1b5736b4534f6412 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Prepend '_' to qt_internal_android_get_target_android_build_dirAlexey Edelev2025-03-261-1/+1
| | | | | | | | | | Adjust the function name according to our naming convention for private function locating in public cmake scripts. Pick-to: 6.5 6.8 6.9 Change-Id: I3a108cdb43bd4b3d8cf29ac4c42c7c20c541afc8 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* CMake: Fix list(REMOVE_ITEM) usage with older CMakesAlexandru Croitor2025-03-241-1/+3
| | | | | | | | | | | | | | | | | | | Older CMakes error out with CMake Error at cmake/QtSyncQtHelpers.cmake:156 (list): list sub-command REMOVE_ITEM requires two or more arguments. if the last expanded variable is empty. Fix by doing an explicit non-emptiness check. Amends e7834e90f38891382f830da7700f00ebd81f21a8 Pick-to: 6.8 6.9 Task-number: QTBUG-134672 Task-number: QTBUG-128730 Change-Id: I3c355a02519c2c450235770b2ff8c92416615a9f Reviewed-by: Alexey Edelev <[email protected]>