Commit Graph

121 Commits

Author SHA1 Message Date
Christian Strømme
9c3c87f6d0 Add enablers to expose semi-public APIs for QtQuick3D
Follow the same patterns as for qpa and rhi. Semi-public APIs will be
put under the "namespace" ssg which is short for Spatial Scene Graph.

Taks-number: QTBUG-116570
Change-Id: I38887f129ec90e67f6a929a0d8ea5ea8b8c49ee8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-05 13:42:50 +02:00
Alexey Edelev
7544d91ae1 Use the relative header path when checking if it's 3rdparty
If source or build directry contain '3rdparty' in their path, all
header files are marked as 3rdparty and will never be installed.
This commit is CMake counterpart of
ea4a3d78a7

Amends ea4a3d78a7

Fixes: QTBUG-116137
Pick-to: 6.5 6.6
Change-Id: Ib93fb879867e3aeb6e44193c4253e73173c141d2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-17 13:09:46 +02:00
Alexey Edelev
ecda814b91 Allow disabling QT_USE_QSTRINGBUILDER definition for module targets
Currently QT_USE_QSTRINGBUILDER is added for all Qt module targets by
default, and it's not possible to remove this definition.
Replace this definition with the generator expression that is
propagated by the PlatformModuleInternal target.

Change-Id: I1c606e16809dc720e2eb72191e1670dfc48f1b48
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-09 15:53:08 +02:00
Marc Mutz
51b3269eef cmake helpers: support NO_PCH_SOURCES wherever NO_UNITY_BUILD_SOURCES are
The former implies the latter, so it makes little sense to treat them
differently. Even if some types of targets are (currently) never
compiled with PCH, users of qt_internal_all_x() shouldn't need to know
such details.

Pick-to: 6.6 6.5
Change-Id: I8ead238a8d9e55da632b2929638b67724a42d73c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-07 23:56:10 +02:00
Joerg Bornemann
6fec9646ac Fix comment in QtModuleHelpers.cmake
Don't talk about syncqt.pl anymore.

Change-Id: If153ffde9992c784cf71ae1bb5192e5e4bbb8628
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-27 18:36:06 +02:00
Alexey Edelev
65b0bc0eed Fix external header support in qtsync
We should sync external headers for 3rdpary projects
like freetype and harfbuzz-ng and keep the directory
structure.

Fixes: QTBUG-113416
Pick-to: 6.6 6.5
Change-Id: Ie66edb9a21cff37ca6c8c68b6d225de6d8bbad81
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
2023-06-09 13:42:05 +00:00
Alexandru Croitor
e3c6754760 Revert "CMake: make compile options consistent for Qt created libraries"
This reverts commit 389507a047.

Reason for revert: The original patch unintentionally changes
the deprecation warning behavior for user projects. Merging
the current change will resurface the original static qt build
bug until a new fix is developed.

Pick-to: 6.6
Change-Id: I29b41b43fdd76b19bc46439470e04443dc2b8ddb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
2023-06-08 11:04:45 +00:00
Yuhang Zhao
389507a047 CMake: make compile options consistent for Qt created libraries
Currently some libraries created by Qt are lacking some compile
definitions and compile options, and this issue is causing us
troubles when building Qt statically. This patch tries to reduce
the parameter difference when compiling Qt's own libraries.

Change-Id: I3842943a874fab32ef90980e8aa29f5beb01feeb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-05-31 01:08:45 +00:00
Laszlo Agocs
1dd8b5ceec rhi: Make it a QPA-style private but semi-public API
qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from
shadertools; done separately) become "RHI APIs", following the concept
of QPA APIs.

Mirror completely what is done for QPA headers, but using the "rhi"
prefix for the headers. This involves updating syncqt to handle the
new category of headers. (a note on the regex: matching everything
starting with "qrhi" is not acceptable due to incorrectly matching
existing and future headers, hence specifying the four header names
explicitly)

There is going to be one difference to QPA: the documentation for
everything RHI is going to be public and part of the regular docs, not
hidden with \internal.

In addition to the header renaming and adding the comments and
documentation notes and warnings, there is one significant change
here: there is no longer a need to do API-specific includes, such as
qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a
single header that is then included from qrhi.h. This means that users
within Qt, and any future applications can just do #include
<rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no
other headers are needed.

There are no changes to functionality in this patch. Only the
documentation is expanded, quite a lot, to eliminate all qdoc warnings
and make the generated API docs complete. An example, with a quite
extensive doc page is added as well.

Task-number: QTBUG-113331
Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-21 15:42:58 +02:00
Alexey Edelev
b523a655c8 Do not use REALPATH when collecting Qt header files
CMake doesn't resolve REALPATH for the non-existing files.
This limitation blocks the use of REALPATH when collecting the
generated module header files. The real path should be resolved
by syncqt implicitly and CMake scripts should rely on ABSOLUTE paths
only, which should be consistent for any files including the generated
files.

Task-number: QTBUG-113295
Pick-to: 6.5
Change-Id: I0219c7bf34ef6a6589c6d5fade4c2ed3f8036ef0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-05-03 13:22:22 +02:00
Joerg Bornemann
24fe86ebe7 CMake: Store unsanitized plugin type names in module .json files
The module information .json gained a "plugin_types" key in 6.5.0.
Unfortunately, this contained the "sanitized" version of plugin types,
meaning dashes converted to underscores. For plugin types that contain
dashes, e.g. wayland-decoration-client, the file contained
wayland_decoration_client, which doesn't match its plugin directory
name.

Since "unsanitizing" plugin names is hard and "sanitizing" is easy, we
now store the unsanitized plugin names and burden the consumer of the
module .json files with the sanitation task.

[ChangeLog][CMake] The module information JSON files now contain the
unsanitized plugin types of a module, e.g. wayland-decoration-client
instead of wayland_decoration_client. Consumers of the module
information file must sanitize plugin types themselves if necessary.

Pick-to: 6.5
Fixes: QTBUG-112872
Change-Id: I09cc9406b360779087086707abee3d5219a24452
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-18 09:29:33 +02:00
Amir Masoud Abdol
ed85df8008 Improvement to NO_UNITY_BUILD_SOURCES, and fix related bugs
The source of the problem was in `qt_set_target_info_properties` which
was not able to process the NO_UNITY_BUILD_SOURCES, and therefore
leaking it into the `TARGET_COPYRIGHT`, ie., the last argument. So, I
decided to pass Unity Build arguments before them, and closer to
SOURCES, which is nicer to read, and avoid similar situation. And
I reverted the work around in the amend commit, and passing the
arguments normally.

This happens because we pass an unfiltered ${ARGN} from
qt_internal_add_executable to qt_set_target_info_properties and that the
current change is merely a workaround that ensures they get
circumstantially filtered out, because the NO_UNITY_BUILD_SOURCES option
appears before any of the first TARGET_ props.

Amend cd12c1f332

Task-number: QTBUG-99238
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Idb37937cf53e708425402c90f55bda8816e27f29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 10:41:13 +00:00
Alexey Edelev
4105ff809c Avoid syncing and installation of non-module headers
Add CMake rules to skip syncing and installation of header files
that are recognized as non-module. Previously these rules were in
syncqt.cpp only and CMake ignored them when creating the installation
rules. Now we skip any post processing for the header files that:
- are public and located in the '3rdparty' directory unless the module
  is the 3rdparty one
- are not a part of the module source tree unless they are generated
- have the _qt_non_module_header property set to TRUE

Pick-to: 6.5
Change-Id: I045cfc2b8074f0c086c975aae95f14845e3edfef
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-04-03 12:41:13 +02:00
Joerg Bornemann
656729c5b6 CMake: Write Qt's namespace into module info JSON files
If Qt was configure with QT_NAMESPACE set, store that in the module
information files under 'built_with.namespace'.

Task-number: QTBUG-111158
Change-Id: I273309cb263c64f801dbb7238440336d7afa635e
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-20 18:48:57 +01:00
Amir Masoud Abdol
cd12c1f332 Fix an issue with passing NO_UNITY_BUILD_SOURCES
Amend 31518f1a4e
Amend 3602936230

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ibb2fd881c02b6496f06b8b623fa6009358755a26
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-15 18:18:01 +01:00
Alexey Edelev
d51d7d4d5c Add support for evaluating genexes when exporting custom target props
Properties specified in EXPORT_PROPERTIES have their values exported
verbatim, without evaluating generator expression they might contain.
This limitation is removed by the introduced functions. They collect
properties that needs to be exported and evaluate generator
expressions inside the properties using file(GENERATE) before
exporting them. The functions generate the ExtraProperties.cmake
file that contains set_property calls with exported properties
and corresponding values.

Change-Id: If32c30a82a62e8bd48bb91f3df21ff2ad8d07243
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-21 22:42:01 +01:00
Amir Masoud Abdol
31518f1a4e Add some utilities for UNITY_BUILD
- The following commands accepts NO_UNITY_BUILD, and
  NO_UNITY_BUILD_SOURCES arguments to opt out of the unity build, and
  to exclude some source files from unity build, respectively.
  - qt_internal_add_executable
  - qt_internal_add_module
  - qt_internal_add_plugin
  - qt_internal_add_tool
  - qt_internal_extend_target
  - qt_internal_add_common_qt_library_helper
  - qt_internal_add_cmake_library
  - qt_internal_add_simd_part
- Unity build is disabled by default in these:
  - qt_internal_add_test
  - qt_internal_add_test_helper
  - qt_internal_add_benchmark
  - qt_internal_add_3rdparty_library
- qt_update_ignore_pch_source also excludes the files from unity_build

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I5d0e7df633738310a015142a6c73fbb78b6c3467
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-08 23:47:07 +01:00
Amir Masoud Abdol
b171abe695 Remove GENERATE_METATYPES
It doesn't seem like that it is being used anymore, except an instance
in pro2cmake which I replaced by NO_GENERATE_METATYPES.

Pick-to: 6.5
Change-Id: I135cf47e6041e98b354fb684f0079dad30689dea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-18 14:47:12 +01:00
Amir Masoud Abdol
7e82577680 Retire the qt_parse_all_arguments
This replaces the qt_parse_all_arguments macro with the built-in
`cmake_parse_arguments(PARSE_ARGV`. In addition, a new function,
_qt_internal_validate_all_args_are_parsed, can be used to check whether
any _UNPARSED_ARGUMENTS have been passed to the function.

Fixes: QTBUG-99238
Change-Id: I8cee83dc92dc6acdaaf747ea6ff9084c11dc649b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-18 14:47:12 +01:00
Amir Masoud Abdol
1b4aba0a59 Remove an obsolete TODO
There was a plan to invert the API, but since the TODO, we are settled
on the non-inverted name, ie., GENERATE_CPP_EXPORTS.

Pick-to: 6.5
Change-Id: I84f531d870965e0b7d0d821d1ff08606ab8054ab
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-17 16:15:11 +01:00
Joerg Bornemann
94e474b48e CMake: Add switch for allowing missing Qt6*Tools packages
Consider a cross build of Qt with qtbase, qtshadertools and
qtdeclarative. If a user projects only links against QtQml without
creating an actual QtQuick module, no host tools from qtdeclarative are
needed.

Normally, find_package(Qt6Qml) pulls in Qt6QmlTools and errors out if
it's not found. By setting QT_ALLOW_MISSING_TOOLS_PACKAGES when
configuring Qt, one can disable the error and build a user project such
as the one outlined above.

Pick-to: 6.4 6.5
Fixes: QTBUG-109547
Change-Id: I45e727713912d19e6007a7fbf3d61533f82b71d9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
2023-01-12 16:33:55 +01:00
Joerg Bornemann
85d235877d CMake: Store whether a module is internal in module json files
Pick-to: 6.5
Change-Id: Ic7e5e3b69a41a7723643332bebbde76854966b89
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-11 13:02:58 +01:00
Tor Arne Vestbø
adb91d6afb Enable shared library build of Qt for iOS
As of f68e2c92cc, and its follow up
changes, we can now link individual plugins statically, even if the
Qt build is generally a shared build.

This allows us to build Qt for iOS as shared libraries, while still
keeping the platform plugin as a static library, since this is
harder to port over to a shared library.

This gives the benefit of faster turnaround during development, as
well as binary compatibility promises for the main Qt libraries,
without having to go fully shared for all of Qt.

Static builds are still the default, due to the downsides of larger
application bundles and slower load times for shared builds.

For now the user has to manually tick the "Embed & Sign" check
box in Xcode for each Qt library, which is only available with
Xcode projects generated by the qmake Xcode generator.

Task-number: QTBUG-85974
Change-Id: Id2b7bd2823c8e7c79068dda95295b574ada8d7f2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-10 13:16:04 +01:00
Joerg Bornemann
0b92502de2 CMake: Store the plugin types in the module json files
This will be read by windeployqt.

Pick-to: 6.5
Change-Id: I8dfebae755ef61967e924db3c5631af5cc4e2440
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-06 22:05:57 +01:00
Morten Sørvig
a46a77a8b4 wasm: disable x.y.z suffix versioning
This simplifies deployment and eliminates the possibility
for duplicate downloads due to the browser/server not
understanding symlinks.

Change-Id: Ife22c052c424f309d76ff0f9118c01e98426da95
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-13 13:41:28 +01:00
Fabian Kosmale
b9c80ecc08 CMake: Add qt 'policy' support
This mimics CMake's policy support. The policy state is stored in an
internal __QT_INTERNAL_POLICY_<policy> variable; by using normal
variables, we gain support for stacking for free.
Policies can be explicitly en- or disable via qt6_policy; that command
also has a GET mode to retrieve them again.
Furthermore, one can now pass min and max version to
qt6_standard_project_setup, to opt in to a certain set of defaults
introduced in a given Qt version.

We add support for policies in QtModuleHelpers, so that we can check for
known policies while building Qt itself.

No actual policies exist yet; but a follow up commit will introduce one
for qt_add_qml_module.

Change-Id: I57a0404c9193926dd499f94cc5f73e359355c0b3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-10 10:43:38 +00:00
Joerg Bornemann
1180d5b8a2 CMake: Add Android build information to generated module .json files
Qt Creator maintains a mapping from Qt version to Android NDK version
and other build information. It's simpler to let the Qt build write the
Android build information into modules/Core.json and have Qt Creator use
this information.

This adds the following properties to the module JSON files:
  - built_with.android.api_version
  - built_with.android.ndk.version

Task-number: QTBUG-108292
Change-Id: I0febda5192289c5afb1a098880b31bef6317db35
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-09 16:16:49 +01:00
Alexey Edelev
2e514f8511 Add CONDITION_INDEPENDENT_SOURCES argument to qt_internal_extend_target
The argument allows to ignore the condition for source files if they
are used in the Qt code without corresponding guards. The header files
of this kind usually have internal guards, that suppress the error
at the location where they are used, so AUTOGEN is skipped for these
header files to suppress the warnings from CMake. If file belongs to
a module, it will display AUTHOR_WARNING which should urge Qt
maintainers to guard the use of the source file properly.

Task-number: QTBUG-103196
Change-Id: I7b4c12031a5d19ff15868d4782c0d396ef7aed8c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-08 23:24:22 +01:00
Alexey Edelev
a395d08c3b Remove _pri_dep_timestamp targets
It looks like these targets used to manage some custom commands that
belong to HEADER_MODULES. We don't currently have a need to use them,
so we clean up the code.

Change-Id: I8095f4de2c91a6c310cccb9b89514c2ce77e32f0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-01 02:23:52 +01:00
Alexey Edelev
7f4aa1a3fa Remove perl related functionality from CMake files
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>
2022-11-29 12:35:47 +01:00
Thiago Macieira
9cc0fc385e CMake: add SYSTEM_INCLUDE_DIRECTORIES to qt_internal_extend_target
This allows one to add an extra set of directories to the build, but let
the compiler know that they are system paths (that is, the compiler
should refrain from emitting warnings in code found there). This extends
INCLUDE_DIRECTORIES and is by necessity a private include set.

Will be used by qtquick3dphysics, due to its PhysX dependency.

Change-Id: I76216ced393445a4ae2dfffd1729c556db0cce3d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-28 10:58:21 -08:00
Thiago Macieira
4234ce12dc CMake: install the metatypes inside Qt's own arch-specific data dir
We don't want it in /lib64/metatypes, but instead /lib64/qt6/metatypes

Pick-to: 6.4
Change-Id: Id8e48e8f498c4a029619fffd17293602d7fd8bd8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-28 10:58:13 -08:00
Alexey Edelev
433d711670 Add NO_HEADERSCLEAN_CHECK flag to qt_internal_add_module
Some modules may have header files that do not pass headersclean check
under some conditions. It's nice to have an option in the
qt_internal_add_module function to disable the check for the modules of
this kind. At the moment this flag is useful for the ActiveQt module,
since it syncs and installs header files that don't belong to it.

Amends b89d63515b

Task-number: QTBUG-103196
Change-Id: I21a82d50d50bdac225ed483ab0cc50339c2a4873
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-27 16:49:42 +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
Alexey Edelev
0a4761522b Avoid the 'file' command shadowing
Avoid the 'file' command shadowing by a variable and use file name when
filtering header files by type.

Amends 8539e641f6

Task-number: QTBUG-103196
Change-Id: If012975efafaf119cffbd89baf84df334bc057ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-21 20:41:43 +02:00
Alexey Edelev
553185e8c3 Skip AUTOGEN for config files
Amends c7d1d56b09

Task-number: QTBUG-103196
Change-Id: I319ca96bb54b9d0274270790d8c92151ea3398f0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-12 20:31:04 +02:00
Alexey Edelev
c7d1d56b09 Add <module>-config[-p].h files to the module sources
<module>-config[-p].h files need to be added to the CMake source tree

Amends 8539e641f6

Task-number: QTBUG-103196
Change-Id: I8baaa672ad869da8a030d890da8bdea5bd8c7794
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-09 17:04:16 +02:00
Alexey Edelev
5d38e1f295 Suppress the PUBLIC/PRIVATE_HEADER related warning
Avoid adding module header files to a PUBLIC/PRIVATE_HEADER for the
modules. All header files are installed using install(FILES call, but
not as a part of install(TARGET

Amends 8539e641f6

Task-number: QTBUG-103196
Change-Id: Ib95295112c74f74f237e3738d2532f9049d26ce6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-07 21:15:49 +02:00
Alexey Edelev
8539e641f6 Respect CMake source tree when installing header files
Use CMake source tree when installing header files instead installing
all header files that syncqt.pl produces. This avoid adding header
files which cannot be used because of platform or feature
incompatibility with Qt version. Since syncqt.pl doesn't respect CMake
build tree when generating master header and CaMeL case header files,
these header files still will be installed regardless platform or
feature limitations. This will not be the case once we switch to
syncqt.cpp, which will install only headers that are relevant to the
selected platform and enabled features.

Task-number: QTBUG-103196
Change-Id: I7d64754648747bee700d96f2fd6228fe7248512e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-07 14:39:25 +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
Alexey Edelev
a3e8d28fdb Do not use the HEADER_MODULE argument in qt_generate_module_pri_file
HEADER_MODULE argument is passed to qt_generate_module_pri_file from
the qt_internal_add_module function, but the property means that the
module is an interface library. So it makes sense to replace this
argument with the reading of the target TYPE.

Change-Id: I1d8cd2ff732f526975cde6bdd4783fee44c8bd98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-12 13:50:55 +02:00
Alexey Edelev
548440dd4b Remove HEADER_MODULE from qt_internal_extend_target
The current qt_internal_extend_target interface expects that the caller
will pass the HEADER_MODULE argument on each call. This is not correct,
since the argument doesn't affect the target internals, but only help to
decide how to modify the target according to its type. The target type
meanwhile can be always read from target properties. So this solution is
more consistent.

Change-Id: Ie84a2226ceb71cb5272670e5d43bdfc7a101360a
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-11 13:47:15 +02:00
Alexey Edelev
c2c4a21374 Add the common headersclean_check target
Add headersclean_check that allows to run all module-specific
'_headersclean_check' targets in single command. Also add
dependency on input header files for the headers clean custom
commands.

Also adjust the '_headersclean_check' target names to match
the naming of module targets - the 'Qt' prefix is removed.

Change-Id: I17c3442c3c51ce99cd9b38c85d606e9ababbb013
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-09 15:21:52 +02:00
Alexey Edelev
60e46790dc Allow specifying multiple header types in qt_copy_framework_headers
qt_copy_framework_headers now can accept all the headers in one call.
This is useful for upcoming changes when it will accept generator
expressions as the input instead of actual files.

Change-Id: I110b6d9e6de976b2a7581902e051e38571716c5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-05 16:45:02 +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
Alexandru Croitor
6235f7fa62 CMake: Export a few useful Qt module target properties
These include:
 _qt_package_name
 _qt_is_public_module
 _qt_is_private_module
 _qt_public_module_target_name
 _qt_private_module_target_name

Pick-to: 6.4
Task-number: QTBUG-104998
Change-Id: I012463944de8fc333f477a7880f9d27a69d6ef47
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-25 19:52:31 +02:00
Tor Arne Vestbø
bee6f47d22 cmake: Teach qt_internal_extend_target about PLUGIN_TYPES
Change-Id: I2e8a3faa6ada66a644dceeb98f9ba8e994db4192
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-25 19:47:13 +02:00
Thiago Macieira
396170d07b CMake: fix the word order in "no_direct_extern_access"
And take the opportunity to remove the "m" in the qmake feature name and
.prf file.

Pick-to: 6.4
Change-Id: I36b24183fbd041179f2ffffd170224ab75cdd968
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-20 14:54:20 -07:00
Alexey Edelev
babb4ec4a6 Rename the <module>_timestamp target to <module>_pri_dep_timestamp
Make the target purpose more understandable from its name.

Change-Id: I4f4a56fd3ef338b728d4a81edc2df32cada97f6c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-07-15 19:27:08 +02:00
Alexandru Croitor
dd1030a450 CMake: Record used package version for each target dependency
When recording which package version to look for in
QtFooModuleDependencies.cmake and other files like it,
instead of using PROJECT_VERSION, use the version of the
package that contains the dependency.

For example if we're hypothetically building the qtdeclarative repo
from the 6.4 branch, against an installed 6.2 qtbase, then
the Qt6QmlModuleDependencies.cmake file will have a
find_package(Qt6Core 6.2) call because qtdeclarative's
find_package(Qt6Core) call found a 6.2 Core when it was configured.

This allows switching the versioning scheme of specific Qt modules
that might not want to follow the general Qt versioning scheme.

The first candidate would be QtWebEngine which might want to
follow the Chromium versioning scheme, something like
Qt 6.94.0 where 94 is the Chromium major version.

Implementation notes.
We now record the package version of a target in a property
called _qt_package_version. We do it for qt modules, plugins,
3rd party libraries, tools and the Platform target.

When we try to look up which version to write into the
QtFooModuleDependencies.cmake file (or the equivalent Plugins and
Tools file), we try to find the version
from a few sources: the property mentioned above, then the
Qt6{target}_VERSION variable, and finally PROJECT_VERSION.
In the latter case, we issue a warning because technically that should
never have to happen, and it's a bug or an unforeseen case if it does.

A few more places also need adjustments:
 - package versions to look for when configuring standalone
   tests and generating standalone tests Config files
 - handling of tools packages
 - The main Qt6 package lookup in each Dependencies.cmake files

Note that there are some requirements and consequences in case a
module wants to use a different versioning scheme like 6.94.0.

Requirements.
 - The root CMakeLists.txt file needs to call find_package with a
   version different from the usual PROJECT_VERSION. Ideally it
   should look for a few different Qt versions which are known to be
   compatible, for example the last stable and LTS versions, or just
   the lowest supported Qt version, e.g. 6.2.6 or whenever this change
   would land in the 6.2 branch.
 - If the repository has multiple modules, some of which need to
   follow the Qt versioning scheme and some not,
   project(VERSION x.y.z) calls need to be carefully placed in
   subdirectory scopes with appropriate version numbers, so that
   qt_internal_add_module / _tool / _plugin pick up the correct
   version.

Consequences.
 - The .so / .dylib names will contain the new version, e.g. .so.6.94
 - Linux ELF symbols will contain the new versions
 - syncqt private headers will now exist under a
   include/QtFoo/6.94.0/QtFoo/private folder
 - pri and prl files will also contain the new version numbers
 - pkg-config .pc files contain the new version numbers
 - It won't be possible to write
   find_package(Qt6 6.94 COMPONENTS WebEngineWidgets) in user code.
   One would have to write find_package(Qt6WebEngineWidgets 6.94)
   otherwise CMake will try to look for Qt6Config 6.94 which won't
   exist.
 - Similarly, a
   find_package(Qt6 6.4 COMPONENTS Widgets WebEngineWidgets) call
   would always find any kind of WebEngine package that is higher than
   6.4, which might be 6.94, 6.95, etc.
 - In the future, if we fix Qt6Config to pass EXACT to its
   subcomponent find_package calls,
   a find_package(Qt6 6.5.0 EXACT COMPONENTS Widgets WebEngineWidgets)
   would fail to find WebEngineWidgets, because its 6.94.0 version
   will not be equal to 6.5.0. Currently we don't pass through EXACT,
   so it's not an issue.

Augments 5ffc744b79

Task-number: QTBUG-103500
Change-Id: I8bdb56bfcbc7f7f6484d1e56651ffc993fd30bab
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-07-01 10:50:57 +02:00