Commit Graph

29 Commits

Author SHA1 Message Date
Thibaut Cuvelier
e8d6accb93 Fix a typo in a comment
Change-Id: I3ff1bd0d00fd56fa980bc86f71c557f8f833cb45
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-10-18 18:09:55 +02:00
Alexey Edelev
b89d63515b Replace the syncqt.pl script with syncqt tool
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>
2022-09-27 13:12:11 +02:00
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
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>
2022-08-23 23:58:42 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
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>
2022-08-03 17:14:55 +02:00
Kai Köhne
267db4eab4 Doc: Skip 'qt5/' part in 3rd party documentation
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>
2022-06-23 01:30:23 +02:00
Joerg Bornemann
4f360e3b76 Assume qhelpgenerator in libexec instead of bin
Task-number: QTBUG-88791
Change-Id: I0f6dc14401e715a98322abc21da3f88e34118e27
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-11-08 19:27:32 +01:00
Topi Reinio
51becc4c66 CMake: QtDocsHelpers: Rename generate_qdocs_args variable
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>
2021-11-03 16:47:18 +02:00
Topi Reinio
725b52141d CMake: Introduce QT_BUILD_ONLINE_DOCS flag for documentation builds
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>
2021-09-30 15:38:07 +02:00
Kai Köhne
f00c63093b Fix location of qtattributionsscanner in doc builds
qtattributionsscanner is now found in libexec.

Task-number: QTBUG-88791
Change-Id: Ie704663012be92b0c223d9d57210ec1874abff0b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-03 18:23:40 +02:00
Joerg Bornemann
582fdf06d1 Make a documentation-only build possible
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>
2021-04-29 13:05:16 +02:00
Alexey Edelev
4d34314679 Remove redundant .qch from installed docs
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>
2021-01-08 16:51:26 +01:00
Alexey Edelev
0f38f69d44 Fix qch install path
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>
2021-01-07 14:13:41 +00:00
Craig Scott
bac73a36e2 CMake: Handle empty INCLUDE_DIRECTORIES in genex for qdoc
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>
2020-11-30 15:39:21 +11:00
Alexandru Croitor
a9d687c63c CMake: Allow generating documentation for INTERFACE targets
Query the include dirs from the INTERFACE_INCLUDE_DIRECTORIES property
when generating docs for an INTERFACE library.

Amends 2db41fefa0

Pick-to: 6.0
Task-number: QTBUG-88838
Change-Id: Ic8a454ba66b2dbc59bad883e1e0d38ebb26d0370
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-25 22:08:10 +01:00
Christophe Giboudeaux
30ba185583 CMake: Allow using DESTDIR when installing documentation
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>
2020-11-10 16:54:42 +01:00
Alexandru Croitor
2db41fefa0 CMake: Allow using a custom target for qt_internal_add_docs
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>
2020-11-07 19:33:37 +01:00
Joerg Bornemann
2746051522 CMake: Disconnect docs installation targets from generation targets
"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>
2020-11-06 22:03:51 +01:00
Joerg Bornemann
db939d8f33 CMake: Fix top-level documentation install targets
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>
2020-11-06 22:03:51 +01:00
Kai Koehne
1f6543902d Fix qdoc builds for non-top-level developer builds
Fixes a regression introduced in commit 748b3b9c89 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>
2020-10-28 17:14:57 +01:00
Joerg Bornemann
da1854c683 CMake: Re-work documentation targets
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>
2020-10-28 10:38:28 +01:00
Topi Reinio
c4245e7b8c CMake: Don't invoke QDoc excessively
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>
2020-10-24 17:44:34 +00:00
Joerg Bornemann
4bf8f70bfe CMake: Let doc targets depend on doc tools in top-level build
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>
2020-10-23 21:11:40 +02:00
Joerg Bornemann
86064e1298 CMake: Fix typo in variable name
Change-Id: I310ff17c75970482803294bb5f4473bcaebdc151
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-23 21:11:36 +02:00
Joerg Bornemann
6681fa7b73 CMake: Allow docs generation without installing in top-level builds
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>
2020-10-23 11:36:48 +02:00
Joerg Bornemann
748b3b9c89 CMake: Fix html_docs targets for top-level builds
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>
2020-10-19 16:38:39 +02:00
Alexandru Croitor
e0c62a48b8 CMake: Rename internal functions to contain qt_internal
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>
2020-09-23 16:59:05 +02:00
Kai Koehne
639c2e7f20 cmake: Fix generation of third-party attributes
Fix name of target so that qtattributionsscanner actually generates content.

Change-Id: Ie42067928d7cd1de02fa4ae92a0f5ef54bd54a5c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-26 17:31:07 +02:00
Kai Koehne
f1b835e98f cmake: Fix building documentation on Windows
Make sure the executable path contains an .exe on Windows.

Change-Id: I972a3aaf1ad0510525ebfcc84e8c589f555c6d00
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-26 17:30:59 +02:00
Alexandru Croitor
44cce1a2ea CMake: Split QtBuild.cmake into smaller files
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>
2020-08-14 13:17:11 +02:00