summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6CoreDeploySupport.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Add _qt_internal_get_i18n_catalogs_for_modulesJoerg Bornemann2024-04-171-28/+1
| | | | | | | | | | | | | This function finds the translations that belong to the Qt modules that are used by the project. "Used by the project" means just all modules that are pulled in via find_package for now. This code was in Qt6CoreDeploySupport.cmake before. Now, we can call it in other places too like Qt6LinguistToolsMacros.cmake. Task-number: QTBUG-110444 Change-Id: I338d54d93cf285190b1430608b32334692ae4c07 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Consider NO_UNSUPPORTED_PLATFORM_ERROR for non-bundle mac appsAlexandru Croitor2024-03-221-1/+10
| | | | | | | | | | | | | | | | | | | | | | | Currently if qt6_generate_deploy_app_script is called on an executable target that does not have the MACOSX_BUNDLE property set, it will error out with a message about not supporting non-bundle apps. This error is shown even if NO_UNSUPPORTED_PLATFORM_ERROR is passed as an option which looks like an oversight. Change the code not to show the error if NO_UNSUPPORTED_PLATFORM_ERROR is passed. This means user projects can call qt6_generate_deploy_app_script for non-bundle apps without having to wrap the code in a if(NOT APPLE) check, and deployment will simply not run for that target on macOS. [ChangeLog][Build System] The qt6_generate_deploy_app_script NO_UNSUPPORTED_PLATFORM_ERROR option will now have an effect when calling the API on non-bundle macOS executable targets. Pick-to: 6.7 Change-Id: I932d6bfa2d3c7e2aaf8be967fea1f682eacf0112 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Check for qtpaths6.exe existence during windows deploymentAlexandru Croitor2024-03-151-1/+6
| | | | | | | | | | | | | | | | A qt installation might not contain the non-versioned the qtpaths.exe installed, but keep the versioned qtpaths6.exe. Try to use the versioned version before the non-versioned one. If none exists, show a warning at deployment time. Amends 571201603acc731330c9af42a3aca9cda41d38fd Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-122664 Task-number: QTBUG-119619 Change-Id: I23caf9ed3c7928fbab9657b0c0c64517dfc7d68e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix custom QT_DEPLOY_TRANSLATIONS_DIR on WindowsJoerg Bornemann2024-02-141-0/+1
| | | | | | | Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-121880 Change-Id: I7747253ae2671b2d417b25f0a98bc13871a661e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix custom QT_DEPLOY_QML_DIR on WindowsJoerg Bornemann2024-02-141-0/+1
| | | | | | | | | The value of QT_DEPLOY_QML_DIR was never passed to windeployqt. Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-121881 Change-Id: I993793f74d84ccb0e7c2deb72b1e33e81692ecbb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qt6_deploy_translations: Don't deploy the "qt" meta-catalogJoerg Bornemann2024-01-311-1/+1
| | | | | | | | | | | The "qt" meta-catalog is some relic from the past that pulls in the translations for qtbase and qtmultimedia. The qtbase translations are deployed by default, and the qtmultimedia translations are deployed if qtmultimedia is used by the project. Pick-to: 6.7 Change-Id: I53e5920d39f87162c418fb3f4cff7927ec9b5488 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Warn if DEPLOY_TOOL_OPTIONS is used on LinuxJoerg Bornemann2024-01-311-0/+7
| | | | | | | | | ...or rather when it's used with the generic deployment tool. Pick-to: 6.7 Task-number: QTBUG-121708 Change-Id: I161564923a43c82150f581874ba20a9ad6de310f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add deployment hooks for the generic deploy toolJoerg Bornemann2023-12-181-0/+30
| | | | | | | | | | | | | | | | | | | | | | | Add a way to run code after qt_deploy_runtime_dependencies has finished its job. Motivation: To deploy QtWebEngine-specific assets we must call a QtWebEngine-specific deployment function that is defined in the QtWebEngineCore module. Qt modules (and other code) can now register a deployment hook with _qt_internal_add_deployment_hook(my_hook). The function my_hook will be called at the end of _qt_internal_generic_deployqt. The function my_hook will be called with all arguments that were passed to _qt_internal_generic_deployqt plus a list of resolved dependencies. The hook can use this list of dependencies to decide whether to deploy files. Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-119077 Change-Id: I07ab2f6b3a0ea399b43409b4a0498dbf2f52664f Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Add LIBEXEC_DIR argument to qt_deploy_runtime_dependenciesJoerg Bornemann2023-12-181-0/+4
| | | | | | | | | | [ChangeLog][CMake] The qt_deploy_runtime_dependencies function gained the LIBEXEC_DIR argument to set the directory for deploying helper executables on Unix derivatives. Pick-to: 6.7 Change-Id: Icf2b0b439a0e635caa4d9bd2f6950bec74f97c3b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Deploy correct arch files when cross-compiling to arm WindowsAlexandru Croitor2023-12-171-0/+7
| | | | | | | | | | | | | | | | | | When cross-compiling a user project from x86_64 to arm64 MSVC Windows target, during deployment we need to deploy arm libraries. By default because we use an x86_64 windeployqt, it always deploys x86_64 libraries. Make sure to pass the path to the target WoA qtpaths.bat file to windeployqt, so it deploys arm libraries. Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-119619 Change-Id: Ib3b5498ae906726d1f9e0919333c102898b48ea9 Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* CMake: Add a way to pass additional arguments to win/macdeployqtJoerg Bornemann2023-12-071-0/+3
| | | | | | | | | | | | | | [ChangeLog][CMake] Added the DEPLOY_TOOL_OPTIONS argument to the functions qt_generate_deploy_app_script and qt_deploy_runtime_dependencies. It doesn't make sense to map every option of the deployment tools to arguments in our CMake deployment API. Allow the user to specify extra arguments to windeployqt or macdeployqt. Task-number: QTBUG-116551 Change-Id: I4cc67ab03f19101b695281e8c80f8af825bab7f6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add NO_COMPILER_RUNTIME to deploy script macrosChristian Heimlich2023-03-131-0/+4
| | | | | | | | | | | | | | | | | | | | Provides the NO_COMPILER_RUNTIME boolean option to qt_deploy_runtime_dependencies() and qt_generate_deploy_app_script(). In both cases this results in using the "--no-compiler-runtime" option of windeployqt. The value has no effect on other platforms. [ChangeLog][CMake] Added the option NO_COMPILER_RUNTIME to qt_generate_deploy_app_script. Task-number: QTBUG-111741 Pick-to: 6.5 6.5.0 Change-Id: I2e86f0959c4e1ae47b247667ace88d07e2f22271 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Avoid repeating DESTDIR when deploying Qt libs and pluginsJoerg Bornemann2022-12-211-2/+2
| | | | | | | | | | | | | | | | | | | | | Let CMAKE_INSTALL_PREFIX be "/usr/local", and consider a project with a call to qt_generate_deploy_app_script. Installing the project with DESTDIR set to "/tmp/bla" would install the project targets to "/tmp/bla/usr/local" but the Qt libraries to "/tmp/bla/tmp/bla/usr/local". That happened, because we used QT_DEPLOY_PREFIX as DESTINATION in file(INSTALL). QT_DEPLOY_PREFIX starts with $ENV{DESTDIR} and file(INSTALL) also prepends DESTDIR. The value of QT_DEPLOY_PREFIX is controlled by CMAKE_INSTALL_PREFIX. Use the latter as DESTINATION in file(INSTALL) calls. Pick-to: 6.5 Task-number: QTBUG-109553 Change-Id: I8f06d81968fa0de4f17c4f8bc9b17cc052da4c12 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Un-TP most of the deployment APIAlexandru Croitor2022-12-081-4/+0
| | | | | | | | | | | | | | | They are deemed good enough. qt_deploy_translations is left in TP because with the current signature, it's not clear yet how it's supposed to work for iOS and other non-desktop targets. [ChangeLog][CMake] The Core CMake deployment API is out of Technical Preview status. Task-number: QTBUG-108507 Change-Id: I384233c697b33644de3c9e1fb17d04f44ca16ea2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Deploy runtime dependencies outside of the Qt prefix tooJoerg Bornemann2022-10-151-31/+58
| | | | | | | | | | | | | | | | | | | | | | | | We restricted the runtime dependencies we deployed on Linux to libraries within the Qt installation prefix. This restriction was supposed to prevent the deployment of all kinds of system libraries, which is most likely not wanted. However, the user might link against non-system libraries, and those should be deployed. The same holds for QML backend libraries that exist outside the Qt installation prefix in the build directory of the project. Now, we restrict deployment to libraries that are not in default system library directories. This can be overridden with the new qt_deploy_runtime_dependencies option POST_EXCLUDE_REGEXES. We add the following options to qt_deploy_runtime_dependencies, which are then forwarded to file(GET_RUNTIME_DEPENDENCIES): PRE_INCLUDE_REGEXES, PRE_EXCLUDE_REGEXES, POST_INCLUDE_REGEXES, POST_EXCLUDE_REGEXES, and POST_INCLUDE_FILES. Change-Id: I99a98fd91218abedda270609d0bafbb7f3e0feeb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Set RPATH of deployed plugins on LinuxJoerg Bornemann2022-10-151-0/+59
| | | | | | | | | | | | | | | | | | | | When deploying into some directory structure where CMAKE_INSTALL_LIBDIR is different from Qt's lib dir, we need to set the RPATH of installed plugins such that Qt libraries are found. We do this using CMake's undocumented file(RPATH_SET) command and pray that this command is safe to use across current and future CMake versions. For CMake versions < 3.21, we use patchelf, which must be installed on the host system. The adjustment of rpaths can be turned on explicitly by setting QT_DEPLOY_FORCE_ADJUST_RPATHS to ON. The usage of patchelf can be forced by setting QT_DEPLOY_USE_PATCHELF to ON regardless of the CMake version. Change-Id: I62ced496b4c12bf6d46735d2af7ff35130148acb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add NO_TRANSLATIONS option to deployment functionsJoerg Bornemann2022-09-151-0/+14
| | | | | | | | | | | | Add the NO_TRANSLATIONS option to qt_deploy_runtime_dependencies and qt_generate_deploy_app_script. On Windows and Linux, this option prevents the deployment of Qt translations. [ChangeLog][CMake] Added the NO_TRANSLATIONS option to qt_deploy_runtime_dependencies and qt_generate_deploy_app_script. Change-Id: I9d8435e262e2ff6c7242760ddb189473af850476 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Introduce qt_deploy_translationsJoerg Bornemann2022-09-151-0/+144
| | | | | | | | | | | | | | Add the command qt_deploy_translations to the CMake deployment API. This can be used to deploy a set of Qt translations. This command is supposed to be called by the generic deployment tool in a future commit. [ChangeLog][CMake] Added qt_deploy_translations for deploying Qt translation catalogs in user projects. Change-Id: I4492a5042970cf89b2be2ed0c34521c7af904771 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add Linux support to qt_deploy_runtime_dependenciesJoerg Bornemann2022-09-151-2/+124
| | | | | | | | | | | | | | | | | | | | | | Before this change, qt_deploy_runtime_dependencies supported Windows and macOS only. We add a generic deployment method implemented in cmake-language with file(GET_RUNTIME_DEPENDENCIES). This deployment method is now enabled for shared builds on Linux. The file(GRD) command requires that the EXECUTABLE argument points to the executable in the build directory. Only libraries in Qt's installation directory are considered for deployment. This includes Qt's own libraries and also things like libicu*.so we're shipping with the installer. Unlike macdeployqt and windeployqt, the generic qt_deploy_runtime_dependencies does not yet support deploying translations. We will catch up on this in a later commit. Change-Id: Iea23abcdba774d4c1885c8d2c243eb3e48fb7fae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clarify qt_deploy_runtime_dependencies' EXECUTABLE argumentJoerg Bornemann2022-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a subsequent commit we will add Linux support for qt_deploy_runtime_dependencies based on file(GET_RUNTIME_DEPENDENCIES). The file(GRD) command expects that we pass the not-yet-installed executable to it, because the command reads the RUNPATH/RPATH from the executable and resolves libraries against these paths. This resolution is likely going to fail if file(GRD) is run on an installed executable, because the RPATH was modified to be relocatable in the installation phase. This patch adds a recommendation to use the build directory's executable for qt_deploy_runtime_dependencies on non-macOS platforms. Also, the Windows code path of qt_deploy_runtime_dependencies is adjusted to support both, the .exe in the build dir and the .exe in the installation prefix. For consistency, qt_generate_deploy_app_script calls qt_deploy_runtime_dependencies with EXECUTABLE pointing to the build directory's executable. [ChangeLog][CMake] On non-macOS platforms, qt_deploy_runtime_dependencies' EXECUTABLE argument now expects the executable in the build directory instead of the installation directory. Change-Id: Id76b52cc5a0f285586679d7ae600a8c7996429c1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow for CMAKE_INSTALL_BINDIR set to . in deployment APIJoerg Bornemann2022-08-171-1/+1
| | | | | | | | | | | | | | Esp. on Windows, it can be desirable to deploy an application and its DLLs directly in the install prefix, without a bin directory. To do that, one must set CMAKE_INSTALL_BINDIR to ".", but that resulted in a faulty prefix entry in the generated qt.conf. Check for this case when generating qt.conf to write the correct prefix. Fixes: QTBUG-105583 Pick-to: 6.3 6.4 Change-Id: I0e8295c70b48b991c19f58f6b3f2ed132112dd29 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Clean up qt_deploy_runtime_dependencies for 6.3Alexandru Croitor2022-02-281-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure both versioned and versionless functions are available. Use the versioned function in the implementation of qt6_generate_deploy_app_script. Move the low-level warning to the top of the documentation page, after the TP message. Clarify documentation of the EXECUTABLE and ADDITIONAL_ options, that they take relative paths and can use generator expressions, but can't reference raw target names. Adjust documentation snippet to cover mac / windows cases. This mostly coincides with the internal implementation of qt_generate_deploy_app_script. Also adjust it to show case more options, like installation of a helper app and its dependencies. Output the working directory when executing the deploy tool. Remove the MACOS_BUNDLE option, it serves no good purpose at the moment, we already detect bundles by checking if the dir name has an '.app' suffix. Pick-to: 6.3 Fixes: QTBUG-100923 Change-Id: If7e5d65ce920eb69fd45f004aa4c5bad800c7ba9 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clean up qt_deploy_qt_conf for 6.3Alexandru Croitor2022-02-211-4/+19
| | | | | | | | | | | | | | | Ensure both versioned and versionless functions are available. Document that the first argument should be an absolute path and check that in the code. Move the low-level warning to the top, after the TP message. Use a few more options in the doc snippet. Mention what the default values are. Pick-to: 6.3 Fixes: QTBUG-100922 Change-Id: I0d852733e51750f4c8f15721b707cb1d27dfee9a Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Mark the new deployment API as being in Technical PreviewAlexandru Croitor2021-12-091-0/+4
| | | | | | | | Amends 22c92f39670d0376478cc2e73a17307508f86692 Task-number: QTBUG-98545 Change-Id: Ifaa7e4884f0eb1caa6d3d4906a2701f8fa5e43c2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add CMake deployment supportCraig Scott2021-12-081-0/+242
Task-number: QTBUG-98545 Change-Id: I581c1173cdfc92c09fd2cf0bbe7ec6bc8d52b868 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>