Commit Graph

23 Commits

Author SHA1 Message Date
Cristian Le 8e9e23b898 Use `_qt_internal_set_source_file_generated`
Migrate implementations that set `GENERATED` source property

Also standardize the `TARGET_DIRECTORY` passing

Fixes: QTBUG-125077
Pick-to: 6.9 6.10
Change-Id: I0651ad69ec127b615b599707e12ab3840dc1135c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-06-24 14:07:30 +02:00
Ulf Hermann 390c78b394 QtQml: Drop checks for compile hash and Qt version from the CUs
The data structure version is supposed to encode any incompatible
changes to our compilation unit format. Checking the compile hash and Qt
version in addition is redundant and excessively restrictive.

[ChangeLog][QtQml] You can now use QML code compiled with Qt Quick
Compiler across Qt versions as long as the compilation unit format
hasn't changed between those versions. You cannot rely on the
compilation unit format to stay unchanged under any specific
circumstances. However, we won't change it unnecessarily.

Change-Id: I8c407b505ac7fa952f53fa25bb6d4e7caf0fba0c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-03-18 10:53:07 +01:00
Ulf Hermann 7fae1cbb3c Use git tree hash rather than commit hash as QML_COMPILE_HASH
You can have multiple commit hashes for the same contents. We've seen
that already with the .tag files. We don't want the AOT-compiled
artifacts to be rejected if those are mixed when building host and
target versions of Qt.

Pick-to: 6.9 6.8 6.5
Fixes: QTBUG-134442
Change-Id: Idba4aa4786ae5d638efd1324315a1a5c21ed070c
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-03-07 09:00:11 +01:00
Alexey Edelev f4528858f6 Mark RegExpJitTables.h as non-module header
RegExpJitTables.h should not be processed by syncqt and should not
be installed. So disable any postprocessing of the header by setting
the _qt_non_module_header.

Pick-to: 6.5
Change-Id: Ib91399bacea5f792559a2ae2274bcdcb8ae9ae8b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 15:38:57 +02:00
Amir Masoud Abdol 64de90a977 Make Sure that `qml_compile_hash_p.h` Isn't Missing
In the event of an unexpected build directory corruption, CMake
may fail to replace/install the `qml_compiler_hash_p.h` properly.

I have had similar errors with other files missing as well, so this
fix might be applicable to elsewhere as well.

Pick-to: 6.4
Change-Id: Ife3e28a09296b5428d0f0248648caabda601c94d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-26 14:02:58 +02:00
Alexey Edelev db98e5c309 Mark files generated by add_custom_command with the GENERATED property
Old CMake versions don't set the GENERATED property to TRUE
automatically for files that are generated by add_custom_command calls.
Add the flag explicitly for guarantee the correct work of functions
that may use it.

Task-number: QTBUG-87480
Change-Id: Id3e924a9ae12f6a67f5280b8f369f0da84ac2bbf
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-27 02:42:57 +02:00
Alexey Edelev 1fddbe77f3 Add qml_compile_hash_p.h to the Qml module sources
Change-Id: I0b607cda3e6e22d558010da5d405ed9cb017a914
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-22 11:11:11 +02:00
Lucie Gérard 1b9808737a Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: Id89ed14990804a5024183e75382cc539d4293da1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-07 17:01:30 +02:00
Lucie Gérard 5a7b716474 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: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-07-08 10:41:06 +02:00
Alexey Edelev 396d8b0d17 Add VERBATIM option to add_custom_command calls
Use VERBATIM option to prepare the correct command line for the
add_custom_command. This especially sensitive when using build
directories with names containing special symbols, that cannot be
handled by shell correctly.

Change-Id: Ic6ea2a557fe4e7ccc1d2a0c5c4ab707223c0b91a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-31 20:09:57 +02:00
Alexandru Croitor 09aecb0d77 CMake: Skip qml compile hash recreation in developer builds
The current implementation favors recreation of the hash whenever
the git tree hash is changed and a cmake reconfiguration is forcibly
done by the developer. This causes a rebuild of the Qml library.

This dependency tracking is too coarse and not very helpful.

A developer that doesn't touch the Qml library sources will be
confused why a commit rebuilds the library.

A developer that does touch the Qml library will be confused why the
qml hash hasn't changed after running ninja, and even more
confused when it is changed after a commit and reconfigure.

To improve the situation a bit, the build system will now not recreate
the hash when doing a developer build and the developer will be
expected to remove the already existing hash file when necessary.

This will not cause issues in our CI developer build configurations
where cache files are not removed.
Even though the cache files are not removed, the qtdeclarative build
directory will be clean, which means the qml hash file will not be
present and will be created with up-to-date content, thus invalidating
all cache files.

Pick-to: 6.2 6.3
Change-Id: I809b2cffbc5bb2b09af4fb712c7e46a743bfd333
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-02-12 14:03:45 +01:00
Ulf Hermann 0aa6cafe81 Restore comment describing how the compile hash works
This is really useful information and had to be painstakingly
re-discovered.

Task-number: QTBUG-99608
Change-Id: I21f7fc56745c9fb979f61710bebd8ad83e702cc4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-26 11:18:54 +01:00
Ulf Hermann 17dcba6995 Use tree hash rather than commit hash in .tag file
We want equal source packages to have the same .tag file, even if their
commit hashes differ.

Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-99608
Change-Id: Ide5047acec78fdd91617577b3c2125feb0b2bdf4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-25 23:55:27 +01:00
Volker Hilsheimer 839dc73831 Fall back to a cmake generated compile hash when git failed
Even if we have git, the source tree might not be a git repository, or
git might fail for various reasons. So always fall back to the cmake-
generated QML compile hash when it's empty after trying the .tag file
and git.

Amends a1bba5cd3d.

Pick-to: 6.2 6.3
Change-Id: Ie9f5642bbfc0cead40138d1f92fe3d673f6dc372
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-01-24 06:53:27 +01:00
Alexandru Croitor e0eb75b2a0 CMake: Fix lookup of Python for qtdeclarative
Always use FindPython instead of find_program because the former
looks for Python in more locations (like the Windows registry).

We switch to FindPython instead of FindPythonInterp because the latter
is deprecated, and the former is available in our minimum support
CMake version (3.16).

Because find_package is called in configure.cmake that is called by a
function() call, we need to make the found interpreter a cache
variable to make it available outside of the function.

Pick-to: 6.2 6.3
Fixes: QTBUG-99273
Change-Id: Idb6620a01b4b5764f130f9dc5780d73cd2151965
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-20 19:33:01 +01:00
Ulf Hermann a1bba5cd3d CMake: If no git and no tag file are found, compute compile hash
In that case we can just hash all the source files in src/qml to get a
reasonable approximation of a compile hash.

Pick-to: 6.2 6.3
Change-Id: Ifaf2c8145ab16d9f8d23570fa9acbb7a76ebda03
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-14 20:03:57 +01:00
Ulf Hermann 0616a44e8a Fix handling of QML_COMPILE_HASH
We need to check for the contents of the tag file, not its name. We need
to strip the contents before checking. We need to run git in the right
directory. We need to fail if we cannot find any QML_COMPILE_HASH.

Pick-to: 6.3 6.2
Task-number: QTBUG-99608
Change-Id: Ic42a073b196143f8576a84e7a4531b5f2927fb68
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-01-07 01:17:39 +01:00
Kai Köhne 403ecb6422 Fix missing 'We mean it' warning for generated qml_compile_hash_p.h
Pick-to: 6.1
Change-Id: I327d377c80749741274a76dfa609417c005bf6c7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-31 17:06:00 +02:00
Alexandru Croitor ded331ce62 CMake: Regenerate configure.cmake files
This will cause cmake to show the usual configure reports.
Needed to add a custom function to find python (not currently
used though, except for the configure report).

Change-Id: Id68efc5badeaa30834a37fe751c1d5b6bfd96d92
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-04 22:27:33 +02:00
Leander Beernaert 3e0edc61cf Update metatypes dependency calculation
Retrieve the list of dependent metatypes.json using the new source
interfaces.

Change-Id: I6ab57f370864031f2dbd097f14c3ebe6e7601d61
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-10 15:08:14 +00:00
Leander Beernaert ba0ac519e3 Update qmltypes to use the new metatypes dependency format
The foreign types list for qmltypesregistrar is now generated by
recursively processing the ${targets}_metatypes_dep.txt file.

At build time we now use a custom script
(Qt6QmlResolveDependencies.cmake) to generate the final foreign types
file.

qmltypesregistrar has also been updated in order to support the
resolution of response files supplied to the command line arguments.

Change-Id: Ib61d82fa92bf5d5a24631f461248f81147aad947
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-29 14:33:47 +00:00
Cristian Adam 2ccd7b931f CMake Build: Use find_package(PythonInterp) instead of "python"
I had python3 installed on Windows, which doesn't have python as
executable.

find_package(PythonInterp) finds the right executable and it simply
works.

Change-Id: I69bf8e4dfbe29de56109fe1927569000d710c3f5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-23 10:01:03 +00:00
Alexandru Croitor 6c69a6ab7c Initial CMake port
Crude port of QtQml, QtQmlModels, QtQuick and a few tests and a few
examples.

Task-number: QTBUG-74136
Change-Id: I5de4d8215b33d1a4a72c2c0e7951e4b384f27e3e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-03 11:03:46 +00:00