summaryrefslogtreecommitdiffstats
path: root/cmake/QtDocsHelpers.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Enable overriding the QT_INSTALL_DOCS environment variableVenugopal Shivashankar2024-01-241-1/+3
| | | | | | | | | | | | | | | | The QT_INSTALL_DOCS is configured with incorrect path sometimes, especially while configuring qtbase with QT_HOST_PATH, which also lets you build documentation for the essential modules such as QtCore, QtGui, and so on. If the default QT_INSTALL_DOCS path is wrong, a way to override the path would enable building documentation for the essential modules without having to build parts of qtbase. Change-Id: I686e0bc103f9722aa98f3c02d2a5af9e645cc9d9 Done-with: Topi Reinio <topi.reinio@qt.io> Task-number: QTBUG-121459 Pick-to: 6.7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Accept additional arguments for qt_internal_add_docsVenugopal Shivashankar2024-01-241-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of the API accepts only two arguments, {target} and {qdocconf}. It passes a few environment variables to build targets, providing info. about the Qt version being used. QT_INSTALL_DOCS is one of these environment variables, and it is the install path for all the Qt module/addon documentation sets. QT_INSTALL_DOCS is also the path where the global QDoc configuration files are available. If a project uses the qt_internal_add_docs to create the build targets for the documentation, and the Qt version used to configure the project is a pkg installed using the qt-online-installer, the QT_INSTALL_DOCS path is always wrong. Such projects should either maintain a CMake setup for documentation or configure and build Qt from source with the correct QT_INSTALL_DOCS path, which is then passed to qdoc. This change enables passing additional indexdir and other arguments to QDoc, which is useful. For example, if QDoc cannot find all the cross-module link targets, you could either pass extra indexdir argument to resolve the links or turn off the link errors. For example, if your qdocconf has the following depends entry to enble linking to other modules: depends += qtcore qtmultimedia And the documentation for these modules are not part of the Qt installation used to build the projects, you could pass additional index dirs to enable cross-module linking. qt_internal_add_docs{target_name qdocconf INDEX_DIRECTORIES /absolute/path/Qt6/Docs /one/more/Qt6/Docs /another/Qt6/Docs) Change-Id: Ieac271ddf92990d722602487c41af7f18546d096 Done-with: Topi Reinio <topi.reinio@qt.io> Task-number: QTBUG-121457 Pick-to: 6.7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow configuring the qtbase documentation-only buildAlexey Edelev2024-01-171-1/+1
| | | | | | | | | | | | | Use the QT_SUPERBUILD procedure when configuring the qtbase documentation-only build. This only makes sense for qtbase since we disallow building it using existing Qt installation. Other repositories should be configured using qt-configure-module script from the existing Qt installation and simply run 'ninja docs'. Fixes: QTBUG-120485 Pick-to: 6.7 6.6 6.5 Change-Id: Iafed5c17bea5c61edc239f08045922497215fb73 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix doc building when current prefix is different from originalAlexandru Croitor2023-11-241-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | When qtbase + qtools is built with -DCMAKE_INSTALL_PREFIX=/opt/foo and then qtsvg is built with -DCMAKE_INSTALL_PREFIX=/ building docs will fail to find the installed .qdocconf files with an error like: qtsvg/src/svg/doc/qtsvg.qdocconf:1: (qdoc) error: Cannot open file '//doc/global/qt-module-defaults.qdocconf': No such file or directory That's because we pass QT_INSTALL_DOCS=/ (pointing to the new prefix) as an env var to qdoc and it uses that to try and include various qdocconf files. Instead of passing the currently specified CMAKE_INSTALL_PREFIX, use QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX which points to where qtbase was installed (and thus all previous .qdocconf files). This was already in the code but we preferred CMAKE_INSTALL_PREFIX when it was set, so just remove it. Pick-to: 6.6 Change-Id: Ibe326132b9504341fa998d9e772ea2bea79727c0 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Remove perl related functionality from CMake filesAlexey Edelev2022-11-291-5/+3
| | | | | | | | | Avoid using perl in CMake scripts. Remove the syncqt.pl specific code. Task-number: QTBUG-87480 Change-Id: I7fcd5cc83d173ec463c275b5b50b84f25044a118 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix a typo in a commentThibaut Cuvelier2022-10-181-1/+1
| | | | | | Change-Id: I3ff1bd0d00fd56fa980bc86f71c557f8f833cb45 Reviewed-by: Luca Di Sera <luca.disera@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Replace the syncqt.pl script with syncqt toolAlexey Edelev2022-09-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syncqt.pl adds an extra dependency on perl when building Qt. Modern C++ provides the convenient cross-platform way to access a filesystem and to use regular expressions, so we may replace the perl script with C++ application. The syncqt executable is built at configure time and installed as QtCore tool. It's running at configure time to deliver the required header files for IDE to build a consistent code model and at the build time to keep tracking changes in header files and generate the missing aliases without reconfiguring. 'syncqt' only parses header files from a CMake build tree, so the resulting Qt installation only contains interfacing headers that belong to the platform that Qt is built for. 'sync.profile' files are not used as the 'source of truth' for sync qt procedure anymore, all the necessary information is taken from either CMake files at configure time or from the module header files while parsing them. syncqt.pl is still in place since it's required as fallback solution for a smooth transition to the new syncqt implementation for all qt repositories. This patchset only enables the C++ based syncqt for 'qtbase' repository. From the performance perspective C++ version works faster then perl script, also the configure time is reduced significally on subsequent reconfigurations - up x2 times faster when re-configuring repository, but it also takes time to compile the tool itself the first time. Numbers for qtbase: syncqt.pl syncqt.cpp initial: 0m16,035s 0m20,413s reconfig: 0m6,819s 0m3,725s The syncing procedure can be run separately for each module using <ModuleName>_sync_headers targets. The 'sync_headers' target can be used to sync all the modules at once. Task-number: QTBUG-87480 Task-number: QTBUG-103196 Change-Id: I8c938bcaf88a8713b39bbfd66d9e7ef12b2c3523 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>
* 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>
* Doc: Skip 'qt5/' part in 3rd party documentationKai Köhne2022-06-231-0/+1
| | | | | | | | Pick-to: 6.4 Fixes: QTBUG-104463 Change-Id: I7596118e147c9b5b12b49c4cf2692626697f309e Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Assume qhelpgenerator in libexec instead of binJoerg Bornemann2021-11-081-1/+1
| | | | | | Task-number: QTBUG-88791 Change-Id: I0f6dc14401e715a98322abc21da3f88e34118e27 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* CMake: QtDocsHelpers: Rename generate_qdocs_args variableTopi Reinio2021-11-031-2/+2
| | | | | | | | | To be consistent with prepare_qdoc_args. Pick-to: 6.2 Change-Id: Ibd40d6c26f6f6fa49ea78b6476f396153b7c4ee5 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* 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>
* Fix location of qtattributionsscanner in doc buildsKai Köhne2021-06-031-6/+9
| | | | | | | | qtattributionsscanner is now found in libexec. Task-number: QTBUG-88791 Change-Id: Ie704663012be92b0c223d9d57210ec1874abff0b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make a documentation-only build possibleJoerg Bornemann2021-04-291-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Packagers usually build Qt per repo, but the documentation must be built from the full Qt source archive to ensure that inter-repo links are set up correctly. When building the documentation, it's desirable to avoid building tools and re-use to tools of an existing Qt build. One now can do a documentation-only build by configuring Qt like this: cmake /path/to/Qt/source -GNinja \ -DQT_HOST_PATH=/path/to/Qt/installation and build the documentation with ninja docs To avoid building tools, this patch removes the DEPENDS arguments from some add_custom_target calls in QtDocsHelpers.cmake and makes another one conditional. The removed dependencies are added at the end of qt_internal_add_docs. Adding of tool dependencies is not done if QT_HOST_PATH is set. Fixes: QTBUG-88441 Change-Id: I3b7a908e22d252d2edcdc1dd522a78b8ad6c487e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove redundant .qch from installed docsAlexey Edelev2021-01-081-1/+3
| | | | | | | | | | Use upper-level document build directory for generated .qch files. This avoids copying of .qch with html documents and duplicating them in the installation directory. Pick-to: 6.0 Change-Id: I63b2de0047005419d352ea259dec6f17a826a477 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix qch install pathAlexey Edelev2021-01-071-1/+1
| | | | | | | | | Exclude qch_file_name from install DESTINATION Fixes: QTBUG-89769 Pick-to: 6.0 Change-Id: I8dba13a0a2c2c92d6b2d6aa438c295b42a04156b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Handle empty INCLUDE_DIRECTORIES in genex for qdocCraig Scott2020-11-301-1/+1
| | | | | | | | | | | | | | | Follow the pattern recommended in the CMake docs for the $<JOIN:...> generator expression. Wrap it in a $<BOOL:...> genex so that if a target's INCLUDE_DIRECTORIES property is empty, we don't add a stray -I with no directory following it. This fixes the following error when running qdoc: qdoc: Missing value after '-I'. Pick-to: 6.0 Task-number: QTBUG-88838 Change-Id: Ie3ef2625fbb29cc501f7fc22ff7a9cc8ac548322 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow generating documentation for INTERFACE targetsAlexandru Croitor2020-11-251-2/+9
| | | | | | | | | | | | Query the include dirs from the INTERFACE_INCLUDE_DIRECTORIES property when generating docs for an INTERFACE library. Amends 2db41fefa006c9aabd577eee98b8a9594d264470 Pick-to: 6.0 Task-number: QTBUG-88838 Change-Id: Ic8a454ba66b2dbc59bad883e1e0d38ebb26d0370 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Allow using DESTDIR when installing documentationChristophe Giboudeaux2020-11-101-7/+20
| | | | | | | | | | | | | | Previously, QtDocsHelpers.cmake was invoking CMake to copy files or directories instead of using installation targets. This resulted in DESTDIR being ignored. Now we create installation targets and ask CMake to install them. Change-Id: Idbc79d47a37f9ca865d28543bdbbdde3ba448fa3 Fixes: QTBUG-87382 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow using a custom target for qt_internal_add_docsAlexandru Croitor2020-11-071-1/+1
| | | | | | | | | | | Some repos (like qtimageformats) might not have Qt modules, but they still need a target to pass to qt_internal_add_docs(). Allow passing custom targets to qt_internal_add_docs() without trying to generate bogus include paths. Change-Id: I12191e5b16c082e62e40c96d0eb4d6c0256e7ea4 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Disconnect docs installation targets from generation targetsJoerg Bornemann2020-11-061-3/+0
| | | | | | | | | | | | | | | | | "ninja install_docs" should not run the "docs" target, because with the usual workflow ninja docs ninja install_docs the documentation would be built twice. That of course means that "ninja install_docs" will fail if "ninja docs" wasn't run before. Analogous for html_docs, qch_docs, the repository-level and module-level documentation targets. Change-Id: I8ad83602dd393b5afc79a19ab3d395987c889d0d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix top-level documentation install targetsJoerg Bornemann2020-11-061-0/+2
| | | | | | | | | | | | | | | | | | | | | The following targets did not do any actual installation: install_docs, install_html_docs, install_qch_docs, plus their repository-level counterparts. Add the following dependencies: install_html_docs --> install_html_docs_<repo> --> install_html_docs_<module> Analogous for qch. The install_docs target already triggers install_html_docs and install_qch_docs. Analogous for install_docs_<repo>. Fixes: QTBUG-86738 Change-Id: I3468e000e050e2787a859e61d40161f5459cb351 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix qdoc builds for non-top-level developer buildsKai Koehne2020-10-281-3/+1
| | | | | | | | Fixes a regression introduced in commit 748b3b9c8971e35 for builds that are both not a QT_SUPERBUILD and not QT_WILL_INSTALL. Change-Id: I52b920176a2696fa6206b89b2b69ae1a7f3fbc25 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Re-work documentation targetsJoerg Bornemann2020-10-281-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The top-level prepare_docs target is supposed to run before the generate_docs target. The repository-level targets like prepare_docs_qtbase now also run before their respective generate targets. To achieve that, several intermediate targets had to be introduced. The dependencies for top-level generate_docs look like this: /--> generate_top_level_docs_Core --\ generate_docs ---> generate_top_level_docs_Gui -----> prepare_docs \--> ... --/ The dependencies for repo-level generate_docs_<repo> look like this: /--> generate_repo_docs_Core generate_docs_qtbase ---> generate_repo_docs_Gui \--> ... generate_repo_docs_Core --\ generate_repo_docs_Gui -----> prepare_docs_qtbase ... --/ Analoguous for qch_docs. And last but not least, the module-level generate_docs_<module> depends on prepare_docs_<module>, just like before. The strangely named top-level install targets have been renamed to install_html_docs, install_qch_docs and install_docs. The html_docs target is now merely an alias for generate_docs. Apart from prepare_docs, the top-level targets do not depend on the repository-level targets anymore. Targets that are just an alias (docs, install_docs, ...) have been re-defined to depend just on the respective top-level targets. Fixes: QTBUG-87758 Change-Id: I24466d3a252d518a30a2064bf876be881c46231f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't invoke QDoc excessivelyTopi Reinio2020-10-241-16/+2
| | | | | | | | | | | | | | | The html_docs target does not need to call QDoc a third time as both its dependencies already do that. With qmake, html_docs did invoke QDoc if CONFIG did not include 'prepare_docs', but none of the Qt modules used that configuration. We can manage without it for now. Fixes: QTBUG-87751 Change-Id: I45d2d06006c566c431ae41d7f3a06d6b809987f2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Let doc targets depend on doc tools in top-level buildJoerg Bornemann2020-10-231-0/+21
| | | | | | | | | | | | | | | For top-level builds it's desirable to have "ninja generate_docs" build all tools needed to generate the documentation. This is problematic since the doc-generating targets are created before the doc tool targets. Thus, we must defer the dependency connection if the doc tool target is not yet available. This patch adds the functions qt_internal_defer_dependency and qt_internal_add_deferred_dependencies. Change-Id: Ica940b80882e67cb0e0943e95541f7f4d1885948 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix typo in variable nameJoerg Bornemann2020-10-231-3/+2
| | | | | Change-Id: I310ff17c75970482803294bb5f4473bcaebdc151 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow docs generation without installing in top-level buildsJoerg Bornemann2020-10-231-2/+6
| | | | | | | | | | | | | | This patch allows in top-level prefix builds to build Qt and to generate the documentation without running cmake --install first. For top-level builds we now always use the qdoc binary from the build directory, not the installation directory. We also have to copy the global doc files to the build directory to make them accessible to the generate_docs target. Change-Id: I2251603418fc3df9a21c7f2892789e9ff6c8cc21 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix html_docs targets for top-level buildsJoerg Bornemann2020-10-191-6/+1
| | | | | | | | | | | Do not append "/qtbase" to QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX when doing a top-level build. The "/qtbase" suffix is already part of this variable's content. Fixes: QTBUG-87682 Change-Id: If1c2075dc58d4b07a4c3a1eed12cc3336c5dc8e6 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Rename internal functions to contain qt_internalAlexandru Croitor2020-09-231-1/+1
| | | | | | | | | | Offer compatibility wrapper functions until we update all of the Qt repos to use the new names. Task-number: QTBUG-86815 Change-Id: I5826a4116f52a8509db32601ef7c200f9bd331de Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* cmake: Fix generation of third-party attributesKai Koehne2020-08-261-1/+1
| | | | | | | Fix name of target so that qtattributionsscanner actually generates content. Change-Id: Ie42067928d7cd1de02fa4ae92a0f5ef54bd54a5c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* cmake: Fix building documentation on WindowsKai Koehne2020-08-261-6/+6
| | | | | | | Make sure the executable path contains an .exe on Windows. Change-Id: I972a3aaf1ad0510525ebfcc84e8c589f555c6d00 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Split QtBuild.cmake into smaller filesAlexandru Croitor2020-08-141-0/+198
QtBuild.cmake is huge. Split it. Move module, plugin, tools, executables and test related functions out of QtBuild.cmake into separate files. Do the same for many other things too. An additional requirement is that all the new Helpers files only define functions and macros. No global variable definitions are allowed, nor execution of commands with side effects. Some notes: qt_install_qml_files is removed because it's dead code. Some functions still need to be figured out, because they are interspersed and depend on various global state assignments. Task-number: QTBUG-86035 Change-Id: I21d79ff02eef923c202eb1000422888727cb0e2c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>