2022-07-05 13:26:52 +02:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2022-08-19 15:21:34 +02:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2022-07-05 13:26:52 +02:00
|
|
|
|
2021-05-18 17:00:01 +10:00
|
|
|
macro(qt_internal_get_internal_add_module_keywords option_args single_args multi_args)
|
|
|
|
set(${option_args}
|
|
|
|
STATIC
|
|
|
|
EXCEPTIONS
|
2025-01-27 10:02:23 +01:00
|
|
|
FIND_PRIVATE_MODULE
|
2021-05-18 17:00:01 +10:00
|
|
|
INTERNAL_MODULE
|
|
|
|
HEADER_MODULE
|
|
|
|
DISABLE_TOOLS_EXPORT
|
|
|
|
SKIP_DEPENDS_INCLUDE
|
|
|
|
NO_MODULE_HEADERS
|
|
|
|
NO_SYNC_QT
|
|
|
|
NO_PRIVATE_MODULE
|
|
|
|
NO_CONFIG_HEADER_FILE
|
|
|
|
NO_ADDITIONAL_TARGET_INFO
|
|
|
|
NO_GENERATE_METATYPES
|
2022-10-24 18:35:12 +02:00
|
|
|
NO_HEADERSCLEAN_CHECK
|
2023-11-28 14:01:19 +01:00
|
|
|
NO_GENERATE_CPP_EXPORTS
|
2023-01-31 14:05:16 +01:00
|
|
|
NO_UNITY_BUILD
|
2024-06-14 19:07:16 +02:00
|
|
|
${__qt_internal_sbom_optional_args}
|
2021-05-18 17:00:01 +10:00
|
|
|
)
|
|
|
|
set(${single_args}
|
|
|
|
MODULE_INCLUDE_NAME
|
2021-04-06 18:57:11 +02:00
|
|
|
MODULE_INTERFACE_NAME
|
2021-05-18 17:00:01 +10:00
|
|
|
CONFIG_MODULE_NAME
|
|
|
|
PRECOMPILED_HEADER
|
|
|
|
CONFIGURE_FILE_PATH
|
2021-09-10 17:24:43 +02:00
|
|
|
CPP_EXPORT_HEADER_BASE_NAME
|
2021-12-14 09:54:33 +01:00
|
|
|
EXTERNAL_HEADERS_DIR
|
2022-08-12 19:53:14 +02:00
|
|
|
PRIVATE_HEADER_FILTERS
|
|
|
|
QPA_HEADER_FILTERS
|
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-04-27 13:16:29 +02:00
|
|
|
RHI_HEADER_FILTERS
|
2023-08-04 16:57:42 +02:00
|
|
|
SSG_HEADER_FILTERS
|
2022-08-15 18:29:41 +02:00
|
|
|
HEADER_SYNC_SOURCE_DIRECTORY
|
2021-05-18 17:00:01 +10:00
|
|
|
${__default_target_info_args}
|
CMake: Generate an SPDX v2.3 SBOM file for each built repository
This change adds a new -sbom configure option to allow generating and
installing an SPDX v2.3 SBOM file when building a qt repo.
The -sbom-dir option can be used to configure the location where
each repo sbom file will be installed.
By default it is installed into
$prefix/$archdatadir/sbom/$sbom_lower_project_name.sdpx
which is basically ~/Qt/sbom/qtbase-6.8.0.spdx
The file is installed as part of the default installation rules, but
it can also be installed manually using the "sbom" installation
component, or "sbom_$lower_project_name" in a top-level build. For
example: cmake install . --component sbom_qtbase
CMake 3.19+ is needed to read the qt_attribution.json files for
copyrights, license info, etc. When using an older cmake version,
configuration will error out. It is possible to opt into using an
older cmake version, but the generated sbom will lack all the
attribution file information.
Using an older cmake version is untested and not officially supported.
Implementation notes.
The bulk of the implementation is split into 4 new files:
- QtPublicSbomHelpers.cmake - for Qt-specific collecting, processing
and dispatching the generation of various pieces of the SBOM document
e.g. a SDPX package associated with a target like Core, a SDPX
file entry for each target binary file (per-config shared library,
archive, executable, etc)
- QtPublicSbomGenerationHelpers.cmake - for non-Qt specific
implementation of SPDX generation. This also has some code that was
taken from the cmake-sbom 3rd party project, so it is dual licensed
under the usual Qt build system BSD license, as well as the MIT
license of the 3rd party project
- QtPublicGitHelpers.cmake - for git related features, mainly to embed
queried hashes or tags into version strings, is dual-licensed for
the same reasons as QtPublicSbomGenerationHelpers.cmake
- QtSbomHelpers.cmake - Qt-specific functions that just forward
arguments to the public functions. These are meant to be used in our
Qt CMakeLists.txt instead of the public _qt_internal_add_sbom ones
for naming consistency. These function would mostly be used to
annotate 3rd party libraries with sbom info and to add sbom info
for unusual target setups (like the Bootstrap library), because most
of the handling is already done automatically via
qt_internal_add_module/plugin/etc.
The files are put into Public cmake files, with the future hope of
making this available to user projects in some capacity.
The distinction of Qt-specific and non-Qt specific code might blur a
bit, and thus the separation across files might not always be
consistent, but it was best effort.
The main purpose of the code is to collect various information about
targets and their relationships and generate equivalent SPDX info.
Collection is currently done for the following targets: Qt modules,
plugins, apps, tools, system libraries, bundled 3rd party libraries
and partial 3rd party sources compiled directly as part of Qt targets.
Each target has an equivalent SPDX package generated with information
like version, license, copyright, CPE (common vulnerability
identifier), files that belong to the package, and relationships on
other SPDX packages (associated cmake targets), mostly gathered from
direct linking dependencies.
Each package might also contain files, e.g. libQt6Core.so for the Core
target. Each file also has info like license id, copyrights, but also
the list of source files that were used to generate the file and a
sha1 checksum.
SPDX documents can also refer to packages in other SPDX documents, and
those are referred to via external document references. This is the
case when building qtdeclarative and we refer to Core.
For qt provided targets, we have complete information regarding
licenses, and copyrights.
For bundled 3rd party libraries, we should also have most information,
which is usually parsed from the
src/3rdparty/libfoo/qt_attribution.json files.
If there are multiple attribution files, or if the files have multiple
entries, we create a separate SBOM package for each of those entries,
because each might have a separate copyright or version, and an sbom
package can have only one version (although many copyrights).
For system libraries we usually lack the information because we don't
have attribution files for Find scripts. So the info needs to be
manually annotated via arguments to the sbom function calls, or the
FindFoo.cmake scripts expose that information in some form and we
can query it.
There are also corner cases like 3rdparty sources being directly
included in a Qt library, like the m4dc files for Gui, or PCRE2 for
Bootstrap.
Or QtWebEngine libraries (either Qt bundled or Chromium bundled or
system libraries) which get linked in by GN instead of CMake, so there
are no direct targets for them.
The information for these need to be annotated manually as well.
There is also a distinction to be made for static Qt builds (or any
static Qt library in a shared build), where the system libraries found
during the Qt build might not be the same that are linked into the
final user application or library.
The actual generation of the SBOM is done by file(GENERATE)-ing one
.cmake file for each target, file, external ref, etc, which will be
included in a top-level cmake script.
The top-level cmake script will run through each included file, to
append to a "staging" spdx file, which will then be used in a
configure_file() call to replace some final
variables, like embedding a file checksum.
There are install rules to generate a complete SBOM during
installation, and an optional 'sbom' custom target that allows
building an incomplete SBOM during the build step.
The build target is just for convenience and faster development
iteration time. It is incomplete because it is missing the installed
file SHA1 checksums and the document verification code (the sha1 of
all sha1s). We can't compute those during the build before the files
are actually installed.
A complete SBOM can only be achieved at installation time. The install
script will include all the generated helper files, but also set some
additional variables to ensure checksumming happens, and also handle
multi-config installation, among other small things.
For multi-config builds, CMake doesn't offer a way to run code after
all configs are installed, because they might not always be installed,
someone might choose to install just Release.
To handle that, we rely on ninja installing each config sequentially
(because ninja places the install rules into the 'console' pool which
runs one task at a time).
For each installed config we create a config-specific marker file.
Once all marker files are present, whichever config ends up being
installed as the last one, we run the sbom generation once, and then
delete all marker files.
There are a few internal variables that can be set during
configuration to enable various checks (and other features) on the
generated spdx files:
- QT_INTERNAL_SBOM_VERIFY
- QT_INTERNAL_SBOM_AUDIT
- QT_INTERNAL_SBOM_AUDIT_NO_ERROR
- QT_INTERNAL_SBOM_GENERATE_JSON
- QT_INTERNAL_SBOM_SHOW_TABLE
- QT_INTERNAL_SBOM_DEFAULT_CHECKS
These use 3rd party python tools, so they are not enabled by default.
If enabled, they run at installation time after the sbom is installed.
We will hopefully enable them in CI.
Overall, the code is still a bit messy in a few places, due to time
constraints, but can be improved later.
Some possible TODOs for the future:
- Do we need to handle 3rd party libs linked into a Qt static library
in a Qt shared build, where the Qt static lib is not installed, but
linked into a Qt shared library, somehow specially?
We can record a package for it, but we can't
create a spdx file record for it (and associated source
relationships) because we don't install the file, and spdx requires
the file to be installed and checksummed. Perhaps we can consider
adding some free-form text snippet to the package itself?
- Do we want to add parsing of .cpp source files for Copyrights, to
embed them into the packages? This will likely slow down
configuration quite a bit.
- Currently sbom info attached to WrapFoo packages in one repo is
not exported / available in other repos. E.g. If we annotate
WrapZLIB in qtbase with CPE_VENDOR zlib, this info will not be
available when looking up WrapZLIB in qtimageformats.
This is because they are IMPORTED libraries, and are not
exported. We might want to record this info in the future.
[ChangeLog][Build System] A new -sbom configure option can be used
to generate and install a SPDX SBOM (Software Bill of Materials) file
for each built Qt repository.
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I9c730a6bbc47e02ce1836fccf00a14ec8eb1a5f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-03-07 18:02:56 +01:00
|
|
|
${__qt_internal_sbom_single_args}
|
2021-05-18 17:00:01 +10:00
|
|
|
)
|
|
|
|
set(${multi_args}
|
|
|
|
QMAKE_MODULE_CONFIG
|
|
|
|
EXTRA_CMAKE_FILES
|
|
|
|
EXTRA_CMAKE_INCLUDES
|
2021-12-14 09:54:33 +01:00
|
|
|
EXTERNAL_HEADERS
|
2022-12-06 21:07:38 +01:00
|
|
|
POLICIES
|
2021-05-18 17:00:01 +10:00
|
|
|
${__default_private_args}
|
|
|
|
${__default_public_args}
|
|
|
|
${__default_private_module_args}
|
CMake: Generate an SPDX v2.3 SBOM file for each built repository
This change adds a new -sbom configure option to allow generating and
installing an SPDX v2.3 SBOM file when building a qt repo.
The -sbom-dir option can be used to configure the location where
each repo sbom file will be installed.
By default it is installed into
$prefix/$archdatadir/sbom/$sbom_lower_project_name.sdpx
which is basically ~/Qt/sbom/qtbase-6.8.0.spdx
The file is installed as part of the default installation rules, but
it can also be installed manually using the "sbom" installation
component, or "sbom_$lower_project_name" in a top-level build. For
example: cmake install . --component sbom_qtbase
CMake 3.19+ is needed to read the qt_attribution.json files for
copyrights, license info, etc. When using an older cmake version,
configuration will error out. It is possible to opt into using an
older cmake version, but the generated sbom will lack all the
attribution file information.
Using an older cmake version is untested and not officially supported.
Implementation notes.
The bulk of the implementation is split into 4 new files:
- QtPublicSbomHelpers.cmake - for Qt-specific collecting, processing
and dispatching the generation of various pieces of the SBOM document
e.g. a SDPX package associated with a target like Core, a SDPX
file entry for each target binary file (per-config shared library,
archive, executable, etc)
- QtPublicSbomGenerationHelpers.cmake - for non-Qt specific
implementation of SPDX generation. This also has some code that was
taken from the cmake-sbom 3rd party project, so it is dual licensed
under the usual Qt build system BSD license, as well as the MIT
license of the 3rd party project
- QtPublicGitHelpers.cmake - for git related features, mainly to embed
queried hashes or tags into version strings, is dual-licensed for
the same reasons as QtPublicSbomGenerationHelpers.cmake
- QtSbomHelpers.cmake - Qt-specific functions that just forward
arguments to the public functions. These are meant to be used in our
Qt CMakeLists.txt instead of the public _qt_internal_add_sbom ones
for naming consistency. These function would mostly be used to
annotate 3rd party libraries with sbom info and to add sbom info
for unusual target setups (like the Bootstrap library), because most
of the handling is already done automatically via
qt_internal_add_module/plugin/etc.
The files are put into Public cmake files, with the future hope of
making this available to user projects in some capacity.
The distinction of Qt-specific and non-Qt specific code might blur a
bit, and thus the separation across files might not always be
consistent, but it was best effort.
The main purpose of the code is to collect various information about
targets and their relationships and generate equivalent SPDX info.
Collection is currently done for the following targets: Qt modules,
plugins, apps, tools, system libraries, bundled 3rd party libraries
and partial 3rd party sources compiled directly as part of Qt targets.
Each target has an equivalent SPDX package generated with information
like version, license, copyright, CPE (common vulnerability
identifier), files that belong to the package, and relationships on
other SPDX packages (associated cmake targets), mostly gathered from
direct linking dependencies.
Each package might also contain files, e.g. libQt6Core.so for the Core
target. Each file also has info like license id, copyrights, but also
the list of source files that were used to generate the file and a
sha1 checksum.
SPDX documents can also refer to packages in other SPDX documents, and
those are referred to via external document references. This is the
case when building qtdeclarative and we refer to Core.
For qt provided targets, we have complete information regarding
licenses, and copyrights.
For bundled 3rd party libraries, we should also have most information,
which is usually parsed from the
src/3rdparty/libfoo/qt_attribution.json files.
If there are multiple attribution files, or if the files have multiple
entries, we create a separate SBOM package for each of those entries,
because each might have a separate copyright or version, and an sbom
package can have only one version (although many copyrights).
For system libraries we usually lack the information because we don't
have attribution files for Find scripts. So the info needs to be
manually annotated via arguments to the sbom function calls, or the
FindFoo.cmake scripts expose that information in some form and we
can query it.
There are also corner cases like 3rdparty sources being directly
included in a Qt library, like the m4dc files for Gui, or PCRE2 for
Bootstrap.
Or QtWebEngine libraries (either Qt bundled or Chromium bundled or
system libraries) which get linked in by GN instead of CMake, so there
are no direct targets for them.
The information for these need to be annotated manually as well.
There is also a distinction to be made for static Qt builds (or any
static Qt library in a shared build), where the system libraries found
during the Qt build might not be the same that are linked into the
final user application or library.
The actual generation of the SBOM is done by file(GENERATE)-ing one
.cmake file for each target, file, external ref, etc, which will be
included in a top-level cmake script.
The top-level cmake script will run through each included file, to
append to a "staging" spdx file, which will then be used in a
configure_file() call to replace some final
variables, like embedding a file checksum.
There are install rules to generate a complete SBOM during
installation, and an optional 'sbom' custom target that allows
building an incomplete SBOM during the build step.
The build target is just for convenience and faster development
iteration time. It is incomplete because it is missing the installed
file SHA1 checksums and the document verification code (the sha1 of
all sha1s). We can't compute those during the build before the files
are actually installed.
A complete SBOM can only be achieved at installation time. The install
script will include all the generated helper files, but also set some
additional variables to ensure checksumming happens, and also handle
multi-config installation, among other small things.
For multi-config builds, CMake doesn't offer a way to run code after
all configs are installed, because they might not always be installed,
someone might choose to install just Release.
To handle that, we rely on ninja installing each config sequentially
(because ninja places the install rules into the 'console' pool which
runs one task at a time).
For each installed config we create a config-specific marker file.
Once all marker files are present, whichever config ends up being
installed as the last one, we run the sbom generation once, and then
delete all marker files.
There are a few internal variables that can be set during
configuration to enable various checks (and other features) on the
generated spdx files:
- QT_INTERNAL_SBOM_VERIFY
- QT_INTERNAL_SBOM_AUDIT
- QT_INTERNAL_SBOM_AUDIT_NO_ERROR
- QT_INTERNAL_SBOM_GENERATE_JSON
- QT_INTERNAL_SBOM_SHOW_TABLE
- QT_INTERNAL_SBOM_DEFAULT_CHECKS
These use 3rd party python tools, so they are not enabled by default.
If enabled, they run at installation time after the sbom is installed.
We will hopefully enable them in CI.
Overall, the code is still a bit messy in a few places, due to time
constraints, but can be improved later.
Some possible TODOs for the future:
- Do we need to handle 3rd party libs linked into a Qt static library
in a Qt shared build, where the Qt static lib is not installed, but
linked into a Qt shared library, somehow specially?
We can record a package for it, but we can't
create a spdx file record for it (and associated source
relationships) because we don't install the file, and spdx requires
the file to be installed and checksummed. Perhaps we can consider
adding some free-form text snippet to the package itself?
- Do we want to add parsing of .cpp source files for Copyrights, to
embed them into the packages? This will likely slow down
configuration quite a bit.
- Currently sbom info attached to WrapFoo packages in one repo is
not exported / available in other repos. E.g. If we annotate
WrapZLIB in qtbase with CPE_VENDOR zlib, this info will not be
available when looking up WrapZLIB in qtimageformats.
This is because they are IMPORTED libraries, and are not
exported. We might want to record this info in the future.
[ChangeLog][Build System] A new -sbom configure option can be used
to generate and install a SPDX SBOM (Software Bill of Materials) file
for each built Qt repository.
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I9c730a6bbc47e02ce1836fccf00a14ec8eb1a5f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-03-07 18:02:56 +01:00
|
|
|
${__qt_internal_sbom_multi_args}
|
2021-05-18 17:00:01 +10:00
|
|
|
)
|
|
|
|
endmacro()
|
|
|
|
|
2022-08-12 19:53:14 +02:00
|
|
|
# The function helps to wrap module include paths with the header existence check.
|
|
|
|
function(qt_internal_append_include_directories_with_headers_check target list_to_append type)
|
|
|
|
string(TOLOWER "${type}" type)
|
|
|
|
string(JOIN "" has_headers_check
|
|
|
|
"$<BOOL:"
|
|
|
|
"$<TARGET_PROPERTY:"
|
|
|
|
"$<TARGET_NAME:${target}>,"
|
|
|
|
"_qt_module_has_${type}_headers"
|
|
|
|
">"
|
|
|
|
">"
|
|
|
|
)
|
|
|
|
foreach(directory IN LISTS ARGN)
|
|
|
|
list(APPEND ${list_to_append}
|
|
|
|
"$<${has_headers_check}:${directory}>")
|
|
|
|
endforeach()
|
|
|
|
set(${list_to_append} "${${list_to_append}}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
# This is the main entry function for creating a Qt module, that typically
|
|
|
|
# consists of a library, public header files, private header files and configurable
|
|
|
|
# features.
|
|
|
|
#
|
|
|
|
# A CMake target with the specified target parameter is created. If the current source
|
|
|
|
# directory has a configure.cmake file, then that is also processed for feature definition
|
|
|
|
# and testing. Any features defined as well as any features coming from dependencies to
|
|
|
|
# this module are imported into the scope of the calling feature.
|
|
|
|
#
|
|
|
|
# Target is without leading "Qt". So e.g. the "QtCore" module has the target "Core".
|
2021-01-15 15:48:59 +01:00
|
|
|
#
|
|
|
|
# Options:
|
|
|
|
# NO_ADDITIONAL_TARGET_INFO
|
|
|
|
# Don't generate a Qt6*AdditionalTargetInfo.cmake file.
|
|
|
|
#
|
2021-04-06 18:57:11 +02:00
|
|
|
# MODULE_INTERFACE_NAME
|
|
|
|
# The custom name of the module interface. This name is used as a part of the include paths
|
|
|
|
# associated with the module and other interface names. The default value is the target name.
|
|
|
|
# If the INTERNAL_MODULE option is specified, MODULE_INTERFACE_NAME is not specified and the
|
|
|
|
# target name ends with the suffix 'Private', the MODULE_INTERFACE_NAME value defaults to the
|
|
|
|
# non-suffixed target name, e.g.:
|
|
|
|
# For the SomeInternalModulePrivate target, the MODULE_INTERFACE_NAME will be
|
|
|
|
# SomeInternalModule
|
|
|
|
#
|
2021-11-26 09:42:27 +01:00
|
|
|
# HEADER_MODULE
|
|
|
|
# Creates an interface library instead of following the Qt configuration default. Mutually
|
|
|
|
# exclusive with STATIC.
|
|
|
|
#
|
|
|
|
# STATIC
|
|
|
|
# Creates a static library instead of following the Qt configuration default. Mutually
|
|
|
|
# exclusive with HEADER_MODULE.
|
|
|
|
#
|
2021-12-14 09:54:33 +01:00
|
|
|
# EXTERNAL_HEADERS
|
|
|
|
# A explicit list of non qt headers (like 3rdparty) to be installed.
|
|
|
|
# Note this option overrides install headers used as PUBLIC_HEADER by cmake install(TARGET)
|
|
|
|
# otherwise set by syncqt.
|
|
|
|
#
|
|
|
|
# EXTERNAL_HEADERS_DIR
|
|
|
|
# A module directory with non qt headers (like 3rdparty) to be installed.
|
|
|
|
# Note this option overrides install headers used as PUBLIC_HEADER by cmake install(TARGET)
|
|
|
|
# otherwise set by syncqt.
|
2022-08-12 19:53:14 +02:00
|
|
|
#
|
|
|
|
# PRIVATE_HEADER_FILTERS
|
|
|
|
# The regular expressions that filter private header files out of target sources.
|
|
|
|
# The value must use the following format 'regex1|regex2|regex3'.
|
|
|
|
#
|
|
|
|
# QPA_HEADER_FILTERS
|
|
|
|
# The regular expressions that filter QPA header files out of target sources.
|
|
|
|
# The value must use the following format 'regex1|regex2|regex3'.
|
2022-08-15 18:29:41 +02:00
|
|
|
#
|
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-04-27 13:16:29 +02:00
|
|
|
# RHI_HEADER_FILTERS
|
|
|
|
# The regular expressions that filter RHI header files out of target sources.
|
|
|
|
# The value must use the following format 'regex1|regex2|regex3'.
|
|
|
|
#
|
2023-08-04 16:57:42 +02:00
|
|
|
# SSG_HEADER_FILTERS
|
|
|
|
# The regular expressions that filter ssg header files out of target sources.
|
|
|
|
# The value must use the following format 'regex1|regex2|regex3'.
|
|
|
|
#
|
2022-08-15 18:29:41 +02:00
|
|
|
# HEADER_SYNC_SOURCE_DIRECTORY
|
|
|
|
# The source directory for header sync procedure. Header files outside this directory will be
|
|
|
|
# ignored by syncqt. The specifying this directory allows to skip the parsing of the whole
|
|
|
|
# CMAKE_CURRENT_SOURCE_DIR for the header files that needs to be synced and only parse the
|
|
|
|
# single subdirectory, that meanwhile can be outside the CMAKE_CURRENT_SOURCE_DIR tree.
|
2025-01-27 10:02:23 +01:00
|
|
|
#
|
|
|
|
# FIND_PRIVATE_MODULE
|
|
|
|
# A call to find_package(Qt6Foo) will imply a call to find_package(Qt6FooPrivate).
|
2020-09-22 10:02:27 +02:00
|
|
|
function(qt_internal_add_module target)
|
2021-05-18 17:00:01 +10:00
|
|
|
qt_internal_get_internal_add_module_keywords(
|
2021-07-30 17:51:07 +02:00
|
|
|
module_option_args
|
|
|
|
module_single_args
|
|
|
|
module_multi_args
|
|
|
|
)
|
|
|
|
|
2023-01-11 15:36:18 +01:00
|
|
|
cmake_parse_arguments(PARSE_ARGV 1 arg
|
2021-09-10 17:24:43 +02:00
|
|
|
"${module_option_args}"
|
|
|
|
"${module_single_args}"
|
|
|
|
"${module_multi_args}"
|
2021-05-18 17:00:01 +10:00
|
|
|
)
|
2023-01-11 15:36:18 +01:00
|
|
|
_qt_internal_validate_all_args_are_parsed(arg)
|
2020-08-13 17:37:47 +02:00
|
|
|
|
2022-07-19 13:20:06 +02:00
|
|
|
set(is_internal_module FALSE)
|
2021-04-06 18:57:11 +02:00
|
|
|
if(arg_INTERNAL_MODULE)
|
2022-07-19 13:20:06 +02:00
|
|
|
set(is_internal_module TRUE)
|
2021-04-06 18:57:11 +02:00
|
|
|
set(arg_INTERNAL_MODULE "INTERNAL_MODULE")
|
|
|
|
set(arg_NO_PRIVATE_MODULE TRUE)
|
|
|
|
# Assume the interface name of the internal module should be the module name without the
|
|
|
|
# 'Private' suffix.
|
|
|
|
if(NOT arg_MODULE_INTERFACE_NAME)
|
|
|
|
if(target MATCHES "(.*)Private$")
|
|
|
|
set(arg_MODULE_INTERFACE_NAME "${CMAKE_MATCH_1}")
|
|
|
|
else()
|
|
|
|
message(WARNING "The internal module target should end with the 'Private' suffix.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
unset(arg_INTERNAL_MODULE)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
2021-04-06 18:57:11 +02:00
|
|
|
if(NOT arg_MODULE_INTERFACE_NAME)
|
|
|
|
set(arg_MODULE_INTERFACE_NAME "${target}")
|
|
|
|
endif()
|
2020-10-30 13:29:55 +01:00
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
### Define Targets:
|
2021-05-19 12:35:18 +02:00
|
|
|
if(arg_HEADER_MODULE)
|
|
|
|
set(type_to_create INTERFACE)
|
|
|
|
elseif(arg_STATIC)
|
|
|
|
set(type_to_create STATIC)
|
|
|
|
else()
|
|
|
|
# Use default depending on Qt configuration.
|
|
|
|
set(type_to_create "")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
_qt_internal_add_library("${target}" ${type_to_create})
|
2021-07-15 13:04:15 +02:00
|
|
|
qt_internal_mark_as_internal_library("${target}")
|
2021-05-19 12:35:18 +02:00
|
|
|
|
|
|
|
get_target_property(target_type ${target} TYPE)
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
set(is_interface_lib 0)
|
|
|
|
set(is_shared_lib 0)
|
2020-11-30 19:28:00 +01:00
|
|
|
set(is_static_lib 0)
|
2021-05-19 12:35:18 +02:00
|
|
|
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
2020-08-13 17:37:47 +02:00
|
|
|
set(is_interface_lib 1)
|
2021-05-19 12:35:18 +02:00
|
|
|
elseif(target_type STREQUAL "STATIC_LIBRARY")
|
2020-11-30 19:28:00 +01:00
|
|
|
set(is_static_lib 1)
|
2021-05-19 12:35:18 +02:00
|
|
|
elseif(target_type STREQUAL "SHARED_LIBRARY")
|
2020-08-13 17:37:47 +02:00
|
|
|
set(is_shared_lib 1)
|
|
|
|
else()
|
2021-05-19 12:35:18 +02:00
|
|
|
message(FATAL_ERROR "Invalid target type '${target_type}' for Qt module '${target}'")
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
2021-07-30 13:16:10 +02:00
|
|
|
if(NOT arg_NO_SYNC_QT AND NOT arg_NO_MODULE_HEADERS AND arg_MODULE_INCLUDE_NAME)
|
|
|
|
# qt_internal_module_info uses this property if it's set, so it must be
|
|
|
|
# specified before the qt_internal_module_info call.
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
_qt_module_include_name ${arg_MODULE_INCLUDE_NAME}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-04-06 18:57:11 +02:00
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
_qt_module_interface_name "${arg_MODULE_INTERFACE_NAME}"
|
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 5ffc744b791a114a3180a425dd26e298f7399955
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-05-17 08:44:43 +02:00
|
|
|
_qt_package_version "${PROJECT_VERSION}"
|
2022-07-19 13:20:06 +02:00
|
|
|
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}"
|
2021-04-06 18:57:11 +02:00
|
|
|
)
|
2022-07-19 13:20:06 +02:00
|
|
|
set(export_properties
|
|
|
|
"_qt_module_interface_name"
|
|
|
|
"_qt_package_version"
|
|
|
|
"_qt_package_name"
|
|
|
|
)
|
2025-05-21 16:28:02 +02:00
|
|
|
|
|
|
|
if(CMAKE_VERSION VERSION_LESS 3.30)
|
|
|
|
# For the CMake versions higher than 3.30 the corresponding INTERFACE_
|
|
|
|
# properties will be in Qt<Module>Targets.cmake without extra code
|
|
|
|
# needed.
|
|
|
|
list(APPEND export_properties
|
|
|
|
"_qt_transitive_compile_properties"
|
|
|
|
"_qt_transitive_link_properties"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-07-19 13:20:06 +02:00
|
|
|
if(NOT is_internal_module)
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
_qt_is_public_module TRUE
|
|
|
|
)
|
|
|
|
list(APPEND export_properties
|
|
|
|
"_qt_is_public_module"
|
|
|
|
)
|
|
|
|
if(NOT ${arg_NO_PRIVATE_MODULE})
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
_qt_private_module_target_name "${target}Private"
|
|
|
|
)
|
|
|
|
list(APPEND export_properties
|
|
|
|
"_qt_private_module_target_name"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES "${export_properties}")
|
2021-04-06 18:57:11 +02:00
|
|
|
|
|
|
|
qt_internal_module_info(module "${target}")
|
|
|
|
qt_internal_add_qt_repo_known_module("${target}")
|
2021-08-24 13:30:51 +02:00
|
|
|
if(arg_INTERNAL_MODULE)
|
|
|
|
set_target_properties(${target} PROPERTIES _qt_is_internal_module TRUE)
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES _qt_is_internal_module)
|
|
|
|
endif()
|
CMake: Generate an SPDX v2.3 SBOM file for each built repository
This change adds a new -sbom configure option to allow generating and
installing an SPDX v2.3 SBOM file when building a qt repo.
The -sbom-dir option can be used to configure the location where
each repo sbom file will be installed.
By default it is installed into
$prefix/$archdatadir/sbom/$sbom_lower_project_name.sdpx
which is basically ~/Qt/sbom/qtbase-6.8.0.spdx
The file is installed as part of the default installation rules, but
it can also be installed manually using the "sbom" installation
component, or "sbom_$lower_project_name" in a top-level build. For
example: cmake install . --component sbom_qtbase
CMake 3.19+ is needed to read the qt_attribution.json files for
copyrights, license info, etc. When using an older cmake version,
configuration will error out. It is possible to opt into using an
older cmake version, but the generated sbom will lack all the
attribution file information.
Using an older cmake version is untested and not officially supported.
Implementation notes.
The bulk of the implementation is split into 4 new files:
- QtPublicSbomHelpers.cmake - for Qt-specific collecting, processing
and dispatching the generation of various pieces of the SBOM document
e.g. a SDPX package associated with a target like Core, a SDPX
file entry for each target binary file (per-config shared library,
archive, executable, etc)
- QtPublicSbomGenerationHelpers.cmake - for non-Qt specific
implementation of SPDX generation. This also has some code that was
taken from the cmake-sbom 3rd party project, so it is dual licensed
under the usual Qt build system BSD license, as well as the MIT
license of the 3rd party project
- QtPublicGitHelpers.cmake - for git related features, mainly to embed
queried hashes or tags into version strings, is dual-licensed for
the same reasons as QtPublicSbomGenerationHelpers.cmake
- QtSbomHelpers.cmake - Qt-specific functions that just forward
arguments to the public functions. These are meant to be used in our
Qt CMakeLists.txt instead of the public _qt_internal_add_sbom ones
for naming consistency. These function would mostly be used to
annotate 3rd party libraries with sbom info and to add sbom info
for unusual target setups (like the Bootstrap library), because most
of the handling is already done automatically via
qt_internal_add_module/plugin/etc.
The files are put into Public cmake files, with the future hope of
making this available to user projects in some capacity.
The distinction of Qt-specific and non-Qt specific code might blur a
bit, and thus the separation across files might not always be
consistent, but it was best effort.
The main purpose of the code is to collect various information about
targets and their relationships and generate equivalent SPDX info.
Collection is currently done for the following targets: Qt modules,
plugins, apps, tools, system libraries, bundled 3rd party libraries
and partial 3rd party sources compiled directly as part of Qt targets.
Each target has an equivalent SPDX package generated with information
like version, license, copyright, CPE (common vulnerability
identifier), files that belong to the package, and relationships on
other SPDX packages (associated cmake targets), mostly gathered from
direct linking dependencies.
Each package might also contain files, e.g. libQt6Core.so for the Core
target. Each file also has info like license id, copyrights, but also
the list of source files that were used to generate the file and a
sha1 checksum.
SPDX documents can also refer to packages in other SPDX documents, and
those are referred to via external document references. This is the
case when building qtdeclarative and we refer to Core.
For qt provided targets, we have complete information regarding
licenses, and copyrights.
For bundled 3rd party libraries, we should also have most information,
which is usually parsed from the
src/3rdparty/libfoo/qt_attribution.json files.
If there are multiple attribution files, or if the files have multiple
entries, we create a separate SBOM package for each of those entries,
because each might have a separate copyright or version, and an sbom
package can have only one version (although many copyrights).
For system libraries we usually lack the information because we don't
have attribution files for Find scripts. So the info needs to be
manually annotated via arguments to the sbom function calls, or the
FindFoo.cmake scripts expose that information in some form and we
can query it.
There are also corner cases like 3rdparty sources being directly
included in a Qt library, like the m4dc files for Gui, or PCRE2 for
Bootstrap.
Or QtWebEngine libraries (either Qt bundled or Chromium bundled or
system libraries) which get linked in by GN instead of CMake, so there
are no direct targets for them.
The information for these need to be annotated manually as well.
There is also a distinction to be made for static Qt builds (or any
static Qt library in a shared build), where the system libraries found
during the Qt build might not be the same that are linked into the
final user application or library.
The actual generation of the SBOM is done by file(GENERATE)-ing one
.cmake file for each target, file, external ref, etc, which will be
included in a top-level cmake script.
The top-level cmake script will run through each included file, to
append to a "staging" spdx file, which will then be used in a
configure_file() call to replace some final
variables, like embedding a file checksum.
There are install rules to generate a complete SBOM during
installation, and an optional 'sbom' custom target that allows
building an incomplete SBOM during the build step.
The build target is just for convenience and faster development
iteration time. It is incomplete because it is missing the installed
file SHA1 checksums and the document verification code (the sha1 of
all sha1s). We can't compute those during the build before the files
are actually installed.
A complete SBOM can only be achieved at installation time. The install
script will include all the generated helper files, but also set some
additional variables to ensure checksumming happens, and also handle
multi-config installation, among other small things.
For multi-config builds, CMake doesn't offer a way to run code after
all configs are installed, because they might not always be installed,
someone might choose to install just Release.
To handle that, we rely on ninja installing each config sequentially
(because ninja places the install rules into the 'console' pool which
runs one task at a time).
For each installed config we create a config-specific marker file.
Once all marker files are present, whichever config ends up being
installed as the last one, we run the sbom generation once, and then
delete all marker files.
There are a few internal variables that can be set during
configuration to enable various checks (and other features) on the
generated spdx files:
- QT_INTERNAL_SBOM_VERIFY
- QT_INTERNAL_SBOM_AUDIT
- QT_INTERNAL_SBOM_AUDIT_NO_ERROR
- QT_INTERNAL_SBOM_GENERATE_JSON
- QT_INTERNAL_SBOM_SHOW_TABLE
- QT_INTERNAL_SBOM_DEFAULT_CHECKS
These use 3rd party python tools, so they are not enabled by default.
If enabled, they run at installation time after the sbom is installed.
We will hopefully enable them in CI.
Overall, the code is still a bit messy in a few places, due to time
constraints, but can be improved later.
Some possible TODOs for the future:
- Do we need to handle 3rd party libs linked into a Qt static library
in a Qt shared build, where the Qt static lib is not installed, but
linked into a Qt shared library, somehow specially?
We can record a package for it, but we can't
create a spdx file record for it (and associated source
relationships) because we don't install the file, and spdx requires
the file to be installed and checksummed. Perhaps we can consider
adding some free-form text snippet to the package itself?
- Do we want to add parsing of .cpp source files for Copyrights, to
embed them into the packages? This will likely slow down
configuration quite a bit.
- Currently sbom info attached to WrapFoo packages in one repo is
not exported / available in other repos. E.g. If we annotate
WrapZLIB in qtbase with CPE_VENDOR zlib, this info will not be
available when looking up WrapZLIB in qtimageformats.
This is because they are IMPORTED libraries, and are not
exported. We might want to record this info in the future.
[ChangeLog][Build System] A new -sbom configure option can be used
to generate and install a SPDX SBOM (Software Bill of Materials) file
for each built Qt repository.
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I9c730a6bbc47e02ce1836fccf00a14ec8eb1a5f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-03-07 18:02:56 +01:00
|
|
|
if(arg_HEADER_MODULE)
|
|
|
|
set_target_properties(${target} PROPERTIES _qt_is_header_module TRUE)
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES _qt_is_header_module)
|
|
|
|
endif()
|
2021-04-06 18:57:11 +02:00
|
|
|
|
|
|
|
if(NOT arg_CONFIG_MODULE_NAME)
|
|
|
|
set(arg_CONFIG_MODULE_NAME "${module_lower}")
|
|
|
|
endif()
|
|
|
|
|
2021-06-18 20:13:32 +02:00
|
|
|
set(module_config_header "qt${arg_CONFIG_MODULE_NAME}-config.h")
|
|
|
|
set(module_config_private_header "qt${arg_CONFIG_MODULE_NAME}-config_p.h")
|
2022-08-12 19:53:14 +02:00
|
|
|
# qt<module>-config.h/-config_p.h header files are not marked as GENERATED automatically
|
|
|
|
# for old CMake versions. Set the property explicitly here.
|
2025-01-06 19:08:39 +01:00
|
|
|
_qt_internal_set_source_file_generated(
|
|
|
|
SOURCES "${module_config_header}" "${module_config_private_header}"
|
|
|
|
SKIP_AUTOGEN
|
2022-08-12 19:53:14 +02:00
|
|
|
)
|
2021-06-18 20:13:32 +02:00
|
|
|
|
2021-04-06 18:57:11 +02:00
|
|
|
# Module define needs to take into account the config module name.
|
|
|
|
string(TOUPPER "${arg_CONFIG_MODULE_NAME}" module_define_infix)
|
|
|
|
string(REPLACE "-" "_" module_define_infix "${module_define_infix}")
|
|
|
|
string(REPLACE "." "_" module_define_infix "${module_define_infix}")
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
set(property_prefix "INTERFACE_")
|
|
|
|
if(NOT arg_HEADER_MODULE)
|
|
|
|
set(property_prefix "")
|
|
|
|
endif()
|
|
|
|
|
2021-06-17 13:04:59 +02:00
|
|
|
if(arg_INTERNAL_MODULE)
|
|
|
|
string(APPEND arg_CONFIG_MODULE_NAME "_private")
|
|
|
|
endif()
|
2020-08-13 17:37:47 +02:00
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
_qt_config_module_name "${arg_CONFIG_MODULE_NAME}"
|
|
|
|
${property_prefix}QT_QMAKE_MODULE_CONFIG "${arg_QMAKE_MODULE_CONFIG}")
|
|
|
|
set_property(TARGET "${target}" APPEND PROPERTY EXPORT_PROPERTIES _qt_config_module_name)
|
|
|
|
|
|
|
|
set(is_framework 0)
|
|
|
|
if(QT_FEATURE_framework AND NOT ${arg_HEADER_MODULE} AND NOT ${arg_STATIC})
|
|
|
|
set(is_framework 1)
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
FRAMEWORK TRUE
|
2020-07-22 15:44:43 +02:00
|
|
|
FRAMEWORK_VERSION "A" # Not based on Qt major version
|
2021-06-01 11:25:41 +02:00
|
|
|
MACOSX_FRAMEWORK_IDENTIFIER org.qt-project.${module}
|
2020-08-13 17:37:47 +02:00
|
|
|
MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
|
|
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
|
|
)
|
2021-06-01 11:25:41 +02:00
|
|
|
qt_internal_get_framework_info(fw ${target})
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
2022-07-15 16:32:11 -07:00
|
|
|
if(NOT QT_FEATURE_no_direct_extern_access AND QT_FEATURE_reduce_relocations AND
|
2012-01-23 11:46:58 -02:00
|
|
|
UNIX AND NOT is_interface_lib)
|
2020-08-13 17:37:47 +02:00
|
|
|
# On x86 and x86-64 systems with ELF binaries (especially Linux), due to
|
|
|
|
# a new optimization in GCC 5.x in combination with a recent version of
|
|
|
|
# GNU binutils, compiling Qt applications with -fPIE is no longer
|
|
|
|
# enough.
|
|
|
|
# Applications now need to be compiled with the -fPIC option if the Qt option
|
|
|
|
# \"reduce relocations\" is active.
|
|
|
|
target_compile_options(${target} INTERFACE -fPIC)
|
|
|
|
if(GCC AND is_shared_lib)
|
|
|
|
target_link_options(${target} PRIVATE LINKER:-Bsymbolic-functions)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-10-13 09:06:55 -07:00
|
|
|
if((FEATURE_ltcg OR CMAKE_INTERPROCEDURAL_OPTIMIZATION) AND GCC AND is_static_lib)
|
2021-01-13 09:19:32 +01:00
|
|
|
# CMake <= 3.19 appends -fno-fat-lto-objects for all library types if
|
|
|
|
# CMAKE_INTERPROCEDURAL_OPTIMIZATION is enabled. Static libraries need
|
|
|
|
# the opposite compiler option.
|
|
|
|
# (https://gitlab.kitware.com/cmake/cmake/-/issues/21696)
|
|
|
|
target_compile_options(${target} PRIVATE -ffat-lto-objects)
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
qt_internal_add_target_aliases("${target}")
|
2024-09-10 16:33:57 +02:00
|
|
|
|
|
|
|
qt_internal_default_warnings_are_errors("${target}")
|
2020-08-13 17:37:47 +02:00
|
|
|
|
2021-04-06 18:57:11 +02:00
|
|
|
# No need to compile Q_IMPORT_PLUGIN-containing files for non-executables.
|
|
|
|
if(is_static_lib)
|
|
|
|
_qt_internal_disable_static_default_plugins("${target}")
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
# Add _private target to link against the private headers:
|
2021-04-06 18:57:11 +02:00
|
|
|
set(target_private "${target}Private")
|
2020-08-13 17:37:47 +02:00
|
|
|
if(NOT ${arg_NO_PRIVATE_MODULE})
|
|
|
|
add_library("${target_private}" INTERFACE)
|
|
|
|
qt_internal_add_target_aliases("${target_private}")
|
|
|
|
set_target_properties(${target_private} PROPERTIES
|
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 5ffc744b791a114a3180a425dd26e298f7399955
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-05-17 08:44:43 +02:00
|
|
|
_qt_config_module_name ${arg_CONFIG_MODULE_NAME}_private
|
|
|
|
_qt_package_version "${PROJECT_VERSION}"
|
2025-01-03 17:19:22 +01:00
|
|
|
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}Private"
|
2022-07-19 13:20:06 +02:00
|
|
|
_qt_is_private_module TRUE
|
|
|
|
_qt_public_module_target_name "${target}"
|
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 5ffc744b791a114a3180a425dd26e298f7399955
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-05-17 08:44:43 +02:00
|
|
|
)
|
2022-07-19 13:20:06 +02:00
|
|
|
set(export_properties
|
|
|
|
"_qt_config_module_name"
|
|
|
|
"_qt_package_version"
|
|
|
|
"_qt_package_name"
|
|
|
|
"_qt_is_private_module"
|
|
|
|
"_qt_public_module_target_name"
|
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 5ffc744b791a114a3180a425dd26e298f7399955
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-05-17 08:44:43 +02:00
|
|
|
)
|
2022-07-19 13:20:06 +02:00
|
|
|
set_property(TARGET "${target_private}" APPEND PROPERTY
|
|
|
|
EXPORT_PROPERTIES "${export_properties}")
|
2025-01-06 11:15:12 +01:00
|
|
|
|
|
|
|
# Let find_package(Qt6FooPrivate) also find_package(Qt6Foo).
|
2025-01-07 17:51:30 +01:00
|
|
|
qt_internal_register_target_dependencies("${target_private}" PUBLIC "Qt::${target}")
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
2022-12-16 16:34:31 +01:00
|
|
|
# FIXME: This workaround is needed because the deployment logic
|
|
|
|
# for iOS and WASM just copies/embeds the directly linked library,
|
|
|
|
# which will just be a versioned symlink to the actual library.
|
|
|
|
if((UIKIT OR WASM) AND BUILD_SHARED_LIBS)
|
2022-11-08 10:59:02 +01:00
|
|
|
set(version_args "")
|
|
|
|
else()
|
|
|
|
set(version_args
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${PROJECT_VERSION_MAJOR})
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
if(NOT arg_HEADER_MODULE)
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}"
|
2022-11-08 10:59:02 +01:00
|
|
|
${version_args}
|
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
qt_set_target_info_properties(${target} ${ARGN})
|
|
|
|
qt_handle_multi_config_output_dirs("${target}")
|
|
|
|
|
2024-10-25 14:30:02 +02:00
|
|
|
if(NOT BUILD_SHARED_LIBS AND (LINUX OR VXWORKS))
|
2020-08-13 17:37:47 +02:00
|
|
|
# Horrible workaround for static build failures due to incorrect static library link
|
|
|
|
# order. By increasing the multiplicity to 3, each library cycle will be repeated
|
|
|
|
# 3 times on the link line, reducing the probability of undefined symbols at
|
|
|
|
# link time.
|
|
|
|
# These failures are only observed on Linux with the ld linker (not sure about
|
|
|
|
# ld.gold).
|
|
|
|
# Allow opting out and modifying the value via cache value, in case if we urgently
|
|
|
|
# need to increase it without waiting for the qtbase change to propagate to
|
|
|
|
# other dependent repos.
|
|
|
|
# The proper fix will be to get rid of the cycles in the future.
|
|
|
|
# See QTBUG-83498 for details.
|
|
|
|
set(default_link_cycle_multiplicity "3")
|
|
|
|
if(DEFINED QT_LINK_CYCLE_MULTIPLICITY)
|
|
|
|
set(default_link_cycle_multiplicity "${QT_LINK_CYCLE_MULTIPLICITY}")
|
|
|
|
endif()
|
|
|
|
if(default_link_cycle_multiplicity)
|
|
|
|
set_property(TARGET "${target}"
|
|
|
|
PROPERTY
|
|
|
|
LINK_INTERFACE_MULTIPLICITY "${default_link_cycle_multiplicity}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (arg_SKIP_DEPENDS_INCLUDE)
|
2022-02-22 16:57:00 +01:00
|
|
|
set_target_properties(${target} PROPERTIES _qt_module_skip_depends_include TRUE)
|
|
|
|
set_property(TARGET "${target}" APPEND PROPERTY
|
|
|
|
EXPORT_PROPERTIES _qt_module_skip_depends_include)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
if(is_framework)
|
|
|
|
set_target_properties(${target} PROPERTIES
|
2021-06-01 11:25:41 +02:00
|
|
|
OUTPUT_NAME ${fw_name}
|
2020-08-13 17:37:47 +02:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
set_target_properties(${target} PROPERTIES
|
2021-07-09 12:32:11 +02:00
|
|
|
OUTPUT_NAME "${INSTALL_CMAKE_NAMESPACE}${module_interface_name}${QT_LIBINFIX}"
|
2020-08-13 17:37:47 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-04-30 23:38:02 +08:00
|
|
|
qt_set_common_target_properties(${target})
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
if (WIN32 AND BUILD_SHARED_LIBS)
|
2020-10-14 13:20:55 +02:00
|
|
|
_qt_internal_generate_win32_rc_file(${target})
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Module headers:
|
2020-11-17 22:01:09 +01:00
|
|
|
set_property(TARGET "${target}" APPEND PROPERTY EXPORT_PROPERTIES _qt_module_has_headers)
|
2020-08-13 17:37:47 +02:00
|
|
|
if(${arg_NO_MODULE_HEADERS} OR ${arg_NO_SYNC_QT})
|
2020-11-17 22:01:09 +01:00
|
|
|
set_target_properties("${target}" PROPERTIES
|
|
|
|
_qt_module_has_headers OFF)
|
2020-08-13 17:37:47 +02:00
|
|
|
else()
|
2021-07-30 13:16:10 +02:00
|
|
|
set_property(TARGET ${target} APPEND PROPERTY EXPORT_PROPERTIES _qt_module_include_name)
|
|
|
|
set_target_properties("${target}" PROPERTIES
|
2022-08-15 18:29:41 +02:00
|
|
|
_qt_module_include_name "${module_include_name}"
|
|
|
|
_qt_module_has_headers ON
|
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
|
2022-10-05 16:32:31 +02:00
|
|
|
set(sync_source_directory "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
if(arg_HEADER_SYNC_SOURCE_DIRECTORY)
|
|
|
|
set(sync_source_directory "${arg_HEADER_SYNC_SOURCE_DIRECTORY}")
|
2022-08-15 18:29:41 +02:00
|
|
|
endif()
|
2022-10-05 16:32:31 +02:00
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
_qt_sync_source_directory "${sync_source_directory}")
|
2021-09-16 19:15:05 +02:00
|
|
|
# We should not generate export headers if module is defined as pure STATIC.
|
|
|
|
# Static libraries don't need to export their symbols, and corner cases when sources are
|
|
|
|
# also used in shared libraries, should be handled manually.
|
2023-11-28 14:17:19 +01:00
|
|
|
if(NOT arg_NO_GENERATE_CPP_EXPORTS AND NOT arg_STATIC AND NOT arg_HEADER_MODULE)
|
2021-07-30 17:51:07 +02:00
|
|
|
if(arg_CPP_EXPORT_HEADER_BASE_NAME)
|
|
|
|
set(cpp_export_header_base_name
|
|
|
|
"CPP_EXPORT_HEADER_BASE_NAME;${arg_CPP_EXPORT_HEADER_BASE_NAME}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
qt_internal_generate_cpp_global_exports(${target} ${module_define_infix}
|
|
|
|
"${cpp_export_header_base_name}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-07-30 13:16:10 +02:00
|
|
|
set(module_depends_header
|
|
|
|
"${module_build_interface_include_dir}/${module_include_name}Depends")
|
2025-01-06 19:08:39 +01:00
|
|
|
_qt_internal_set_source_file_generated(SOURCES "${module_depends_header}")
|
2022-08-15 18:29:41 +02:00
|
|
|
set_target_properties(${target} PROPERTIES _qt_module_depends_header
|
|
|
|
"${module_depends_header}")
|
2024-06-12 11:46:55 +02:00
|
|
|
if(NOT arg_HEADER_MODULE)
|
2022-08-12 19:53:14 +02:00
|
|
|
set(module_header "${module_build_interface_include_dir}/${module_include_name}")
|
2021-07-30 13:16:10 +02:00
|
|
|
set_property(TARGET "${target}" PROPERTY MODULE_HEADER
|
2022-08-12 19:53:14 +02:00
|
|
|
"${module_header}")
|
2025-03-10 11:58:18 +01:00
|
|
|
|
|
|
|
if(QT_FEATURE_no_prefix)
|
|
|
|
file(RELATIVE_PATH relative_include_dir
|
|
|
|
"/${QT_CONFIG_INSTALL_DIR}/${module_include_name}"
|
|
|
|
"/${module_build_interface_include_dir}"
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
file(RELATIVE_PATH relative_include_dir
|
|
|
|
"/${QT_CONFIG_INSTALL_DIR}/${module_include_name}"
|
|
|
|
"/${module_install_interface_include_dir}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
set_property(TARGET "${target}" PROPERTY
|
|
|
|
_qt_module_relative_include_dir "${relative_include_dir}"
|
|
|
|
)
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY
|
|
|
|
EXPORT_PROPERTIES _qt_module_relative_include_dir
|
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
2022-08-12 19:53:14 +02:00
|
|
|
set(qpa_filter_regex "")
|
|
|
|
if(arg_QPA_HEADER_FILTERS)
|
|
|
|
set(qpa_filter_regex "${arg_QPA_HEADER_FILTERS}")
|
|
|
|
endif()
|
|
|
|
set_target_properties(${target}
|
|
|
|
PROPERTIES _qt_module_qpa_headers_filter_regex "${qpa_filter_regex}")
|
|
|
|
|
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-04-27 13:16:29 +02:00
|
|
|
set(rhi_filter_regex "")
|
|
|
|
if(arg_RHI_HEADER_FILTERS)
|
|
|
|
set(rhi_filter_regex "${arg_RHI_HEADER_FILTERS}")
|
|
|
|
endif()
|
|
|
|
set_target_properties(${target}
|
|
|
|
PROPERTIES _qt_module_rhi_headers_filter_regex "${rhi_filter_regex}")
|
|
|
|
|
2023-08-04 16:57:42 +02:00
|
|
|
set(ssg_filter_regex "")
|
|
|
|
if(arg_SSG_HEADER_FILTERS)
|
|
|
|
set(ssg_filter_regex "${arg_SSG_HEADER_FILTERS}")
|
|
|
|
endif()
|
|
|
|
set_target_properties(${target}
|
|
|
|
PROPERTIES _qt_module_ssg_headers_filter_regex "${ssg_filter_regex}")
|
|
|
|
|
2022-08-12 19:53:14 +02:00
|
|
|
set(private_filter_regex ".+_p(ch)?\\.h")
|
|
|
|
if(arg_PRIVATE_HEADER_FILTERS)
|
|
|
|
set(private_filter_regex "${private_filter_regex}|${arg_PRIVATE_HEADER_FILTERS}")
|
|
|
|
endif()
|
|
|
|
set_target_properties(${target}
|
|
|
|
PROPERTIES _qt_module_private_headers_filter_regex "${private_filter_regex}")
|
|
|
|
|
|
|
|
# If EXTERNAL_HEADERS_DIR is set we install the specified directory and keep the structure
|
|
|
|
# without taking into the account the CMake source tree and syncqt outputs.
|
|
|
|
if(arg_EXTERNAL_HEADERS_DIR)
|
2023-06-08 16:20:47 +02:00
|
|
|
set_property(TARGET ${target}
|
|
|
|
PROPERTY _qt_external_headers_dir "${arg_EXTERNAL_HEADERS_DIR}")
|
2022-08-12 19:53:14 +02:00
|
|
|
qt_install(DIRECTORY "${arg_EXTERNAL_HEADERS_DIR}/"
|
|
|
|
DESTINATION "${module_install_interface_include_dir}"
|
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-10-24 18:35:12 +02:00
|
|
|
if(arg_NO_HEADERSCLEAN_CHECK OR arg_NO_MODULE_HEADERS OR arg_NO_SYNC_QT
|
2024-04-09 14:36:38 +02:00
|
|
|
OR NOT INPUT_headersclean)
|
2022-10-24 18:35:12 +02:00
|
|
|
set_target_properties("${target}" PROPERTIES _qt_no_headersclean_check ON)
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
if(NOT arg_HEADER_MODULE)
|
|
|
|
# Plugin types associated to a module
|
|
|
|
if(NOT "x${arg_PLUGIN_TYPES}" STREQUAL "x")
|
2022-07-25 15:28:31 +02:00
|
|
|
qt_internal_add_plugin_types("${target}" "${arg_PLUGIN_TYPES}")
|
2024-10-30 18:18:05 +01:00
|
|
|
# Ensure that QT_PLUGIN_TARGETS is a known transitive compile property. Works with CMake
|
|
|
|
# versions >= 3.30.
|
|
|
|
_qt_internal_add_transitive_property(${target} COMPILE QT_PLUGIN_TARGETS)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT arg_HEADER_MODULE)
|
|
|
|
qt_autogen_tools_initial_setup(${target})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(private_includes
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
|
|
|
${arg_INCLUDE_DIRECTORIES}
|
|
|
|
)
|
|
|
|
|
|
|
|
set(public_includes "")
|
|
|
|
set(public_headers_list "public_includes")
|
|
|
|
if(is_framework)
|
|
|
|
set(public_headers_list "private_includes")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Make sure the BUILD_INTERFACE include paths come before the framework headers, so that the
|
|
|
|
# the compiler prefers the build dir includes.
|
|
|
|
#
|
|
|
|
# Make sure to add non-framework "build_dir/include" as an include path for moc to find the
|
|
|
|
# currently built module headers. qmake does this too.
|
|
|
|
# Framework-style include paths are found by moc when cmQtAutoMocUic.cxx detects frameworks by
|
|
|
|
# looking at an include path and detecting a "QtFoo.framework/Headers" path.
|
|
|
|
# Make sure to create such paths for both the the BUILD_INTERFACE and the INSTALL_INTERFACE.
|
|
|
|
#
|
|
|
|
# Only add syncqt headers if they exist.
|
2022-08-12 19:53:14 +02:00
|
|
|
# This handles cases like QmlDevToolsPrivate which do not have their own headers, but borrow
|
|
|
|
# them from another module.
|
2020-08-13 17:37:47 +02:00
|
|
|
if(NOT arg_NO_SYNC_QT AND NOT arg_NO_MODULE_HEADERS)
|
|
|
|
# Don't include private headers unless they exist, aka syncqt created them.
|
2022-08-12 19:53:14 +02:00
|
|
|
qt_internal_append_include_directories_with_headers_check(${target}
|
|
|
|
private_includes PRIVATE
|
|
|
|
"$<BUILD_INTERFACE:${module_build_interface_versioned_include_dir}>"
|
|
|
|
"$<BUILD_INTERFACE:${module_build_interface_versioned_inner_include_dir}>"
|
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
|
|
|
|
list(APPEND public_includes
|
|
|
|
# For the syncqt headers
|
2021-07-30 13:16:10 +02:00
|
|
|
"$<BUILD_INTERFACE:${repo_build_interface_include_dir}>"
|
|
|
|
"$<BUILD_INTERFACE:${module_build_interface_include_dir}>")
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(is_framework)
|
2021-05-26 20:48:58 +02:00
|
|
|
set(fw_install_dir "${INSTALL_LIBDIR}/${fw_dir}")
|
|
|
|
set(fw_install_header_dir "${INSTALL_LIBDIR}/${fw_header_dir}")
|
|
|
|
set(fw_output_header_dir "${QT_BUILD_DIR}/${fw_install_header_dir}")
|
2020-08-13 17:37:47 +02:00
|
|
|
list(APPEND public_includes
|
|
|
|
# Add the framework Headers subdir, so that non-framework-style includes work. The
|
|
|
|
# BUILD_INTERFACE Headers symlink was previously claimed not to exist at the relevant
|
|
|
|
# time, and a fully specified Header path was used instead. This doesn't seem to be a
|
|
|
|
# problem anymore.
|
2021-05-26 20:48:58 +02:00
|
|
|
"$<BUILD_INTERFACE:${fw_output_header_dir}>"
|
|
|
|
"$<INSTALL_INTERFACE:${fw_install_header_dir}>"
|
2022-03-17 13:23:48 +01:00
|
|
|
|
|
|
|
# Add the lib/Foo.framework dir as an include path to let CMake generate
|
|
|
|
# the -F compiler flag for framework-style includes to work.
|
|
|
|
# Make sure it is added AFTER the lib/Foo.framework/Headers include path,
|
|
|
|
# to mitigate issues like QTBUG-101718 and QTBUG-101775 where an include like
|
|
|
|
# #include <QtCore> might cause moc to include the QtCore framework shared library
|
|
|
|
# instead of the actual header.
|
|
|
|
"$<INSTALL_INTERFACE:${fw_install_dir}>"
|
2021-05-26 20:48:58 +02:00
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT arg_NO_MODULE_HEADERS AND NOT arg_NO_SYNC_QT)
|
|
|
|
# For the syncqt headers
|
2021-07-30 13:16:10 +02:00
|
|
|
list(APPEND ${public_headers_list}
|
|
|
|
"$<INSTALL_INTERFACE:${module_install_interface_include_dir}>")
|
2020-09-25 19:48:30 +02:00
|
|
|
|
|
|
|
# To support finding Qt module includes that are not installed into the main Qt prefix.
|
|
|
|
# Use case: A Qt module built by Conan installed into a prefix other than the main prefix.
|
|
|
|
# This does duplicate the include path set on Qt6::Platform target, but CMake is smart
|
|
|
|
# enough to deduplicate the include paths on the command line.
|
|
|
|
# Frameworks are automatically handled by CMake in cmLocalGenerator::GetIncludeFlags()
|
|
|
|
# by additionally passing the 'QtFoo.framework/..' dir with an -iframework argument.
|
|
|
|
list(APPEND ${public_headers_list} "$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}>")
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
list(APPEND ${public_headers_list} ${arg_PUBLIC_INCLUDE_DIRECTORIES})
|
|
|
|
|
|
|
|
set(defines_for_extend_target "")
|
|
|
|
|
|
|
|
if(NOT arg_HEADER_MODULE)
|
|
|
|
list(APPEND defines_for_extend_target
|
|
|
|
QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
|
|
|
|
QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
|
|
|
|
QT_DEPRECATED_WARNINGS
|
|
|
|
QT_BUILDING_QT
|
2020-10-30 13:29:55 +01:00
|
|
|
QT_BUILD_${module_define_infix}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
|
2023-06-07 07:41:52 +00:00
|
|
|
${deprecation_define}
|
2020-08-13 17:37:47 +02:00
|
|
|
)
|
2021-05-20 14:08:20 +02:00
|
|
|
list(APPEND arg_LIBRARIES Qt::PlatformModuleInternal)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
2022-03-11 12:41:36 +01:00
|
|
|
qt_internal_add_repo_local_defines("${target}")
|
|
|
|
|
2023-01-31 14:05:16 +01:00
|
|
|
if(arg_NO_UNITY_BUILD)
|
2023-03-15 10:46:22 +01:00
|
|
|
set(arg_NO_UNITY_BUILD "NO_UNITY_BUILD")
|
2023-01-31 14:05:16 +01:00
|
|
|
else()
|
|
|
|
set(arg_NO_UNITY_BUILD "")
|
|
|
|
endif()
|
|
|
|
|
2022-08-12 19:53:14 +02:00
|
|
|
if(NOT arg_EXTERNAL_HEADERS)
|
|
|
|
set(arg_EXTERNAL_HEADERS "")
|
|
|
|
endif()
|
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 cd12c1f33281452d478bb94744d76bead5c7363a
Task-number: QTBUG-99238
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Idb37937cf53e708425402c90f55bda8816e27f29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-29 11:38:30 +02:00
|
|
|
|
2024-11-08 14:26:32 +01:00
|
|
|
_qt_internal_forward_function_args(
|
|
|
|
FORWARD_PREFIX arg
|
|
|
|
FORWARD_OUT_VAR extend_target_args
|
|
|
|
FORWARD_SINGLE
|
|
|
|
PRECOMPILED_HEADER
|
|
|
|
)
|
|
|
|
|
2020-09-22 10:02:27 +02:00
|
|
|
qt_internal_extend_target("${target}"
|
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 cd12c1f33281452d478bb94744d76bead5c7363a
Task-number: QTBUG-99238
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Idb37937cf53e708425402c90f55bda8816e27f29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-29 11:38:30 +02:00
|
|
|
${arg_NO_UNITY_BUILD}
|
2022-08-12 19:53:14 +02:00
|
|
|
SOURCES
|
|
|
|
${arg_SOURCES}
|
|
|
|
${arg_EXTERNAL_HEADERS}
|
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 cd12c1f33281452d478bb94744d76bead5c7363a
Task-number: QTBUG-99238
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Idb37937cf53e708425402c90f55bda8816e27f29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-03-29 11:38:30 +02:00
|
|
|
NO_UNITY_BUILD_SOURCES
|
|
|
|
${arg_NO_UNITY_BUILD_SOURCES}
|
2020-08-13 17:37:47 +02:00
|
|
|
INCLUDE_DIRECTORIES
|
|
|
|
${private_includes}
|
2022-11-21 17:55:13 -08:00
|
|
|
SYSTEM_INCLUDE_DIRECTORIES
|
|
|
|
${arg_SYSTEM_INCLUDE_DIRECTORIES}
|
2020-08-13 17:37:47 +02:00
|
|
|
PUBLIC_INCLUDE_DIRECTORIES
|
|
|
|
${public_includes}
|
|
|
|
PUBLIC_DEFINES
|
|
|
|
${arg_PUBLIC_DEFINES}
|
|
|
|
DEFINES
|
|
|
|
${arg_DEFINES}
|
|
|
|
${defines_for_extend_target}
|
|
|
|
PUBLIC_LIBRARIES ${arg_PUBLIC_LIBRARIES}
|
2021-05-20 14:08:20 +02:00
|
|
|
LIBRARIES ${arg_LIBRARIES}
|
2020-08-13 17:37:47 +02:00
|
|
|
PRIVATE_MODULE_INTERFACE ${arg_PRIVATE_MODULE_INTERFACE}
|
|
|
|
FEATURE_DEPENDENCIES ${arg_FEATURE_DEPENDENCIES}
|
|
|
|
DBUS_ADAPTOR_SOURCES ${arg_DBUS_ADAPTOR_SOURCES}
|
|
|
|
DBUS_ADAPTOR_FLAGS ${arg_DBUS_ADAPTOR_FLAGS}
|
|
|
|
DBUS_INTERFACE_SOURCES ${arg_DBUS_INTERFACE_SOURCES}
|
|
|
|
DBUS_INTERFACE_FLAGS ${arg_DBUS_INTERFACE_FLAGS}
|
|
|
|
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
|
|
|
|
PUBLIC_COMPILE_OPTIONS ${arg_PUBLIC_COMPILE_OPTIONS}
|
|
|
|
LINK_OPTIONS ${arg_LINK_OPTIONS}
|
|
|
|
PUBLIC_LINK_OPTIONS ${arg_PUBLIC_LINK_OPTIONS}
|
|
|
|
MOC_OPTIONS ${arg_MOC_OPTIONS}
|
|
|
|
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
|
|
|
|
DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS}
|
|
|
|
NO_PCH_SOURCES ${arg_NO_PCH_SOURCES}
|
2024-11-08 14:26:32 +01:00
|
|
|
${extend_target_args}
|
2020-08-13 17:37:47 +02:00
|
|
|
)
|
|
|
|
|
2020-10-30 13:29:55 +01:00
|
|
|
# The public module define is not meant to be used when building the module itself,
|
|
|
|
# it's only meant to be used for consumers of the module,
|
|
|
|
# thus we can't use qt_internal_extend_target()'s PUBLIC_DEFINES option.
|
|
|
|
target_compile_definitions(${target} INTERFACE QT_${module_define_infix}_LIB)
|
|
|
|
|
2025-03-17 10:07:25 +01:00
|
|
|
if(NOT arg_EXCEPTIONS)
|
2024-08-01 16:25:09 +02:00
|
|
|
qt_internal_set_exceptions_flags("${target}" "DEFAULT")
|
|
|
|
else()
|
|
|
|
qt_internal_set_exceptions_flags("${target}" "${arg_EXCEPTIONS}")
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(configureFile "${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
|
|
|
|
if(arg_CONFIGURE_FILE_PATH)
|
|
|
|
set(configureFile "${arg_CONFIGURE_FILE_PATH}")
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${configureFile}" AND NOT arg_NO_CONFIG_HEADER_FILE)
|
|
|
|
qt_feature_module_begin(
|
|
|
|
LIBRARY "${target}"
|
2021-06-18 20:13:32 +02:00
|
|
|
PUBLIC_FILE "${module_config_header}"
|
|
|
|
PRIVATE_FILE "${module_config_private_header}"
|
2020-08-13 17:37:47 +02:00
|
|
|
PUBLIC_DEPENDENCIES ${arg_FEATURE_DEPENDENCIES}
|
|
|
|
PRIVATE_DEPENDENCIES ${arg_FEATURE_DEPENDENCIES}
|
|
|
|
)
|
|
|
|
include(${configureFile})
|
|
|
|
qt_feature_module_end("${target}")
|
2022-09-08 12:18:34 +02:00
|
|
|
|
|
|
|
qt_internal_extend_target("${target}"
|
|
|
|
SOURCES
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${module_config_header}"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${module_config_private_header}"
|
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Handle creation of cmake files for consumers of find_package().
|
|
|
|
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}${target}")
|
|
|
|
qt_path_join(config_build_dir ${QT_CONFIG_BUILD_DIR} ${path_suffix})
|
|
|
|
qt_path_join(config_install_dir ${QT_CONFIG_INSTALL_DIR} ${path_suffix})
|
2024-12-09 21:14:50 +01:00
|
|
|
if(NOT arg_NO_PRIVATE_MODULE)
|
|
|
|
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}${target_private}")
|
|
|
|
qt_path_join(private_config_build_dir ${QT_CONFIG_BUILD_DIR} ${path_suffix})
|
|
|
|
qt_path_join(private_config_install_dir ${QT_CONFIG_INSTALL_DIR} ${path_suffix})
|
|
|
|
endif()
|
|
|
|
unset(path_suffix)
|
2020-08-13 17:37:47 +02:00
|
|
|
|
|
|
|
set(extra_cmake_files)
|
|
|
|
set(extra_cmake_includes)
|
|
|
|
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake")
|
|
|
|
list(APPEND extra_cmake_files "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake")
|
|
|
|
list(APPEND extra_cmake_includes "${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake")
|
|
|
|
endif()
|
2024-02-06 11:52:11 +01:00
|
|
|
|
2025-05-21 16:28:02 +02:00
|
|
|
if(CMAKE_VERSION VERSION_LESS 3.30)
|
|
|
|
# For the CMake versions higher than 3.30 the corresponding INTERFACE_
|
|
|
|
# properties will be in Qt<Module>Targets.cmake without extra code
|
|
|
|
# needed.
|
|
|
|
configure_file(
|
|
|
|
"${QT_CMAKE_DIR}/QtTransitiveExtras.cmake.in"
|
|
|
|
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}TransitiveExtras.cmake"
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
list(APPEND extra_cmake_files
|
|
|
|
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}TransitiveExtras.cmake")
|
|
|
|
list(APPEND extra_cmake_includes
|
|
|
|
"${INSTALL_CMAKE_NAMESPACE}${target}TransitiveExtras.cmake")
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in")
|
2020-10-07 16:32:46 +02:00
|
|
|
if(target STREQUAL Core)
|
2024-02-06 11:52:11 +01:00
|
|
|
if(NOT "${QT_NAMESPACE}" STREQUAL "")
|
2024-02-06 12:06:48 +01:00
|
|
|
string(MAKE_C_IDENTIFIER "${QT_NAMESPACE}" qt_namespace_sanity)
|
|
|
|
if(NOT "${QT_NAMESPACE}" STREQUAL "${qt_namespace_sanity}")
|
|
|
|
message(FATAL_ERROR "QT_NAMESPACE is not a valid C++ identifier: "
|
|
|
|
"${QT_NAMESPACE}.")
|
|
|
|
endif()
|
2024-02-06 11:52:11 +01:00
|
|
|
string(JOIN "" qtcore_namespace_definition
|
|
|
|
"set_property(TARGET \${__qt_core_target} "
|
|
|
|
"APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=${QT_NAMESPACE})"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-10-07 16:32:46 +02:00
|
|
|
set(extra_cmake_code "")
|
|
|
|
# Add some variables for compatibility with Qt5 config files.
|
|
|
|
if(QT_FEATURE_reduce_exports)
|
|
|
|
string(APPEND qtcore_extra_cmake_code "
|
|
|
|
set(QT_VISIBILITY_AVAILABLE TRUE)")
|
|
|
|
endif()
|
|
|
|
if(QT_LIBINFIX)
|
|
|
|
string(APPEND qtcore_extra_cmake_code "
|
|
|
|
set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
|
|
|
|
endif()
|
|
|
|
|
2023-01-06 16:12:34 +01:00
|
|
|
# Store whether find_package(Qt6Foo) should succeed if Qt6FooTools is missing.
|
|
|
|
if(QT_ALLOW_MISSING_TOOLS_PACKAGES)
|
|
|
|
string(APPEND qtcore_extra_cmake_code "
|
|
|
|
set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
|
|
|
|
endif()
|
2020-10-07 16:32:46 +02:00
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in"
|
|
|
|
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake"
|
|
|
|
@ONLY)
|
|
|
|
list(APPEND extra_cmake_files "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake")
|
|
|
|
list(APPEND extra_cmake_includes "${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
foreach(cmake_file IN LISTS arg_EXTRA_CMAKE_FILES)
|
2025-02-18 11:52:21 +01:00
|
|
|
get_source_file_property(install_path ${cmake_file} QT_INSTALL_PATH)
|
|
|
|
if(NOT install_path)
|
|
|
|
# Sanitize the install_path from `NOTFOUND` to ""
|
|
|
|
set(install_path "")
|
|
|
|
endif()
|
|
|
|
file(COPY ${cmake_file} DESTINATION "${config_build_dir}/${install_path}")
|
|
|
|
qt_install(FILES
|
|
|
|
${cmake_file}
|
|
|
|
DESTINATION "${config_install_dir}/${install_path}"
|
|
|
|
COMPONENT Devel
|
|
|
|
)
|
2024-03-20 11:51:50 +01:00
|
|
|
|
|
|
|
# Make sure touched extra cmake files cause a reconfigure, so they get re-copied.
|
2025-03-11 13:48:28 +01:00
|
|
|
_qt_internal_append_cmake_configure_depends("${cmake_file}")
|
2020-08-13 17:37:47 +02:00
|
|
|
endforeach()
|
|
|
|
list(APPEND extra_cmake_includes ${arg_EXTRA_CMAKE_INCLUDES})
|
|
|
|
|
|
|
|
set(extra_cmake_code "")
|
|
|
|
|
2022-12-06 21:07:38 +01:00
|
|
|
if(arg_POLICIES)
|
|
|
|
set(policies "")
|
|
|
|
foreach(policy IN LISTS arg_POLICIES)
|
|
|
|
list(APPEND policies "set(QT_KNOWN_POLICY_${policy} TRUE)")
|
|
|
|
|
|
|
|
# When building Qt, tests and examples might expect a policy to be known, but they
|
|
|
|
# won't be known depending on which scope or when a find_package(Module) with the
|
|
|
|
# respective policy is called. Check the global list of known policies to accommodate
|
|
|
|
# that.
|
|
|
|
set_property(GLOBAL APPEND PROPERTY _qt_global_known_policies "${policy}")
|
|
|
|
endforeach()
|
|
|
|
list(JOIN policies "\n" policies_str)
|
|
|
|
string(APPEND extra_cmake_code "${policies_str}\n")
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
# Generate metatypes
|
2023-01-16 16:05:57 +01:00
|
|
|
if (NOT ${arg_NO_GENERATE_METATYPES} AND NOT target_type STREQUAL "INTERFACE_LIBRARY")
|
|
|
|
set(args "")
|
|
|
|
if(QT_WILL_INSTALL)
|
|
|
|
set(metatypes_install_dir "${INSTALL_ARCHDATADIR}/metatypes")
|
2024-11-08 15:48:24 +01:00
|
|
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.31")
|
|
|
|
cmake_path(SET metatypes_install_dir NORMALIZE "${metatypes_install_dir}")
|
|
|
|
endif()
|
2023-01-16 16:05:57 +01:00
|
|
|
list(APPEND args
|
|
|
|
__QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}")
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
2023-01-16 16:05:57 +01:00
|
|
|
qt6_extract_metatypes(${target} ${args})
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
2023-01-16 16:05:57 +01:00
|
|
|
|
2020-11-30 18:46:49 +11:00
|
|
|
qt_internal_get_min_new_policy_cmake_version(min_new_policy_version)
|
|
|
|
qt_internal_get_max_new_policy_cmake_version(max_new_policy_version)
|
2025-01-03 17:19:22 +01:00
|
|
|
|
|
|
|
if(is_static_lib)
|
|
|
|
set(write_basic_module_package_args IS_STATIC_LIB)
|
|
|
|
else()
|
|
|
|
set(write_basic_module_package_args "")
|
|
|
|
endif()
|
2025-01-27 10:02:23 +01:00
|
|
|
|
|
|
|
if(arg_FIND_PRIVATE_MODULE)
|
|
|
|
set(write_basic_public_module_package_args FIND_PRIVATE_MODULE)
|
|
|
|
else()
|
|
|
|
set(write_basic_public_module_package_args "")
|
|
|
|
endif()
|
|
|
|
|
2024-12-09 21:14:50 +01:00
|
|
|
qt_internal_write_basic_module_package("${target}" "${target_private}"
|
2025-01-03 17:19:22 +01:00
|
|
|
${write_basic_module_package_args}
|
2025-01-27 10:02:23 +01:00
|
|
|
${write_basic_public_module_package_args}
|
2024-12-09 21:14:50 +01:00
|
|
|
CONFIG_BUILD_DIR ${config_build_dir}
|
|
|
|
CONFIG_INSTALL_DIR ${config_install_dir}
|
2020-08-13 17:37:47 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake")
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake"
|
|
|
|
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake"
|
|
|
|
@ONLY)
|
|
|
|
list(APPEND extra_cmake_files "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
qt_install(FILES
|
|
|
|
${extra_cmake_files}
|
|
|
|
DESTINATION "${config_install_dir}"
|
|
|
|
COMPONENT Devel
|
|
|
|
)
|
|
|
|
|
2024-12-09 21:14:50 +01:00
|
|
|
if(NOT arg_NO_PRIVATE_MODULE)
|
2025-01-03 17:19:22 +01:00
|
|
|
qt_internal_write_basic_module_package("${target}" "${target_private}"
|
|
|
|
${write_basic_module_package_args}
|
2024-12-09 21:14:50 +01:00
|
|
|
PRIVATE
|
|
|
|
CONFIG_BUILD_DIR ${private_config_build_dir}
|
|
|
|
CONFIG_INSTALL_DIR ${private_config_install_dir}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
file(COPY ${extra_cmake_files} DESTINATION "${config_build_dir}")
|
2024-12-09 21:14:50 +01:00
|
|
|
|
|
|
|
_qt_internal_forward_function_args(
|
|
|
|
FORWARD_PREFIX arg
|
|
|
|
FORWARD_OUT_VAR export_module_args
|
|
|
|
FORWARD_OPTIONS NO_ADDITIONAL_TARGET_INFO
|
|
|
|
)
|
|
|
|
qt_internal_export_module(${target}
|
|
|
|
${export_module_args}
|
|
|
|
CONFIG_BUILD_DIR ${config_build_dir}
|
|
|
|
CONFIG_INSTALL_DIR ${config_install_dir}
|
2022-08-12 19:53:14 +02:00
|
|
|
)
|
2024-12-09 21:14:50 +01:00
|
|
|
if(NOT arg_NO_PRIVATE_MODULE)
|
|
|
|
qt_internal_export_module(${target_private}
|
|
|
|
${export_module_args}
|
|
|
|
CONFIG_BUILD_DIR ${private_config_build_dir}
|
|
|
|
CONFIG_INSTALL_DIR ${private_config_install_dir}
|
|
|
|
)
|
|
|
|
endif()
|
2020-08-13 17:37:47 +02:00
|
|
|
|
2020-09-03 18:29:41 +10:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
qt_apply_rpaths(TARGET "${target}" INSTALL_PATH "${INSTALL_LIBDIR}" RELATIVE_RPATH)
|
2022-04-14 18:04:41 +02:00
|
|
|
qt_internal_apply_staging_prefix_build_rpath_workaround()
|
2020-09-03 18:29:41 +10:00
|
|
|
endif()
|
2020-08-13 17:37:47 +02:00
|
|
|
|
|
|
|
if (ANDROID AND NOT arg_HEADER_MODULE)
|
|
|
|
# Record install library location so it can be accessed by
|
2021-02-10 00:07:58 +02:00
|
|
|
# qt_internal_android_dependencies without having to specify it again.
|
2020-08-13 17:37:47 +02:00
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
QT_ANDROID_MODULE_INSTALL_DIR ${INSTALL_LIBDIR})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
### fixme: cmake is missing a built-in variable for this. We want to apply it only to modules and plugins
|
|
|
|
# that belong to Qt.
|
|
|
|
if(NOT arg_HEADER_MODULE)
|
|
|
|
qt_internal_add_link_flags_no_undefined("${target}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(interface_includes "")
|
|
|
|
|
2021-04-29 17:45:19 +02:00
|
|
|
# Handle cases like QmlDevToolsPrivate which do not have their own headers, but rather borrow them
|
2020-08-13 17:37:47 +02:00
|
|
|
# from another module.
|
2022-08-12 19:53:14 +02:00
|
|
|
if(NOT arg_NO_SYNC_QT AND NOT arg_NO_MODULE_HEADERS)
|
2020-08-13 17:37:47 +02:00
|
|
|
list(APPEND interface_includes "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
|
|
|
|
|
2023-06-23 09:23:55 +02:00
|
|
|
# syncqt does not create a private header directory like 'include/6.0/QtFoo' unless
|
2020-08-13 17:37:47 +02:00
|
|
|
# the module has foo_p.h header files. For QtZlib, there are no such private headers, so we
|
|
|
|
# need to make sure not to add such include paths unless the directory exists, otherwise
|
|
|
|
# consumers of the module will fail at CMake generation time stating that
|
|
|
|
# INTERFACE_INCLUDE_DIRECTORIES contains a non-existent path.
|
2022-08-12 19:53:14 +02:00
|
|
|
qt_internal_append_include_directories_with_headers_check(${target}
|
|
|
|
interface_includes PRIVATE
|
|
|
|
"$<BUILD_INTERFACE:${module_build_interface_versioned_include_dir}>"
|
|
|
|
"$<BUILD_INTERFACE:${module_build_interface_versioned_inner_include_dir}>"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(is_framework)
|
|
|
|
set(fw_install_private_header_dir "${INSTALL_LIBDIR}/${fw_private_header_dir}")
|
|
|
|
set(fw_install_private_module_header_dir
|
|
|
|
"${INSTALL_LIBDIR}/${fw_private_module_header_dir}")
|
|
|
|
qt_internal_append_include_directories_with_headers_check(${target}
|
|
|
|
interface_includes PRIVATE
|
|
|
|
"$<INSTALL_INTERFACE:${fw_install_private_header_dir}>"
|
|
|
|
"$<INSTALL_INTERFACE:${fw_install_private_module_header_dir}>"
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
qt_internal_append_include_directories_with_headers_check(${target}
|
|
|
|
interface_includes PRIVATE
|
|
|
|
"$<INSTALL_INTERFACE:${module_install_interface_versioned_include_dir}>"
|
|
|
|
"$<INSTALL_INTERFACE:${module_install_interface_versioned_inner_include_dir}>"
|
|
|
|
)
|
2020-08-13 17:37:47 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-04-06 18:57:11 +02:00
|
|
|
if(arg_INTERNAL_MODULE)
|
|
|
|
target_include_directories("${target}" INTERFACE ${interface_includes})
|
|
|
|
elseif(NOT ${arg_NO_PRIVATE_MODULE})
|
2020-08-13 17:37:47 +02:00
|
|
|
target_include_directories("${target_private}" INTERFACE ${interface_includes})
|
|
|
|
target_link_libraries("${target_private}" INTERFACE "${target}")
|
|
|
|
endif()
|
|
|
|
|
2020-11-02 12:40:57 +01:00
|
|
|
set(debug_install_dir "${INSTALL_LIBDIR}")
|
|
|
|
if (MINGW)
|
|
|
|
set(debug_install_dir "${INSTALL_BINDIR}")
|
|
|
|
endif()
|
|
|
|
qt_enable_separate_debug_info(${target} "${debug_install_dir}")
|
2020-09-29 22:07:33 +02:00
|
|
|
set(pdb_install_dir "${INSTALL_BINDIR}")
|
|
|
|
if(NOT is_shared_lib)
|
|
|
|
set(pdb_install_dir "${INSTALL_LIBDIR}")
|
|
|
|
endif()
|
|
|
|
qt_internal_install_pdb_files(${target} "${pdb_install_dir}")
|
|
|
|
|
2020-10-21 14:13:49 +02:00
|
|
|
if (arg_NO_PRIVATE_MODULE)
|
|
|
|
set(arg_NO_PRIVATE_MODULE "NO_PRIVATE_MODULE")
|
|
|
|
else()
|
|
|
|
unset(arg_NO_PRIVATE_MODULE)
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
qt_describe_module(${target})
|
CMake: Generate an SPDX v2.3 SBOM file for each built repository
This change adds a new -sbom configure option to allow generating and
installing an SPDX v2.3 SBOM file when building a qt repo.
The -sbom-dir option can be used to configure the location where
each repo sbom file will be installed.
By default it is installed into
$prefix/$archdatadir/sbom/$sbom_lower_project_name.sdpx
which is basically ~/Qt/sbom/qtbase-6.8.0.spdx
The file is installed as part of the default installation rules, but
it can also be installed manually using the "sbom" installation
component, or "sbom_$lower_project_name" in a top-level build. For
example: cmake install . --component sbom_qtbase
CMake 3.19+ is needed to read the qt_attribution.json files for
copyrights, license info, etc. When using an older cmake version,
configuration will error out. It is possible to opt into using an
older cmake version, but the generated sbom will lack all the
attribution file information.
Using an older cmake version is untested and not officially supported.
Implementation notes.
The bulk of the implementation is split into 4 new files:
- QtPublicSbomHelpers.cmake - for Qt-specific collecting, processing
and dispatching the generation of various pieces of the SBOM document
e.g. a SDPX package associated with a target like Core, a SDPX
file entry for each target binary file (per-config shared library,
archive, executable, etc)
- QtPublicSbomGenerationHelpers.cmake - for non-Qt specific
implementation of SPDX generation. This also has some code that was
taken from the cmake-sbom 3rd party project, so it is dual licensed
under the usual Qt build system BSD license, as well as the MIT
license of the 3rd party project
- QtPublicGitHelpers.cmake - for git related features, mainly to embed
queried hashes or tags into version strings, is dual-licensed for
the same reasons as QtPublicSbomGenerationHelpers.cmake
- QtSbomHelpers.cmake - Qt-specific functions that just forward
arguments to the public functions. These are meant to be used in our
Qt CMakeLists.txt instead of the public _qt_internal_add_sbom ones
for naming consistency. These function would mostly be used to
annotate 3rd party libraries with sbom info and to add sbom info
for unusual target setups (like the Bootstrap library), because most
of the handling is already done automatically via
qt_internal_add_module/plugin/etc.
The files are put into Public cmake files, with the future hope of
making this available to user projects in some capacity.
The distinction of Qt-specific and non-Qt specific code might blur a
bit, and thus the separation across files might not always be
consistent, but it was best effort.
The main purpose of the code is to collect various information about
targets and their relationships and generate equivalent SPDX info.
Collection is currently done for the following targets: Qt modules,
plugins, apps, tools, system libraries, bundled 3rd party libraries
and partial 3rd party sources compiled directly as part of Qt targets.
Each target has an equivalent SPDX package generated with information
like version, license, copyright, CPE (common vulnerability
identifier), files that belong to the package, and relationships on
other SPDX packages (associated cmake targets), mostly gathered from
direct linking dependencies.
Each package might also contain files, e.g. libQt6Core.so for the Core
target. Each file also has info like license id, copyrights, but also
the list of source files that were used to generate the file and a
sha1 checksum.
SPDX documents can also refer to packages in other SPDX documents, and
those are referred to via external document references. This is the
case when building qtdeclarative and we refer to Core.
For qt provided targets, we have complete information regarding
licenses, and copyrights.
For bundled 3rd party libraries, we should also have most information,
which is usually parsed from the
src/3rdparty/libfoo/qt_attribution.json files.
If there are multiple attribution files, or if the files have multiple
entries, we create a separate SBOM package for each of those entries,
because each might have a separate copyright or version, and an sbom
package can have only one version (although many copyrights).
For system libraries we usually lack the information because we don't
have attribution files for Find scripts. So the info needs to be
manually annotated via arguments to the sbom function calls, or the
FindFoo.cmake scripts expose that information in some form and we
can query it.
There are also corner cases like 3rdparty sources being directly
included in a Qt library, like the m4dc files for Gui, or PCRE2 for
Bootstrap.
Or QtWebEngine libraries (either Qt bundled or Chromium bundled or
system libraries) which get linked in by GN instead of CMake, so there
are no direct targets for them.
The information for these need to be annotated manually as well.
There is also a distinction to be made for static Qt builds (or any
static Qt library in a shared build), where the system libraries found
during the Qt build might not be the same that are linked into the
final user application or library.
The actual generation of the SBOM is done by file(GENERATE)-ing one
.cmake file for each target, file, external ref, etc, which will be
included in a top-level cmake script.
The top-level cmake script will run through each included file, to
append to a "staging" spdx file, which will then be used in a
configure_file() call to replace some final
variables, like embedding a file checksum.
There are install rules to generate a complete SBOM during
installation, and an optional 'sbom' custom target that allows
building an incomplete SBOM during the build step.
The build target is just for convenience and faster development
iteration time. It is incomplete because it is missing the installed
file SHA1 checksums and the document verification code (the sha1 of
all sha1s). We can't compute those during the build before the files
are actually installed.
A complete SBOM can only be achieved at installation time. The install
script will include all the generated helper files, but also set some
additional variables to ensure checksumming happens, and also handle
multi-config installation, among other small things.
For multi-config builds, CMake doesn't offer a way to run code after
all configs are installed, because they might not always be installed,
someone might choose to install just Release.
To handle that, we rely on ninja installing each config sequentially
(because ninja places the install rules into the 'console' pool which
runs one task at a time).
For each installed config we create a config-specific marker file.
Once all marker files are present, whichever config ends up being
installed as the last one, we run the sbom generation once, and then
delete all marker files.
There are a few internal variables that can be set during
configuration to enable various checks (and other features) on the
generated spdx files:
- QT_INTERNAL_SBOM_VERIFY
- QT_INTERNAL_SBOM_AUDIT
- QT_INTERNAL_SBOM_AUDIT_NO_ERROR
- QT_INTERNAL_SBOM_GENERATE_JSON
- QT_INTERNAL_SBOM_SHOW_TABLE
- QT_INTERNAL_SBOM_DEFAULT_CHECKS
These use 3rd party python tools, so they are not enabled by default.
If enabled, they run at installation time after the sbom is installed.
We will hopefully enable them in CI.
Overall, the code is still a bit messy in a few places, due to time
constraints, but can be improved later.
Some possible TODOs for the future:
- Do we need to handle 3rd party libs linked into a Qt static library
in a Qt shared build, where the Qt static lib is not installed, but
linked into a Qt shared library, somehow specially?
We can record a package for it, but we can't
create a spdx file record for it (and associated source
relationships) because we don't install the file, and spdx requires
the file to be installed and checksummed. Perhaps we can consider
adding some free-form text snippet to the package itself?
- Do we want to add parsing of .cpp source files for Copyrights, to
embed them into the packages? This will likely slow down
configuration quite a bit.
- Currently sbom info attached to WrapFoo packages in one repo is
not exported / available in other repos. E.g. If we annotate
WrapZLIB in qtbase with CPE_VENDOR zlib, this info will not be
available when looking up WrapZLIB in qtimageformats.
This is because they are IMPORTED libraries, and are not
exported. We might want to record this info in the future.
[ChangeLog][Build System] A new -sbom configure option can be used
to generate and install a SPDX SBOM (Software Bill of Materials) file
for each built Qt repository.
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I9c730a6bbc47e02ce1836fccf00a14ec8eb1a5f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-03-07 18:02:56 +01:00
|
|
|
|
|
|
|
if(QT_GENERATE_SBOM)
|
2024-06-14 19:07:16 +02:00
|
|
|
set(sbom_args "")
|
2024-08-02 15:06:31 +02:00
|
|
|
|
|
|
|
# 3rd party header modules should not be treated as Qt modules.
|
|
|
|
if(arg_IS_QT_3RD_PARTY_HEADER_MODULE)
|
|
|
|
list(APPEND sbom_args TYPE QT_THIRD_PARTY_MODULE)
|
|
|
|
else()
|
|
|
|
list(APPEND sbom_args TYPE QT_MODULE)
|
|
|
|
endif()
|
CMake: Generate an SPDX v2.3 SBOM file for each built repository
This change adds a new -sbom configure option to allow generating and
installing an SPDX v2.3 SBOM file when building a qt repo.
The -sbom-dir option can be used to configure the location where
each repo sbom file will be installed.
By default it is installed into
$prefix/$archdatadir/sbom/$sbom_lower_project_name.sdpx
which is basically ~/Qt/sbom/qtbase-6.8.0.spdx
The file is installed as part of the default installation rules, but
it can also be installed manually using the "sbom" installation
component, or "sbom_$lower_project_name" in a top-level build. For
example: cmake install . --component sbom_qtbase
CMake 3.19+ is needed to read the qt_attribution.json files for
copyrights, license info, etc. When using an older cmake version,
configuration will error out. It is possible to opt into using an
older cmake version, but the generated sbom will lack all the
attribution file information.
Using an older cmake version is untested and not officially supported.
Implementation notes.
The bulk of the implementation is split into 4 new files:
- QtPublicSbomHelpers.cmake - for Qt-specific collecting, processing
and dispatching the generation of various pieces of the SBOM document
e.g. a SDPX package associated with a target like Core, a SDPX
file entry for each target binary file (per-config shared library,
archive, executable, etc)
- QtPublicSbomGenerationHelpers.cmake - for non-Qt specific
implementation of SPDX generation. This also has some code that was
taken from the cmake-sbom 3rd party project, so it is dual licensed
under the usual Qt build system BSD license, as well as the MIT
license of the 3rd party project
- QtPublicGitHelpers.cmake - for git related features, mainly to embed
queried hashes or tags into version strings, is dual-licensed for
the same reasons as QtPublicSbomGenerationHelpers.cmake
- QtSbomHelpers.cmake - Qt-specific functions that just forward
arguments to the public functions. These are meant to be used in our
Qt CMakeLists.txt instead of the public _qt_internal_add_sbom ones
for naming consistency. These function would mostly be used to
annotate 3rd party libraries with sbom info and to add sbom info
for unusual target setups (like the Bootstrap library), because most
of the handling is already done automatically via
qt_internal_add_module/plugin/etc.
The files are put into Public cmake files, with the future hope of
making this available to user projects in some capacity.
The distinction of Qt-specific and non-Qt specific code might blur a
bit, and thus the separation across files might not always be
consistent, but it was best effort.
The main purpose of the code is to collect various information about
targets and their relationships and generate equivalent SPDX info.
Collection is currently done for the following targets: Qt modules,
plugins, apps, tools, system libraries, bundled 3rd party libraries
and partial 3rd party sources compiled directly as part of Qt targets.
Each target has an equivalent SPDX package generated with information
like version, license, copyright, CPE (common vulnerability
identifier), files that belong to the package, and relationships on
other SPDX packages (associated cmake targets), mostly gathered from
direct linking dependencies.
Each package might also contain files, e.g. libQt6Core.so for the Core
target. Each file also has info like license id, copyrights, but also
the list of source files that were used to generate the file and a
sha1 checksum.
SPDX documents can also refer to packages in other SPDX documents, and
those are referred to via external document references. This is the
case when building qtdeclarative and we refer to Core.
For qt provided targets, we have complete information regarding
licenses, and copyrights.
For bundled 3rd party libraries, we should also have most information,
which is usually parsed from the
src/3rdparty/libfoo/qt_attribution.json files.
If there are multiple attribution files, or if the files have multiple
entries, we create a separate SBOM package for each of those entries,
because each might have a separate copyright or version, and an sbom
package can have only one version (although many copyrights).
For system libraries we usually lack the information because we don't
have attribution files for Find scripts. So the info needs to be
manually annotated via arguments to the sbom function calls, or the
FindFoo.cmake scripts expose that information in some form and we
can query it.
There are also corner cases like 3rdparty sources being directly
included in a Qt library, like the m4dc files for Gui, or PCRE2 for
Bootstrap.
Or QtWebEngine libraries (either Qt bundled or Chromium bundled or
system libraries) which get linked in by GN instead of CMake, so there
are no direct targets for them.
The information for these need to be annotated manually as well.
There is also a distinction to be made for static Qt builds (or any
static Qt library in a shared build), where the system libraries found
during the Qt build might not be the same that are linked into the
final user application or library.
The actual generation of the SBOM is done by file(GENERATE)-ing one
.cmake file for each target, file, external ref, etc, which will be
included in a top-level cmake script.
The top-level cmake script will run through each included file, to
append to a "staging" spdx file, which will then be used in a
configure_file() call to replace some final
variables, like embedding a file checksum.
There are install rules to generate a complete SBOM during
installation, and an optional 'sbom' custom target that allows
building an incomplete SBOM during the build step.
The build target is just for convenience and faster development
iteration time. It is incomplete because it is missing the installed
file SHA1 checksums and the document verification code (the sha1 of
all sha1s). We can't compute those during the build before the files
are actually installed.
A complete SBOM can only be achieved at installation time. The install
script will include all the generated helper files, but also set some
additional variables to ensure checksumming happens, and also handle
multi-config installation, among other small things.
For multi-config builds, CMake doesn't offer a way to run code after
all configs are installed, because they might not always be installed,
someone might choose to install just Release.
To handle that, we rely on ninja installing each config sequentially
(because ninja places the install rules into the 'console' pool which
runs one task at a time).
For each installed config we create a config-specific marker file.
Once all marker files are present, whichever config ends up being
installed as the last one, we run the sbom generation once, and then
delete all marker files.
There are a few internal variables that can be set during
configuration to enable various checks (and other features) on the
generated spdx files:
- QT_INTERNAL_SBOM_VERIFY
- QT_INTERNAL_SBOM_AUDIT
- QT_INTERNAL_SBOM_AUDIT_NO_ERROR
- QT_INTERNAL_SBOM_GENERATE_JSON
- QT_INTERNAL_SBOM_SHOW_TABLE
- QT_INTERNAL_SBOM_DEFAULT_CHECKS
These use 3rd party python tools, so they are not enabled by default.
If enabled, they run at installation time after the sbom is installed.
We will hopefully enable them in CI.
Overall, the code is still a bit messy in a few places, due to time
constraints, but can be improved later.
Some possible TODOs for the future:
- Do we need to handle 3rd party libs linked into a Qt static library
in a Qt shared build, where the Qt static lib is not installed, but
linked into a Qt shared library, somehow specially?
We can record a package for it, but we can't
create a spdx file record for it (and associated source
relationships) because we don't install the file, and spdx requires
the file to be installed and checksummed. Perhaps we can consider
adding some free-form text snippet to the package itself?
- Do we want to add parsing of .cpp source files for Copyrights, to
embed them into the packages? This will likely slow down
configuration quite a bit.
- Currently sbom info attached to WrapFoo packages in one repo is
not exported / available in other repos. E.g. If we annotate
WrapZLIB in qtbase with CPE_VENDOR zlib, this info will not be
available when looking up WrapZLIB in qtimageformats.
This is because they are IMPORTED libraries, and are not
exported. We might want to record this info in the future.
[ChangeLog][Build System] A new -sbom configure option can be used
to generate and install a SPDX SBOM (Software Bill of Materials) file
for each built Qt repository.
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I9c730a6bbc47e02ce1836fccf00a14ec8eb1a5f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-03-07 18:02:56 +01:00
|
|
|
|
|
|
|
qt_get_cmake_configurations(configs)
|
|
|
|
foreach(config IN LISTS configs)
|
|
|
|
_qt_internal_sbom_append_multi_config_aware_single_arg_option(
|
|
|
|
RUNTIME_PATH
|
|
|
|
"${INSTALL_BINDIR}"
|
|
|
|
"${config}"
|
|
|
|
sbom_args
|
|
|
|
)
|
|
|
|
_qt_internal_sbom_append_multi_config_aware_single_arg_option(
|
|
|
|
LIBRARY_PATH
|
|
|
|
"${INSTALL_LIBDIR}"
|
|
|
|
"${config}"
|
|
|
|
sbom_args
|
|
|
|
)
|
|
|
|
_qt_internal_sbom_append_multi_config_aware_single_arg_option(
|
|
|
|
ARCHIVE_PATH
|
|
|
|
"${INSTALL_LIBDIR}"
|
|
|
|
"${config}"
|
|
|
|
sbom_args
|
|
|
|
)
|
|
|
|
_qt_internal_sbom_append_multi_config_aware_single_arg_option(
|
|
|
|
FRAMEWORK_PATH
|
|
|
|
"${INSTALL_LIBDIR}/${fw_versioned_binary_dir}"
|
|
|
|
"${config}"
|
|
|
|
sbom_args
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
2024-06-14 19:07:16 +02:00
|
|
|
_qt_internal_forward_function_args(
|
|
|
|
FORWARD_APPEND
|
|
|
|
FORWARD_PREFIX arg
|
|
|
|
FORWARD_OUT_VAR sbom_args
|
|
|
|
FORWARD_OPTIONS
|
|
|
|
${__qt_internal_sbom_optional_args}
|
|
|
|
FORWARD_SINGLE
|
|
|
|
${__qt_internal_sbom_single_args}
|
|
|
|
FORWARD_MULTI
|
|
|
|
${__qt_internal_sbom_multi_args}
|
|
|
|
)
|
|
|
|
|
2025-01-13 15:30:15 +01:00
|
|
|
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
|
CMake: Generate an SPDX v2.3 SBOM file for each built repository
This change adds a new -sbom configure option to allow generating and
installing an SPDX v2.3 SBOM file when building a qt repo.
The -sbom-dir option can be used to configure the location where
each repo sbom file will be installed.
By default it is installed into
$prefix/$archdatadir/sbom/$sbom_lower_project_name.sdpx
which is basically ~/Qt/sbom/qtbase-6.8.0.spdx
The file is installed as part of the default installation rules, but
it can also be installed manually using the "sbom" installation
component, or "sbom_$lower_project_name" in a top-level build. For
example: cmake install . --component sbom_qtbase
CMake 3.19+ is needed to read the qt_attribution.json files for
copyrights, license info, etc. When using an older cmake version,
configuration will error out. It is possible to opt into using an
older cmake version, but the generated sbom will lack all the
attribution file information.
Using an older cmake version is untested and not officially supported.
Implementation notes.
The bulk of the implementation is split into 4 new files:
- QtPublicSbomHelpers.cmake - for Qt-specific collecting, processing
and dispatching the generation of various pieces of the SBOM document
e.g. a SDPX package associated with a target like Core, a SDPX
file entry for each target binary file (per-config shared library,
archive, executable, etc)
- QtPublicSbomGenerationHelpers.cmake - for non-Qt specific
implementation of SPDX generation. This also has some code that was
taken from the cmake-sbom 3rd party project, so it is dual licensed
under the usual Qt build system BSD license, as well as the MIT
license of the 3rd party project
- QtPublicGitHelpers.cmake - for git related features, mainly to embed
queried hashes or tags into version strings, is dual-licensed for
the same reasons as QtPublicSbomGenerationHelpers.cmake
- QtSbomHelpers.cmake - Qt-specific functions that just forward
arguments to the public functions. These are meant to be used in our
Qt CMakeLists.txt instead of the public _qt_internal_add_sbom ones
for naming consistency. These function would mostly be used to
annotate 3rd party libraries with sbom info and to add sbom info
for unusual target setups (like the Bootstrap library), because most
of the handling is already done automatically via
qt_internal_add_module/plugin/etc.
The files are put into Public cmake files, with the future hope of
making this available to user projects in some capacity.
The distinction of Qt-specific and non-Qt specific code might blur a
bit, and thus the separation across files might not always be
consistent, but it was best effort.
The main purpose of the code is to collect various information about
targets and their relationships and generate equivalent SPDX info.
Collection is currently done for the following targets: Qt modules,
plugins, apps, tools, system libraries, bundled 3rd party libraries
and partial 3rd party sources compiled directly as part of Qt targets.
Each target has an equivalent SPDX package generated with information
like version, license, copyright, CPE (common vulnerability
identifier), files that belong to the package, and relationships on
other SPDX packages (associated cmake targets), mostly gathered from
direct linking dependencies.
Each package might also contain files, e.g. libQt6Core.so for the Core
target. Each file also has info like license id, copyrights, but also
the list of source files that were used to generate the file and a
sha1 checksum.
SPDX documents can also refer to packages in other SPDX documents, and
those are referred to via external document references. This is the
case when building qtdeclarative and we refer to Core.
For qt provided targets, we have complete information regarding
licenses, and copyrights.
For bundled 3rd party libraries, we should also have most information,
which is usually parsed from the
src/3rdparty/libfoo/qt_attribution.json files.
If there are multiple attribution files, or if the files have multiple
entries, we create a separate SBOM package for each of those entries,
because each might have a separate copyright or version, and an sbom
package can have only one version (although many copyrights).
For system libraries we usually lack the information because we don't
have attribution files for Find scripts. So the info needs to be
manually annotated via arguments to the sbom function calls, or the
FindFoo.cmake scripts expose that information in some form and we
can query it.
There are also corner cases like 3rdparty sources being directly
included in a Qt library, like the m4dc files for Gui, or PCRE2 for
Bootstrap.
Or QtWebEngine libraries (either Qt bundled or Chromium bundled or
system libraries) which get linked in by GN instead of CMake, so there
are no direct targets for them.
The information for these need to be annotated manually as well.
There is also a distinction to be made for static Qt builds (or any
static Qt library in a shared build), where the system libraries found
during the Qt build might not be the same that are linked into the
final user application or library.
The actual generation of the SBOM is done by file(GENERATE)-ing one
.cmake file for each target, file, external ref, etc, which will be
included in a top-level cmake script.
The top-level cmake script will run through each included file, to
append to a "staging" spdx file, which will then be used in a
configure_file() call to replace some final
variables, like embedding a file checksum.
There are install rules to generate a complete SBOM during
installation, and an optional 'sbom' custom target that allows
building an incomplete SBOM during the build step.
The build target is just for convenience and faster development
iteration time. It is incomplete because it is missing the installed
file SHA1 checksums and the document verification code (the sha1 of
all sha1s). We can't compute those during the build before the files
are actually installed.
A complete SBOM can only be achieved at installation time. The install
script will include all the generated helper files, but also set some
additional variables to ensure checksumming happens, and also handle
multi-config installation, among other small things.
For multi-config builds, CMake doesn't offer a way to run code after
all configs are installed, because they might not always be installed,
someone might choose to install just Release.
To handle that, we rely on ninja installing each config sequentially
(because ninja places the install rules into the 'console' pool which
runs one task at a time).
For each installed config we create a config-specific marker file.
Once all marker files are present, whichever config ends up being
installed as the last one, we run the sbom generation once, and then
delete all marker files.
There are a few internal variables that can be set during
configuration to enable various checks (and other features) on the
generated spdx files:
- QT_INTERNAL_SBOM_VERIFY
- QT_INTERNAL_SBOM_AUDIT
- QT_INTERNAL_SBOM_AUDIT_NO_ERROR
- QT_INTERNAL_SBOM_GENERATE_JSON
- QT_INTERNAL_SBOM_SHOW_TABLE
- QT_INTERNAL_SBOM_DEFAULT_CHECKS
These use 3rd party python tools, so they are not enabled by default.
If enabled, they run at installation time after the sbom is installed.
We will hopefully enable them in CI.
Overall, the code is still a bit messy in a few places, due to time
constraints, but can be improved later.
Some possible TODOs for the future:
- Do we need to handle 3rd party libs linked into a Qt static library
in a Qt shared build, where the Qt static lib is not installed, but
linked into a Qt shared library, somehow specially?
We can record a package for it, but we can't
create a spdx file record for it (and associated source
relationships) because we don't install the file, and spdx requires
the file to be installed and checksummed. Perhaps we can consider
adding some free-form text snippet to the package itself?
- Do we want to add parsing of .cpp source files for Copyrights, to
embed them into the packages? This will likely slow down
configuration quite a bit.
- Currently sbom info attached to WrapFoo packages in one repo is
not exported / available in other repos. E.g. If we annotate
WrapZLIB in qtbase with CPE_VENDOR zlib, this info will not be
available when looking up WrapZLIB in qtimageformats.
This is because they are IMPORTED libraries, and are not
exported. We might want to record this info in the future.
[ChangeLog][Build System] A new -sbom configure option can be used
to generate and install a SPDX SBOM (Software Bill of Materials) file
for each built Qt repository.
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I9c730a6bbc47e02ce1836fccf00a14ec8eb1a5f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-03-07 18:02:56 +01:00
|
|
|
endif()
|
|
|
|
|
2022-08-10 16:21:37 +02:00
|
|
|
qt_add_list_file_finalizer(qt_finalize_module ${target} ${arg_INTERNAL_MODULE} ${arg_NO_PRIVATE_MODULE})
|
2020-08-13 17:37:47 +02:00
|
|
|
endfunction()
|
2024-12-09 21:14:50 +01:00
|
|
|
|
|
|
|
# Write and install the basic Qt6Foo and Qt6FooPrivate packages.
|
|
|
|
#
|
|
|
|
# If PRIVATE is specified, write Qt6FooPrivate.
|
|
|
|
# Otherwise write its public counterpart.
|
2025-01-03 17:19:22 +01:00
|
|
|
function(qt_internal_write_basic_module_package target target_private)
|
2024-12-09 21:14:50 +01:00
|
|
|
set(no_value_options
|
2025-01-27 10:02:23 +01:00
|
|
|
FIND_PRIVATE_MODULE
|
2025-01-03 17:19:22 +01:00
|
|
|
IS_STATIC_LIB
|
2024-12-09 21:14:50 +01:00
|
|
|
PRIVATE
|
|
|
|
)
|
|
|
|
set(single_value_options
|
|
|
|
CONFIG_BUILD_DIR
|
|
|
|
CONFIG_INSTALL_DIR
|
|
|
|
)
|
|
|
|
set(multi_value_options "")
|
|
|
|
cmake_parse_arguments(PARSE_ARGV 0 arg
|
|
|
|
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
|
|
|
|
)
|
|
|
|
|
2025-01-27 10:02:23 +01:00
|
|
|
set(always_load_private_module OFF)
|
2024-12-09 21:14:50 +01:00
|
|
|
if(arg_PRIVATE)
|
|
|
|
set(package_name "${INSTALL_CMAKE_NAMESPACE}${target_private}")
|
|
|
|
set(module_config_input_file "QtModuleConfigPrivate.cmake.in")
|
|
|
|
else()
|
|
|
|
set(package_name "${INSTALL_CMAKE_NAMESPACE}${target}")
|
|
|
|
set(module_config_input_file "QtModuleConfig.cmake.in")
|
2025-01-27 10:02:23 +01:00
|
|
|
if(arg_FIND_PRIVATE_MODULE)
|
|
|
|
set(always_load_private_module ON)
|
|
|
|
endif()
|
2024-12-09 21:14:50 +01:00
|
|
|
endif()
|
|
|
|
|
2025-03-06 14:42:46 +01:00
|
|
|
if((QT_FEATURE_no_prefix OR arg_IS_STATIC_LIB)
|
|
|
|
AND NOT arg_PRIVATE
|
|
|
|
AND CMAKE_VERSION VERSION_LESS "3.26")
|
|
|
|
# We auto-load the private module package from the public module package if we have a
|
|
|
|
# statically built module or a non-prefix build and CMake's version is < 3.26. This is
|
|
|
|
# needed for the case "Qt6Foo links against Qt6BarPrivate", because CMake generates a check
|
|
|
|
# for the target Qt6::BarPrivate in Qt6FooTargets.cmake. Once we can require CMake 3.26, we
|
|
|
|
# can simply link against $<BUILD_LOCAL_INTERFACE:Qt6BarPrivate> in
|
|
|
|
# qt_internal_extend_target.
|
2025-01-03 17:19:22 +01:00
|
|
|
#
|
|
|
|
# For older CMake versions, we create an additional CMake file that's optionally included by
|
|
|
|
# Qt6FooConfig.cmake to work around the lack of BUILD_LOCAL_INTERFACE.
|
|
|
|
file(CONFIGURE
|
|
|
|
OUTPUT "${arg_CONFIG_BUILD_DIR}/${package_name}-build.cmake"
|
|
|
|
CONTENT "# This file marks this directory as part of Qt's build tree.
|
|
|
|
set(__qt_${target}_always_load_private_module ON)
|
|
|
|
"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-12-09 21:14:50 +01:00
|
|
|
configure_package_config_file(
|
|
|
|
"${QT_CMAKE_DIR}/${module_config_input_file}"
|
|
|
|
"${arg_CONFIG_BUILD_DIR}/${package_name}Config.cmake"
|
|
|
|
INSTALL_DESTINATION "${arg_CONFIG_INSTALL_DIR}"
|
|
|
|
)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersionImpl.cmake"
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
COMPATIBILITY AnyNewerVersion
|
|
|
|
)
|
|
|
|
qt_internal_write_qt_package_version_file(
|
|
|
|
"${package_name}"
|
|
|
|
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersion.cmake"
|
|
|
|
)
|
|
|
|
qt_install(FILES
|
|
|
|
"${arg_CONFIG_BUILD_DIR}/${package_name}Config.cmake"
|
|
|
|
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersion.cmake"
|
|
|
|
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersionImpl.cmake"
|
|
|
|
DESTINATION "${arg_CONFIG_INSTALL_DIR}"
|
|
|
|
COMPONENT Devel
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(qt_internal_export_module target)
|
|
|
|
set(no_value_options
|
|
|
|
NO_ADDITIONAL_TARGET_INFO
|
|
|
|
)
|
|
|
|
set(single_value_options
|
|
|
|
CONFIG_BUILD_DIR
|
|
|
|
CONFIG_INSTALL_DIR
|
|
|
|
)
|
|
|
|
set(multi_value_options "")
|
|
|
|
cmake_parse_arguments(PARSE_ARGV 1 arg
|
|
|
|
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
|
|
|
|
)
|
|
|
|
_qt_internal_validate_all_args_are_parsed(arg)
|
|
|
|
|
|
|
|
set(export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets")
|
|
|
|
qt_install(TARGETS ${target}
|
|
|
|
EXPORT ${export_name}
|
|
|
|
RUNTIME DESTINATION ${INSTALL_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
|
|
|
|
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
qt_install(EXPORT ${export_name}
|
|
|
|
NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::
|
|
|
|
DESTINATION ${arg_CONFIG_INSTALL_DIR})
|
|
|
|
|
|
|
|
if(NOT arg_NO_ADDITIONAL_TARGET_INFO)
|
|
|
|
qt_internal_export_additional_targets_file(
|
|
|
|
TARGETS ${target}
|
|
|
|
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
|
|
|
|
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
qt_internal_export_modern_cmake_config_targets_file(
|
|
|
|
TARGETS ${target}
|
|
|
|
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
|
|
|
|
CONFIG_BUILD_DIR "${arg_CONFIG_BUILD_DIR}"
|
|
|
|
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}"
|
|
|
|
)
|
|
|
|
|
|
|
|
qt_internal_export_genex_properties(TARGETS ${target}
|
|
|
|
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
|
|
|
|
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}"
|
|
|
|
)
|
|
|
|
endfunction()
|
2020-08-13 17:37:47 +02:00
|
|
|
|
2024-02-12 15:19:56 +01:00
|
|
|
function(qt_internal_apply_apple_privacy_manifest target)
|
2024-03-07 18:02:56 +01:00
|
|
|
# Avoid "INTERFACE_LIBRARY targets may only have whitelisted properties" error on CMake < 3.17.
|
|
|
|
get_target_property(target_type ${target} TYPE)
|
|
|
|
if("${target_type}" STREQUAL "INTERFACE_LIBRARY")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2024-02-12 15:19:56 +01:00
|
|
|
if(APPLE)
|
|
|
|
# Privacy manifest
|
|
|
|
get_target_property(is_framework ${target} FRAMEWORK)
|
|
|
|
if(is_framework)
|
|
|
|
get_target_property(privacy_manifest ${target} _qt_privacy_manifest)
|
|
|
|
if(NOT privacy_manifest)
|
|
|
|
set(privacy_manifest
|
|
|
|
"${__qt_internal_cmake_apple_support_files_path}/PrivacyInfo.xcprivacy")
|
|
|
|
endif()
|
|
|
|
target_sources("${target}" PRIVATE "${privacy_manifest}")
|
|
|
|
set_property(TARGET "${target}" APPEND PROPERTY RESOURCE "${privacy_manifest}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
function(qt_finalize_module target)
|
2025-03-12 09:28:35 +01:00
|
|
|
set(no_value_options
|
|
|
|
INTERNAL_MODULE
|
|
|
|
NO_PRIVATE_MODULE
|
|
|
|
)
|
|
|
|
set(single_value_options "")
|
|
|
|
set(multi_value_options "")
|
|
|
|
cmake_parse_arguments(PARSE_ARGV 1 arg
|
|
|
|
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
|
|
|
|
)
|
|
|
|
_qt_internal_validate_all_args_are_parsed(arg)
|
|
|
|
|
2022-08-12 19:53:14 +02:00
|
|
|
qt_internal_collect_module_headers(module_headers ${target})
|
|
|
|
|
2025-03-12 09:28:35 +01:00
|
|
|
# Issue a warning if we
|
|
|
|
# - suppressed creation of the private module but have private headers
|
|
|
|
# - created a private module but don't have any private headers
|
|
|
|
if(NOT arg_INTERNAL_MODULE)
|
|
|
|
get_target_property(has_private_headers ${target} _qt_module_has_private_headers)
|
|
|
|
if(arg_NO_PRIVATE_MODULE AND has_private_headers)
|
|
|
|
message(AUTHOR_WARNING
|
|
|
|
"Module ${target} has private headers. "
|
|
|
|
"Please remove NO_PRIVATE_MODULE from its creation flags."
|
|
|
|
)
|
|
|
|
elseif(NOT arg_NO_PRIVATE_MODULE AND NOT has_private_headers)
|
|
|
|
message(AUTHOR_WARNING
|
|
|
|
"Module ${target} does not have private headers. "
|
|
|
|
"Please add NO_PRIVATE_MODULE to its creation flags."
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-08-12 19:53:14 +02:00
|
|
|
# qt_internal_install_module_headers needs to be called before
|
|
|
|
# qt_finalize_framework_headers_copy, because the last uses the QT_COPIED_FRAMEWORK_HEADERS
|
2022-08-15 18:29:41 +02:00
|
|
|
# property which supposed to be updated inside every qt_internal_install_module_headers
|
|
|
|
# call.
|
2022-10-05 16:32:31 +02:00
|
|
|
qt_internal_add_headersclean_target(${target} "${module_headers_public}")
|
2025-03-20 15:39:02 +01:00
|
|
|
qt_internal_target_sync_headers(${target}
|
|
|
|
"${module_headers_all}"
|
|
|
|
"${module_headers_generated}"
|
|
|
|
"${module_headers_exclude_from_docs}"
|
|
|
|
)
|
2022-10-05 16:32:31 +02:00
|
|
|
get_target_property(module_depends_header ${target} _qt_module_depends_header)
|
|
|
|
qt_internal_install_module_headers(${target}
|
|
|
|
PUBLIC ${module_headers_public} "${module_depends_header}"
|
|
|
|
PRIVATE ${module_headers_private}
|
|
|
|
QPA ${module_headers_qpa}
|
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-04-27 13:16:29 +02:00
|
|
|
RHI ${module_headers_rhi}
|
2023-08-04 16:57:42 +02:00
|
|
|
SSG ${module_headers_ssg}
|
2022-10-05 16:32:31 +02:00
|
|
|
)
|
2022-08-12 19:53:14 +02:00
|
|
|
|
2021-11-03 10:44:38 +01:00
|
|
|
qt_finalize_framework_headers_copy(${target})
|
2020-08-13 17:37:47 +02:00
|
|
|
qt_generate_prl_file(${target} "${INSTALL_LIBDIR}")
|
|
|
|
qt_generate_module_pri_file("${target}" ${ARGN})
|
2021-11-11 14:39:53 -03:00
|
|
|
qt_internal_generate_pkg_config_file(${target})
|
2024-02-12 15:19:56 +01:00
|
|
|
qt_internal_apply_apple_privacy_manifest(${target})
|
CMake: Generate an SPDX v2.3 SBOM file for each built repository
This change adds a new -sbom configure option to allow generating and
installing an SPDX v2.3 SBOM file when building a qt repo.
The -sbom-dir option can be used to configure the location where
each repo sbom file will be installed.
By default it is installed into
$prefix/$archdatadir/sbom/$sbom_lower_project_name.sdpx
which is basically ~/Qt/sbom/qtbase-6.8.0.spdx
The file is installed as part of the default installation rules, but
it can also be installed manually using the "sbom" installation
component, or "sbom_$lower_project_name" in a top-level build. For
example: cmake install . --component sbom_qtbase
CMake 3.19+ is needed to read the qt_attribution.json files for
copyrights, license info, etc. When using an older cmake version,
configuration will error out. It is possible to opt into using an
older cmake version, but the generated sbom will lack all the
attribution file information.
Using an older cmake version is untested and not officially supported.
Implementation notes.
The bulk of the implementation is split into 4 new files:
- QtPublicSbomHelpers.cmake - for Qt-specific collecting, processing
and dispatching the generation of various pieces of the SBOM document
e.g. a SDPX package associated with a target like Core, a SDPX
file entry for each target binary file (per-config shared library,
archive, executable, etc)
- QtPublicSbomGenerationHelpers.cmake - for non-Qt specific
implementation of SPDX generation. This also has some code that was
taken from the cmake-sbom 3rd party project, so it is dual licensed
under the usual Qt build system BSD license, as well as the MIT
license of the 3rd party project
- QtPublicGitHelpers.cmake - for git related features, mainly to embed
queried hashes or tags into version strings, is dual-licensed for
the same reasons as QtPublicSbomGenerationHelpers.cmake
- QtSbomHelpers.cmake - Qt-specific functions that just forward
arguments to the public functions. These are meant to be used in our
Qt CMakeLists.txt instead of the public _qt_internal_add_sbom ones
for naming consistency. These function would mostly be used to
annotate 3rd party libraries with sbom info and to add sbom info
for unusual target setups (like the Bootstrap library), because most
of the handling is already done automatically via
qt_internal_add_module/plugin/etc.
The files are put into Public cmake files, with the future hope of
making this available to user projects in some capacity.
The distinction of Qt-specific and non-Qt specific code might blur a
bit, and thus the separation across files might not always be
consistent, but it was best effort.
The main purpose of the code is to collect various information about
targets and their relationships and generate equivalent SPDX info.
Collection is currently done for the following targets: Qt modules,
plugins, apps, tools, system libraries, bundled 3rd party libraries
and partial 3rd party sources compiled directly as part of Qt targets.
Each target has an equivalent SPDX package generated with information
like version, license, copyright, CPE (common vulnerability
identifier), files that belong to the package, and relationships on
other SPDX packages (associated cmake targets), mostly gathered from
direct linking dependencies.
Each package might also contain files, e.g. libQt6Core.so for the Core
target. Each file also has info like license id, copyrights, but also
the list of source files that were used to generate the file and a
sha1 checksum.
SPDX documents can also refer to packages in other SPDX documents, and
those are referred to via external document references. This is the
case when building qtdeclarative and we refer to Core.
For qt provided targets, we have complete information regarding
licenses, and copyrights.
For bundled 3rd party libraries, we should also have most information,
which is usually parsed from the
src/3rdparty/libfoo/qt_attribution.json files.
If there are multiple attribution files, or if the files have multiple
entries, we create a separate SBOM package for each of those entries,
because each might have a separate copyright or version, and an sbom
package can have only one version (although many copyrights).
For system libraries we usually lack the information because we don't
have attribution files for Find scripts. So the info needs to be
manually annotated via arguments to the sbom function calls, or the
FindFoo.cmake scripts expose that information in some form and we
can query it.
There are also corner cases like 3rdparty sources being directly
included in a Qt library, like the m4dc files for Gui, or PCRE2 for
Bootstrap.
Or QtWebEngine libraries (either Qt bundled or Chromium bundled or
system libraries) which get linked in by GN instead of CMake, so there
are no direct targets for them.
The information for these need to be annotated manually as well.
There is also a distinction to be made for static Qt builds (or any
static Qt library in a shared build), where the system libraries found
during the Qt build might not be the same that are linked into the
final user application or library.
The actual generation of the SBOM is done by file(GENERATE)-ing one
.cmake file for each target, file, external ref, etc, which will be
included in a top-level cmake script.
The top-level cmake script will run through each included file, to
append to a "staging" spdx file, which will then be used in a
configure_file() call to replace some final
variables, like embedding a file checksum.
There are install rules to generate a complete SBOM during
installation, and an optional 'sbom' custom target that allows
building an incomplete SBOM during the build step.
The build target is just for convenience and faster development
iteration time. It is incomplete because it is missing the installed
file SHA1 checksums and the document verification code (the sha1 of
all sha1s). We can't compute those during the build before the files
are actually installed.
A complete SBOM can only be achieved at installation time. The install
script will include all the generated helper files, but also set some
additional variables to ensure checksumming happens, and also handle
multi-config installation, among other small things.
For multi-config builds, CMake doesn't offer a way to run code after
all configs are installed, because they might not always be installed,
someone might choose to install just Release.
To handle that, we rely on ninja installing each config sequentially
(because ninja places the install rules into the 'console' pool which
runs one task at a time).
For each installed config we create a config-specific marker file.
Once all marker files are present, whichever config ends up being
installed as the last one, we run the sbom generation once, and then
delete all marker files.
There are a few internal variables that can be set during
configuration to enable various checks (and other features) on the
generated spdx files:
- QT_INTERNAL_SBOM_VERIFY
- QT_INTERNAL_SBOM_AUDIT
- QT_INTERNAL_SBOM_AUDIT_NO_ERROR
- QT_INTERNAL_SBOM_GENERATE_JSON
- QT_INTERNAL_SBOM_SHOW_TABLE
- QT_INTERNAL_SBOM_DEFAULT_CHECKS
These use 3rd party python tools, so they are not enabled by default.
If enabled, they run at installation time after the sbom is installed.
We will hopefully enable them in CI.
Overall, the code is still a bit messy in a few places, due to time
constraints, but can be improved later.
Some possible TODOs for the future:
- Do we need to handle 3rd party libs linked into a Qt static library
in a Qt shared build, where the Qt static lib is not installed, but
linked into a Qt shared library, somehow specially?
We can record a package for it, but we can't
create a spdx file record for it (and associated source
relationships) because we don't install the file, and spdx requires
the file to be installed and checksummed. Perhaps we can consider
adding some free-form text snippet to the package itself?
- Do we want to add parsing of .cpp source files for Copyrights, to
embed them into the packages? This will likely slow down
configuration quite a bit.
- Currently sbom info attached to WrapFoo packages in one repo is
not exported / available in other repos. E.g. If we annotate
WrapZLIB in qtbase with CPE_VENDOR zlib, this info will not be
available when looking up WrapZLIB in qtimageformats.
This is because they are IMPORTED libraries, and are not
exported. We might want to record this info in the future.
[ChangeLog][Build System] A new -sbom configure option can be used
to generate and install a SPDX SBOM (Software Bill of Materials) file
for each built Qt repository.
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I9c730a6bbc47e02ce1836fccf00a14ec8eb1a5f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-03-07 18:02:56 +01:00
|
|
|
_qt_internal_finalize_sbom(${target})
|
2020-08-13 17:37:47 +02:00
|
|
|
endfunction()
|
|
|
|
|
2021-04-06 18:57:11 +02:00
|
|
|
# Get a set of Qt module related values based on the target.
|
2021-07-30 13:16:10 +02:00
|
|
|
#
|
|
|
|
# The function uses the _qt_module_interface_name and _qt_module_include_name target properties to
|
|
|
|
# preform values for the output variables. _qt_module_interface_name it's the basic name of module
|
|
|
|
# without "Qtfication" and the "Private" suffix if we speak about INTERNAL_MODULEs. Typical value of
|
|
|
|
# the _qt_module_interface_name is the provided to qt_internal_add_module ${target} name, e.g. Core.
|
|
|
|
# _qt_module_interface_name is used to preform all the include paths unless the
|
|
|
|
# _qt_module_include_name property is specified. _qt_module_include_name is legacy property that
|
|
|
|
# replaces the module name in include paths and has a higher priority than the
|
|
|
|
# _qt_module_interface_name property.
|
|
|
|
#
|
|
|
|
# When doing qt_internal_module_info(foo Core) this method will set the following variables in
|
|
|
|
# the caller's scope:
|
2020-08-13 17:37:47 +02:00
|
|
|
# * foo with the value "QtCore"
|
|
|
|
# * foo_versioned with the value "Qt6Core" (based on major Qt version)
|
|
|
|
# * foo_upper with the value "CORE"
|
|
|
|
# * foo_lower with the value "core"
|
2021-07-30 13:16:10 +02:00
|
|
|
# * foo_include_name with the value"QtCore"
|
|
|
|
# Usually the module name from ${foo} is used, but the name might be different if the
|
|
|
|
# MODULE_INCLUDE_NAME argument is set when creating the module.
|
|
|
|
# * foo_versioned_include_dir with the value "QtCore/6.2.0"
|
|
|
|
# * foo_versioned_inner_include_dir with the value "QtCore/6.2.0/QtCore"
|
|
|
|
# * foo_private_include_dir with the value "QtCore/6.2.0/QtCore/private"
|
2022-04-21 17:42:23 +02:00
|
|
|
# * foo_qpa_include_dir with the value "QtCore/6.2.0/QtCore/qpa"
|
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-04-27 13:16:29 +02:00
|
|
|
# * foo_rhi_include_dir with the value "QtCore/6.2.0/QtCore/rhi"
|
2023-08-04 16:57:42 +02:00
|
|
|
# * foo_ssg_include_dir with the value "QtQuick3D/6.2.0/QtQuick3D/ssg"
|
2021-07-09 12:32:11 +02:00
|
|
|
# * foo_interface_name the interface name of the module stored in _qt_module_interface_name
|
2021-07-30 13:16:10 +02:00
|
|
|
# property, e.g. Core.
|
|
|
|
#
|
|
|
|
# The function also sets a bunch of module include paths for the build and install interface.
|
|
|
|
# Variables that contains these paths start with foo_build_interface_ and foo_install_interface_
|
|
|
|
# accordingly.
|
|
|
|
# The following variables are set in the caller's scope:
|
|
|
|
# * foo_<build|install>_interface_include_dir with
|
|
|
|
# qtbase_build_dir/include/QtCore for build interface and
|
|
|
|
# include/QtCore for install interface.
|
|
|
|
# * foo_<build|install>_interface_versioned_include_dir with
|
|
|
|
# qtbase_build_dir/include/QtCore/6.2.0 for build interface and
|
|
|
|
# include/QtCore/6.2.0 for install interface.
|
|
|
|
# * foo_<build|install>_versioned_inner_include_dir with
|
|
|
|
# qtbase_build_dir/include/QtCore/6.2.0/QtCore for build interface and
|
|
|
|
# include/QtCore/6.2.0/QtCore for install interface.
|
|
|
|
# * foo_<build|install>_private_include_dir with
|
|
|
|
# qtbase_build_dir/include/QtCore/6.2.0/QtCore/private for build interface and
|
|
|
|
# include/QtCore/6.2.0/QtCore/private for install interface.
|
2022-04-21 17:42:23 +02:00
|
|
|
# * foo_<build|install>_qpa_include_dir with
|
|
|
|
# qtbase_build_dir/include/QtCore/6.2.0/QtCore/qpa for build interface and
|
|
|
|
# include/QtCore/6.2.0/QtCore/qpa for install interface.
|
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-04-27 13:16:29 +02:00
|
|
|
# * foo_<build|install>_rhi_include_dir with
|
|
|
|
# qtbase_build_dir/include/QtCore/6.2.0/QtCore/rhi for build interface and
|
|
|
|
# include/QtCore/6.2.0/QtCore/rhi for install interface.
|
2023-08-04 16:57:42 +02:00
|
|
|
# * foo_<build|install>_ssg_include_dir with
|
|
|
|
# qtbase_build_dir/include/<module>/x.y.z/<module>/ssg for build interface and
|
|
|
|
# include/<module>/x.y.z/<module>/ssg for install interface.
|
2021-07-30 13:16:10 +02:00
|
|
|
# The following values are set by the function and might be useful in caller's scope:
|
|
|
|
# * repo_install_interface_include_dir contains path to the top-level repository include directory,
|
|
|
|
# e.g. qtbase_build_dir/include
|
|
|
|
# * repo_install_interface_include_dir contains path to the non-prefixed top-level include
|
|
|
|
# directory is used for the installation, e.g. include
|
|
|
|
# Note: that for non-prefixed Qt configurations the build interface paths will start with
|
|
|
|
# <build_directory>/qtbase/include, e.g foo_build_interface_include_dir of the Qml module looks
|
|
|
|
# like qt_toplevel_build_dir/qtbase/include/QtQml
|
2020-08-13 17:37:47 +02:00
|
|
|
function(qt_internal_module_info result target)
|
2021-07-30 13:16:10 +02:00
|
|
|
if(result STREQUAL "repo")
|
|
|
|
message(FATAL_ERROR "'repo' keyword is reserved for internal use, please specify \
|
|
|
|
the different base name for the module info variables.")
|
|
|
|
endif()
|
|
|
|
|
2021-04-06 18:57:11 +02:00
|
|
|
get_target_property(module_interface_name ${target} _qt_module_interface_name)
|
|
|
|
if(NOT module_interface_name)
|
|
|
|
message(FATAL_ERROR "${target} is not a module.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
qt_internal_qtfy_target(module ${module_interface_name})
|
2021-07-30 13:16:10 +02:00
|
|
|
|
|
|
|
get_target_property("${result}_include_name" ${target} _qt_module_include_name)
|
|
|
|
if(NOT ${result}_include_name)
|
|
|
|
set("${result}_include_name" "${module}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set("${result}_versioned_include_dir"
|
|
|
|
"${${result}_include_name}/${PROJECT_VERSION}")
|
|
|
|
set("${result}_versioned_inner_include_dir"
|
|
|
|
"${${result}_versioned_include_dir}/${${result}_include_name}")
|
|
|
|
set("${result}_private_include_dir"
|
|
|
|
"${${result}_versioned_inner_include_dir}/private")
|
2022-04-21 17:42:23 +02:00
|
|
|
set("${result}_qpa_include_dir"
|
|
|
|
"${${result}_versioned_inner_include_dir}/qpa")
|
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-04-27 13:16:29 +02:00
|
|
|
set("${result}_rhi_include_dir"
|
|
|
|
"${${result}_versioned_inner_include_dir}/rhi")
|
2023-08-04 16:57:42 +02:00
|
|
|
set("${result}_ssg_include_dir"
|
|
|
|
"${${result}_versioned_inner_include_dir}/ssg")
|
2021-07-30 13:16:10 +02:00
|
|
|
|
|
|
|
# Module build interface directories
|
|
|
|
set(repo_build_interface_include_dir "${QT_BUILD_DIR}/include")
|
|
|
|
set("${result}_build_interface_include_dir"
|
|
|
|
"${repo_build_interface_include_dir}/${${result}_include_name}")
|
|
|
|
set("${result}_build_interface_versioned_include_dir"
|
|
|
|
"${repo_build_interface_include_dir}/${${result}_versioned_include_dir}")
|
|
|
|
set("${result}_build_interface_versioned_inner_include_dir"
|
|
|
|
"${repo_build_interface_include_dir}/${${result}_versioned_inner_include_dir}")
|
|
|
|
set("${result}_build_interface_private_include_dir"
|
|
|
|
"${repo_build_interface_include_dir}/${${result}_private_include_dir}")
|
2022-04-21 17:42:23 +02:00
|
|
|
set("${result}_build_interface_qpa_include_dir"
|
|
|
|
"${repo_build_interface_include_dir}/${${result}_qpa_include_dir}")
|
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-04-27 13:16:29 +02:00
|
|
|
set("${result}_build_interface_rhi_include_dir"
|
|
|
|
"${repo_build_interface_include_dir}/${${result}_rhi_include_dir}")
|
2023-08-04 16:57:42 +02:00
|
|
|
set("${result}_build_interface_ssg_include_dir"
|
|
|
|
"${repo_build_interface_include_dir}/${${result}_ssg_include_dir}")
|
2021-07-30 13:16:10 +02:00
|
|
|
|
2022-06-10 16:41:59 +02:00
|
|
|
# Module install interface directories
|
2021-07-30 13:16:10 +02:00
|
|
|
set(repo_install_interface_include_dir "${INSTALL_INCLUDEDIR}")
|
|
|
|
set("${result}_install_interface_include_dir"
|
|
|
|
"${repo_install_interface_include_dir}/${${result}_include_name}")
|
|
|
|
set("${result}_install_interface_versioned_include_dir"
|
|
|
|
"${repo_install_interface_include_dir}/${${result}_versioned_include_dir}")
|
|
|
|
set("${result}_install_interface_versioned_inner_include_dir"
|
|
|
|
"${repo_install_interface_include_dir}/${${result}_versioned_inner_include_dir}")
|
|
|
|
set("${result}_install_interface_private_include_dir"
|
|
|
|
"${repo_install_interface_include_dir}/${${result}_private_include_dir}")
|
2022-04-21 17:42:23 +02:00
|
|
|
set("${result}_install_interface_qpa_include_dir"
|
|
|
|
"${repo_install_interface_include_dir}/${${result}_qpa_include_dir}")
|
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-04-27 13:16:29 +02:00
|
|
|
set("${result}_install_interface_rhi_include_dir"
|
|
|
|
"${repo_install_interface_include_dir}/${${result}_rhi_include_dir}")
|
2023-08-04 16:57:42 +02:00
|
|
|
set("${result}_install_interface_ssg_include_dir"
|
|
|
|
"${repo_install_interface_include_dir}/${${result}_ssg_include_dir}")
|
2021-07-30 13:16:10 +02:00
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
set("${result}" "${module}" PARENT_SCOPE)
|
2021-04-06 18:57:11 +02:00
|
|
|
set("${result}_versioned" "${module_versioned}" PARENT_SCOPE)
|
|
|
|
string(TOUPPER "${module_interface_name}" upper)
|
2021-07-30 13:16:10 +02:00
|
|
|
string(TOLOWER "${module_interface_name}" lower)
|
2020-08-13 17:37:47 +02:00
|
|
|
set("${result}_upper" "${upper}" PARENT_SCOPE)
|
|
|
|
set("${result}_lower" "${lower}" PARENT_SCOPE)
|
2021-07-30 13:16:10 +02:00
|
|
|
set("${result}_include_name" "${${result}_include_name}" PARENT_SCOPE)
|
|
|
|
set("${result}_versioned_include_dir" "${${result}_versioned_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_versioned_inner_include_dir"
|
|
|
|
"${${result}_versioned_inner_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_private_include_dir" "${${result}_private_include_dir}" PARENT_SCOPE)
|
2022-04-21 17:42:23 +02:00
|
|
|
set("${result}_qpa_include_dir" "${${result}_qpa_include_dir}" PARENT_SCOPE)
|
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-04-27 13:16:29 +02:00
|
|
|
set("${result}_rhi_include_dir" "${${result}_rhi_include_dir}" PARENT_SCOPE)
|
2023-08-04 16:57:42 +02:00
|
|
|
set("${result}_ssg_include_dir" "${${result}_ssg_include_dir}" PARENT_SCOPE)
|
2021-07-09 12:32:11 +02:00
|
|
|
set("${result}_interface_name" "${module_interface_name}" PARENT_SCOPE)
|
2021-07-30 13:16:10 +02:00
|
|
|
|
|
|
|
# Setting module build interface directories in parent scope
|
|
|
|
set(repo_build_interface_include_dir "${repo_build_interface_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_build_interface_include_dir"
|
|
|
|
"${${result}_build_interface_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_build_interface_versioned_include_dir"
|
|
|
|
"${${result}_build_interface_versioned_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_build_interface_versioned_inner_include_dir"
|
|
|
|
"${${result}_build_interface_versioned_inner_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_build_interface_private_include_dir"
|
|
|
|
"${${result}_build_interface_private_include_dir}" PARENT_SCOPE)
|
2022-04-21 17:42:23 +02:00
|
|
|
set("${result}_build_interface_qpa_include_dir"
|
|
|
|
"${${result}_build_interface_qpa_include_dir}" PARENT_SCOPE)
|
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-04-27 13:16:29 +02:00
|
|
|
set("${result}_build_interface_rhi_include_dir"
|
|
|
|
"${${result}_build_interface_rhi_include_dir}" PARENT_SCOPE)
|
2023-08-04 16:57:42 +02:00
|
|
|
set("${result}_build_interface_ssg_include_dir"
|
|
|
|
"${${result}_build_interface_ssg_include_dir}" PARENT_SCOPE)
|
2021-07-30 13:16:10 +02:00
|
|
|
|
|
|
|
# Setting module install interface directories in parent scope
|
|
|
|
set(repo_install_interface_include_dir "${repo_install_interface_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_install_interface_include_dir"
|
|
|
|
"${${result}_install_interface_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_install_interface_versioned_include_dir"
|
|
|
|
"${${result}_install_interface_versioned_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_install_interface_versioned_inner_include_dir"
|
|
|
|
"${${result}_install_interface_versioned_inner_include_dir}" PARENT_SCOPE)
|
|
|
|
set("${result}_install_interface_private_include_dir"
|
|
|
|
"${${result}_install_interface_private_include_dir}" PARENT_SCOPE)
|
2022-04-21 17:42:23 +02:00
|
|
|
set("${result}_install_interface_qpa_include_dir"
|
|
|
|
"${${result}_install_interface_qpa_include_dir}" PARENT_SCOPE)
|
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-04-27 13:16:29 +02:00
|
|
|
set("${result}_install_interface_rhi_include_dir"
|
|
|
|
"${${result}_install_interface_rhi_include_dir}" PARENT_SCOPE)
|
2023-08-04 16:57:42 +02:00
|
|
|
set("${result}_install_interface_ssg_include_dir"
|
|
|
|
"${${result}_install_interface_ssg_include_dir}" PARENT_SCOPE)
|
2020-08-13 17:37:47 +02:00
|
|
|
endfunction()
|
|
|
|
|
2022-12-08 15:47:27 +01:00
|
|
|
function(qt_internal_list_to_json_array out_var list_var)
|
|
|
|
set(result "")
|
|
|
|
foreach(item IN LISTS ${list_var})
|
|
|
|
if(NOT "${result}" STREQUAL "")
|
|
|
|
string(APPEND result ", ")
|
|
|
|
endif()
|
|
|
|
string(APPEND result "\"${item}\"")
|
|
|
|
endforeach()
|
|
|
|
set("${out_var}" "[${result}]" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2020-08-13 17:37:47 +02:00
|
|
|
# Generate a module description file based on the template in ModuleDescription.json.in
|
|
|
|
function(qt_describe_module target)
|
|
|
|
set(path_suffix "${INSTALL_DESCRIPTIONSDIR}")
|
|
|
|
qt_path_join(build_dir ${QT_BUILD_DIR} ${path_suffix})
|
|
|
|
qt_path_join(install_dir ${QT_INSTALL_DIR} ${path_suffix})
|
|
|
|
|
|
|
|
set(descfile_in "${QT_CMAKE_DIR}/ModuleDescription.json.in")
|
2025-01-23 19:29:17 +01:00
|
|
|
|
|
|
|
# IMPORTANT: If you adjust the file name not to be the exact target name and thus the CMake
|
|
|
|
# package name, it needs to consider also the code in QtConfig.cmake.in that globs the json
|
|
|
|
# files.
|
2020-08-13 17:37:47 +02:00
|
|
|
set(descfile_out "${build_dir}/${target}.json")
|
2025-01-23 19:29:17 +01:00
|
|
|
|
2022-12-08 15:47:27 +01:00
|
|
|
string(TOLOWER "${PROJECT_NAME}" lower_case_project_name)
|
|
|
|
set(extra_module_information "")
|
2024-11-06 14:35:25 +01:00
|
|
|
set(platforms_information "")
|
2022-12-08 15:47:27 +01:00
|
|
|
|
|
|
|
get_target_property(target_type ${target} TYPE)
|
|
|
|
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
|
2023-04-14 15:23:05 +02:00
|
|
|
get_target_property(plugin_types ${target} QMAKE_MODULE_PLUGIN_TYPES)
|
2022-12-08 15:47:27 +01:00
|
|
|
if(plugin_types)
|
|
|
|
qt_internal_list_to_json_array(plugin_types plugin_types)
|
|
|
|
string(APPEND extra_module_information "\n \"plugin_types\": ${plugin_types},")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-11-06 14:35:25 +01:00
|
|
|
# Generate extra module information
|
2022-12-09 17:05:09 +01:00
|
|
|
get_target_property(is_internal ${target} _qt_is_internal_module)
|
|
|
|
if(is_internal)
|
|
|
|
string(APPEND extra_module_information "\n \"internal\": true,")
|
|
|
|
endif()
|
2024-11-06 14:35:25 +01:00
|
|
|
if(APPLE)
|
|
|
|
set(bundle_type "none")
|
|
|
|
if(QT_FEATURE_framework)
|
|
|
|
set(bundle_type "framework")
|
|
|
|
endif()
|
|
|
|
string(APPEND extra_module_information "\n \"bundle_type\": \"framework\",")
|
|
|
|
endif()
|
2023-03-17 17:04:39 +01:00
|
|
|
if(NOT QT_NAMESPACE STREQUAL "")
|
2024-11-06 14:35:25 +01:00
|
|
|
string(APPEND extra_module_information "\n \"namespace\": \"${QT_NAMESPACE}\",")
|
2023-03-17 17:04:39 +01:00
|
|
|
endif()
|
2024-11-06 15:30:45 +01:00
|
|
|
if(target STREQUAL "Gui")
|
|
|
|
qt_internal_list_to_json_array(qpa_platforms_array QT_QPA_PLATFORMS)
|
|
|
|
string(APPEND extra_module_information "
|
|
|
|
\"qpa\": {
|
|
|
|
\"platforms\": ${qpa_platforms_array},
|
|
|
|
\"default_platform\": \"${QT_QPA_DEFAULT_PLATFORM}\"
|
|
|
|
},")
|
|
|
|
endif()
|
2024-11-06 14:35:25 +01:00
|
|
|
|
|
|
|
# Set up indentation helper variables.
|
|
|
|
set(indent1 " ")
|
|
|
|
set(k 1)
|
|
|
|
foreach(i RANGE 2 5)
|
|
|
|
set(indent${i} "${indent${k}}${indent1}")
|
|
|
|
set(k ${i})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Set up the platforms to write.
|
|
|
|
set(nr_of_platforms 1)
|
|
|
|
set(platform_0_name "${CMAKE_SYSTEM_NAME}")
|
|
|
|
set(platform_0_variant "")
|
|
|
|
set(platform_0_architectures "${TEST_architecture_architectures}")
|
|
|
|
|
|
|
|
# Handle iOS builds specially.
|
|
|
|
if(platform_0_name STREQUAL "iOS")
|
|
|
|
if(QT_FEATURE_simulator_and_device)
|
|
|
|
# This must match the setup done in qt_auto_detect_apple.
|
|
|
|
set(nr_of_platforms 2)
|
|
|
|
set(platform_0_name "iOS")
|
|
|
|
set(platform_0_variant "iphoneos")
|
|
|
|
set(platform_0_architectures "arm64")
|
|
|
|
set(platform_1_name "iOS")
|
|
|
|
set(platform_1_variant "iphonesimulator")
|
|
|
|
set(platform_1_architectures "x86_64")
|
|
|
|
elseif(NOT "${QT_APPLE_SDK}" STREQUAL "")
|
|
|
|
# Explicit SDK requested.
|
|
|
|
set(platform_0_variant "${QT_APPLE_SDK}")
|
|
|
|
endif()
|
2022-12-06 16:12:12 +01:00
|
|
|
endif()
|
2020-08-13 17:37:47 +02:00
|
|
|
|
2024-11-06 14:35:25 +01:00
|
|
|
# Write platform information. At the moment, we write exactly one platform. With xcframeworks
|
|
|
|
# for example, we'd support multiple platforms.
|
|
|
|
math(EXPR last_platform_idx "${nr_of_platforms} - 1")
|
|
|
|
foreach(i RANGE 0 ${last_platform_idx})
|
|
|
|
# Write target architecture information.
|
|
|
|
set(platform_name "${platform_${i}_name}")
|
|
|
|
set(platform_variant "${platform_${i}_variant}")
|
|
|
|
set(platform_architectures "${platform_${i}_architectures}")
|
|
|
|
set(targets_information "")
|
|
|
|
foreach(architecture IN LISTS platform_architectures)
|
|
|
|
if(NOT targets_information STREQUAL "")
|
|
|
|
string(APPEND targets_information ",")
|
|
|
|
endif()
|
|
|
|
string(APPEND targets_information "\n${indent4}{\n")
|
|
|
|
if(NOT QT_FEATURE_shared)
|
|
|
|
string(APPEND targets_information "${indent5}\"static\": true,\n")
|
|
|
|
endif()
|
|
|
|
if(ANDROID)
|
|
|
|
string(APPEND targets_information
|
|
|
|
"${indent5}\"api_version\": \"${QT_ANDROID_API_USED_FOR_JAVA}\",
|
|
|
|
${indent5}\"ndk_version\": \"${ANDROID_NDK_REVISION}\",\n")
|
|
|
|
endif()
|
|
|
|
string(APPEND targets_information "${indent5}\"architecture\": \"${architecture}\",\n")
|
|
|
|
string(APPEND targets_information "${indent5}\"abi\": \"${TEST_arch_${architecture}_abi}\"\n")
|
|
|
|
string(APPEND targets_information "${indent4}}")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(i GREATER 0)
|
|
|
|
string(APPEND platforms_information ",")
|
|
|
|
endif()
|
|
|
|
string(APPEND platforms_information "
|
|
|
|
${indent2}{
|
|
|
|
${indent3}\"name\": \"${platform_name}\",")
|
|
|
|
if(NOT platform_variant STREQUAL "")
|
|
|
|
string(APPEND platforms_information "
|
|
|
|
${indent3}\"variant\": \"${platform_variant}\",")
|
|
|
|
endif()
|
|
|
|
if(NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "")
|
|
|
|
string(APPEND platforms_information "
|
|
|
|
${indent3}\"version\": \"${CMAKE_SYSTEM_VERSION}\",")
|
|
|
|
endif()
|
|
|
|
string(APPEND platforms_information "
|
|
|
|
${indent3}\"compiler_id\": \"${CMAKE_CXX_COMPILER_ID}\",
|
|
|
|
${indent3}\"compiler_version\": \"${CMAKE_CXX_COMPILER_VERSION}\",
|
|
|
|
${indent3}\"targets\": [${targets_information}
|
|
|
|
${indent3}]
|
|
|
|
${indent2}}")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
configure_file("${descfile_in}" "${descfile_out}")
|
2020-08-13 17:37:47 +02:00
|
|
|
qt_install(FILES "${descfile_out}" DESTINATION "${install_dir}")
|
|
|
|
endfunction()
|
2021-06-22 17:37:55 +02:00
|
|
|
|
2021-09-14 17:45:22 +02:00
|
|
|
function(qt_internal_generate_cpp_global_exports target module_define_infix)
|
2021-06-22 17:37:55 +02:00
|
|
|
cmake_parse_arguments(arg
|
2023-11-23 12:13:02 +01:00
|
|
|
""
|
2021-09-10 17:24:43 +02:00
|
|
|
"CPP_EXPORT_HEADER_BASE_NAME"
|
|
|
|
"" ${ARGN}
|
2021-07-30 17:51:07 +02:00
|
|
|
)
|
|
|
|
|
2021-06-22 17:37:55 +02:00
|
|
|
qt_internal_module_info(module "${target}")
|
2021-07-30 17:51:07 +02:00
|
|
|
|
|
|
|
set(header_base_name "qt${module_lower}exports")
|
|
|
|
if(arg_CPP_EXPORT_HEADER_BASE_NAME)
|
|
|
|
set(header_base_name "${arg_CPP_EXPORT_HEADER_BASE_NAME}")
|
2021-06-22 17:37:55 +02:00
|
|
|
endif()
|
2021-07-30 17:51:07 +02:00
|
|
|
# Is used as a part of the header guard define.
|
|
|
|
string(TOUPPER "${header_base_name}" header_base_name_upper)
|
2021-06-22 17:37:55 +02:00
|
|
|
|
|
|
|
set(generated_header_path
|
2021-07-30 17:51:07 +02:00
|
|
|
"${module_build_interface_include_dir}/${header_base_name}.h"
|
2021-06-22 17:37:55 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
configure_file("${QT_CMAKE_DIR}/modulecppexports.h.in"
|
|
|
|
"${generated_header_path}" @ONLY
|
|
|
|
)
|
|
|
|
|
2021-07-30 17:51:07 +02:00
|
|
|
set(${out_public_header} "${generated_header_path}" PARENT_SCOPE)
|
2021-06-22 17:37:55 +02:00
|
|
|
target_sources(${target} PRIVATE "${generated_header_path}")
|
2025-01-06 19:08:39 +01:00
|
|
|
_qt_internal_set_source_file_generated(
|
|
|
|
SOURCES "${generated_header_path}"
|
|
|
|
CONFIGURE_GENERATED
|
|
|
|
)
|
2025-02-04 14:01:24 +01:00
|
|
|
# Make sure the file is installed when processed by `qt_internal_collect_module_headers`
|
|
|
|
set_source_files_properties("${generated_header_path}" PROPERTIES _qt_syncqt_force_include TRUE)
|
2021-06-22 17:37:55 +02:00
|
|
|
endfunction()
|
2022-08-12 19:53:14 +02:00
|
|
|
|
|
|
|
function(qt_internal_install_module_headers target)
|
|
|
|
set(options)
|
|
|
|
set(one_value_args)
|
2023-08-04 16:57:42 +02:00
|
|
|
set(multi_value_args PUBLIC PRIVATE QPA RHI SSG)
|
2022-08-12 19:53:14 +02:00
|
|
|
cmake_parse_arguments(arg "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
|
|
|
|
|
|
|
|
qt_internal_module_info(module ${target})
|
|
|
|
|
|
|
|
get_target_property(target_type ${target} TYPE)
|
|
|
|
set(is_interface_lib FALSE)
|
|
|
|
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
|
|
|
set(is_interface_lib TRUE)
|
|
|
|
else()
|
|
|
|
get_target_property(is_framework ${target} FRAMEWORK)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
foreach(header_type IN LISTS multi_value_args)
|
|
|
|
if(NOT arg_${header_type})
|
|
|
|
set(arg_${header_type} "")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(is_framework)
|
|
|
|
qt_copy_framework_headers(${target}
|
|
|
|
PUBLIC ${arg_PUBLIC}
|
|
|
|
PRIVATE ${arg_PRIVATE}
|
|
|
|
QPA ${arg_QPA}
|
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-04-27 13:16:29 +02:00
|
|
|
RHI ${arg_RHI}
|
2023-10-10 14:47:13 +02:00
|
|
|
SSG ${arg_SSG}
|
2022-08-12 19:53:14 +02:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
if(arg_PUBLIC)
|
|
|
|
qt_install(FILES ${arg_PUBLIC}
|
|
|
|
DESTINATION "${module_install_interface_include_dir}")
|
|
|
|
endif()
|
|
|
|
if(arg_PRIVATE)
|
|
|
|
qt_install(FILES ${arg_PRIVATE}
|
|
|
|
DESTINATION "${module_install_interface_private_include_dir}")
|
|
|
|
endif()
|
2022-08-15 18:29:41 +02:00
|
|
|
if(arg_QPA)
|
|
|
|
qt_install(FILES ${arg_QPA} DESTINATION "${module_install_interface_qpa_include_dir}")
|
|
|
|
endif()
|
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-04-27 13:16:29 +02:00
|
|
|
if(arg_RHI)
|
|
|
|
qt_install(FILES ${arg_RHI} DESTINATION "${module_install_interface_rhi_include_dir}")
|
|
|
|
endif()
|
2023-08-04 16:57:42 +02:00
|
|
|
if(arg_SSG)
|
|
|
|
qt_install(FILES ${arg_SSG} DESTINATION "${module_install_interface_ssg_include_dir}")
|
|
|
|
endif()
|
2022-08-12 19:53:14 +02:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(qt_internal_collect_module_headers out_var target)
|
|
|
|
set(${out_var}_public "")
|
|
|
|
set(${out_var}_private "")
|
2025-03-20 15:39:02 +01:00
|
|
|
set(${out_var}_exclude_from_docs "")
|
2022-08-12 19:53:14 +02:00
|
|
|
set(${out_var}_qpa "")
|
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-04-27 13:16:29 +02:00
|
|
|
set(${out_var}_rhi "")
|
2023-08-04 16:57:42 +02:00
|
|
|
set(${out_var}_ssg "")
|
2022-08-15 18:29:41 +02:00
|
|
|
set(${out_var}_all "")
|
2022-08-12 19:53:14 +02:00
|
|
|
|
|
|
|
qt_internal_get_target_sources(sources ${target})
|
|
|
|
|
2023-03-30 16:54:49 +02:00
|
|
|
get_target_property(target_type ${target} TYPE)
|
|
|
|
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
|
|
|
set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}")
|
2023-08-16 17:01:23 +02:00
|
|
|
set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}")
|
2023-03-30 16:54:49 +02:00
|
|
|
else()
|
|
|
|
get_target_property(source_dir ${target} SOURCE_DIR)
|
2023-08-16 17:01:23 +02:00
|
|
|
get_target_property(binary_dir ${target} BINARY_DIR)
|
2023-03-30 16:54:49 +02:00
|
|
|
endif()
|
|
|
|
get_filename_component(source_dir "${source_dir}" ABSOLUTE)
|
2023-08-16 17:01:23 +02:00
|
|
|
get_filename_component(binary_dir "${binary_dir}" ABSOLUTE)
|
2023-03-30 16:54:49 +02:00
|
|
|
|
|
|
|
get_target_property(is_3rdparty_library ${target} _qt_module_is_3rdparty_header_library)
|
|
|
|
|
2022-08-12 19:53:14 +02:00
|
|
|
get_target_property(public_filter ${target} _qt_module_public_headers_filter_regex)
|
|
|
|
get_target_property(private_filter ${target} _qt_module_private_headers_filter_regex)
|
|
|
|
get_target_property(qpa_filter ${target} _qt_module_qpa_headers_filter_regex)
|
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-04-27 13:16:29 +02:00
|
|
|
get_target_property(rhi_filter ${target} _qt_module_rhi_headers_filter_regex)
|
2023-08-04 16:57:42 +02:00
|
|
|
get_target_property(ssg_filter ${target} _qt_module_ssg_headers_filter_regex)
|
2022-08-12 19:53:14 +02:00
|
|
|
|
2022-11-03 16:38:51 +01:00
|
|
|
set(condition_independent_headers_warning "")
|
2022-09-21 13:30:37 +02:00
|
|
|
foreach(file_path IN LISTS sources)
|
|
|
|
get_filename_component(file_name "${file_path}" NAME)
|
2022-08-12 19:53:14 +02:00
|
|
|
if(NOT file_name MATCHES ".+\\.h$")
|
|
|
|
continue()
|
|
|
|
endif()
|
2023-03-30 16:54:49 +02:00
|
|
|
|
|
|
|
get_source_file_property(non_module_header ${file_path} _qt_non_module_header)
|
|
|
|
if(non_module_header)
|
|
|
|
continue()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
get_filename_component(file_path "${file_path}" ABSOLUTE)
|
|
|
|
|
2025-02-04 13:56:23 +01:00
|
|
|
_qt_internal_path_is_prefix(source_dir "${file_path}" is_inside_module_source_dir)
|
2023-03-30 16:54:49 +02:00
|
|
|
|
2025-02-04 14:01:24 +01:00
|
|
|
get_source_file_property(forced_include "${file_path}" _qt_syncqt_force_include)
|
2023-03-30 16:54:49 +02:00
|
|
|
get_source_file_property(is_generated "${file_path}" GENERATED)
|
2025-02-04 14:01:24 +01:00
|
|
|
# Skip all header files outside the module source directory, except the generated files,
|
|
|
|
# or files explicitly marked to be included for syncqt.
|
|
|
|
if(NOT (forced_include OR is_inside_module_source_dir OR is_generated))
|
2023-03-30 16:54:49 +02:00
|
|
|
continue()
|
|
|
|
endif()
|
|
|
|
|
2022-11-03 16:38:51 +01:00
|
|
|
get_source_file_property(condition ${file_path} _qt_extend_target_condition)
|
|
|
|
if(NOT condition STREQUAL "" AND NOT condition STREQUAL "NOTFOUND")
|
|
|
|
list(JOIN condition " " condition_string)
|
|
|
|
string(APPEND condition_independent_headers_warning
|
|
|
|
"\nFile:\n ${file_path}"
|
|
|
|
"\nCondition:\n ${condition_string}")
|
|
|
|
endif()
|
|
|
|
|
2025-02-04 13:56:23 +01:00
|
|
|
if(is_inside_module_source_dir)
|
2023-08-16 17:01:23 +02:00
|
|
|
set(base_dir "${source_dir}")
|
2025-02-04 13:56:23 +01:00
|
|
|
else()
|
|
|
|
set(base_dir "${binary_dir}")
|
2023-08-16 17:01:23 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
file(RELATIVE_PATH file_path_rel "${base_dir}" "${file_path}")
|
|
|
|
if(file_path_rel MATCHES "3rdparty/.+" AND NOT is_3rdparty_library)
|
2023-03-30 16:54:49 +02:00
|
|
|
set(is_3rdparty_header TRUE)
|
|
|
|
else()
|
|
|
|
set(is_3rdparty_header FALSE)
|
|
|
|
endif()
|
2022-09-21 13:30:37 +02:00
|
|
|
list(APPEND ${out_var}_all "${file_path}")
|
2025-03-20 15:39:02 +01:00
|
|
|
|
|
|
|
get_source_file_property(exclude_from_docs "${file_path}" _qt_syncqt_exclude_from_docs)
|
|
|
|
if(exclude_from_docs)
|
|
|
|
list(APPEND ${out_var}_exclude_from_docs "${file_path}")
|
|
|
|
endif()
|
|
|
|
|
2022-09-21 13:30:37 +02:00
|
|
|
if(qpa_filter AND file_name MATCHES "${qpa_filter}")
|
|
|
|
list(APPEND ${out_var}_qpa "${file_path}")
|
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-04-27 13:16:29 +02:00
|
|
|
elseif(rhi_filter AND file_name MATCHES "${rhi_filter}")
|
|
|
|
list(APPEND ${out_var}_rhi "${file_path}")
|
2023-08-04 16:57:42 +02:00
|
|
|
elseif(ssg_filter AND file_name MATCHES "${ssg_filter}")
|
|
|
|
list(APPEND ${out_var}_ssg "${file_path}")
|
2022-09-21 13:30:37 +02:00
|
|
|
elseif(private_filter AND file_name MATCHES "${private_filter}")
|
|
|
|
list(APPEND ${out_var}_private "${file_path}")
|
2023-03-30 16:54:49 +02:00
|
|
|
elseif((NOT public_filter OR file_name MATCHES "${public_filter}")
|
|
|
|
AND NOT is_3rdparty_header)
|
2022-09-21 13:30:37 +02:00
|
|
|
list(APPEND ${out_var}_public "${file_path}")
|
2022-08-12 19:53:14 +02:00
|
|
|
endif()
|
2022-08-15 18:29:41 +02:00
|
|
|
if(is_generated)
|
|
|
|
list(APPEND ${out_var}_generated "${file_path}")
|
|
|
|
endif()
|
2022-08-12 19:53:14 +02:00
|
|
|
endforeach()
|
|
|
|
|
2022-11-03 16:38:51 +01:00
|
|
|
if(NOT condition_independent_headers_warning STREQUAL "" AND QT_FEATURE_developer_build)
|
|
|
|
message(AUTHOR_WARNING "Condition is ignored when adding the following header file(s) to"
|
|
|
|
" the ${target} module:"
|
|
|
|
"${condition_independent_headers_warning}"
|
|
|
|
"\nThe usage of the file(s) is not properly isolated in this or other modules according"
|
|
|
|
" to the condition. This warning is for the Qt maintainers. Please make sure that file"
|
|
|
|
" include(s) are guarded with the appropriate macros in the Qt code. If files should be"
|
|
|
|
" added to the module unconditionally, please move them to the common SOURCES section"
|
|
|
|
" in the qt_internal_add_module call.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2023-08-04 16:57:42 +02:00
|
|
|
set(header_types public private qpa rhi ssg)
|
2022-08-12 19:53:14 +02:00
|
|
|
set(has_header_types_properties "")
|
|
|
|
foreach(header_type IN LISTS header_types)
|
|
|
|
get_target_property(current_propety_value ${target} _qt_module_has_${header_type}_headers)
|
|
|
|
if(${out_var}_${header_type})
|
|
|
|
list(APPEND has_header_types_properties
|
|
|
|
_qt_module_has_${header_type}_headers TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(${out_var}_${header_type} "${${out_var}_${header_type}}" PARENT_SCOPE)
|
|
|
|
endforeach()
|
2022-08-15 18:29:41 +02:00
|
|
|
set(${out_var}_all "${${out_var}_all}" PARENT_SCOPE)
|
|
|
|
set(${out_var}_generated "${${out_var}_generated}" PARENT_SCOPE)
|
2025-03-20 15:39:02 +01:00
|
|
|
set(${out_var}_exclude_from_docs "${${out_var}_exclude_from_docs}" PARENT_SCOPE)
|
2022-08-12 19:53:14 +02:00
|
|
|
|
|
|
|
if(has_header_types_properties)
|
|
|
|
set_target_properties(${target} PROPERTIES ${has_header_types_properties})
|
|
|
|
endif()
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY
|
|
|
|
EXPORT_PROPERTIES
|
|
|
|
_qt_module_has_public_headers
|
|
|
|
_qt_module_has_private_headers
|
|
|
|
_qt_module_has_qpa_headers
|
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-04-27 13:16:29 +02:00
|
|
|
_qt_module_has_rhi_headers
|
2023-08-04 16:57:42 +02:00
|
|
|
_qt_module_has_ssg_headers
|
2022-08-12 19:53:14 +02:00
|
|
|
)
|
|
|
|
endfunction()
|
2025-05-22 15:59:58 +02:00
|
|
|
|
|
|
|
# Set the value of the respective module properties and make the properties
|
|
|
|
# transitive. The property is not stored as target property, but is set as
|
|
|
|
# INTERFACE property, so its value is not considered by target itself, but only
|
|
|
|
# by depending targets. Also this require all properties have the
|
|
|
|
# INTERFACE_<property_name> name format.
|
|
|
|
#
|
|
|
|
# Synopsis
|
|
|
|
# qt_internal_set_module_transitive_properties(<target>
|
|
|
|
# PROPERTIES <prop1> <value1> [<prop2> <value2>] ...
|
|
|
|
# )
|
|
|
|
#
|
|
|
|
# Arguments
|
|
|
|
#
|
|
|
|
# `target` Qt module target. Unlike CMake set_target_properties this function
|
|
|
|
# accepts only one target as argument.
|
|
|
|
#
|
|
|
|
# `PROPERTIES` List of the property name-value pairs.
|
|
|
|
#
|
|
|
|
# `TYPE` The transitive property type: COMPILE or LINK.
|
|
|
|
function(qt_internal_set_module_transitive_properties target)
|
|
|
|
cmake_parse_arguments(PARSE_ARGV 1 arg "" "TYPE" "PROPERTIES")
|
|
|
|
|
|
|
|
if(NOT arg_PROPERTIES)
|
|
|
|
message(FATAL_ERROR "PROPERTIES argument is missing.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT arg_TYPE)
|
|
|
|
message(FATAL_ERROR "TYPE argument is missing.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(LENGTH arg_PROPERTIES count)
|
|
|
|
math(EXPR even_args_count "${count} % 2")
|
|
|
|
if(NOT even_args_count EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Insufficient number of PROPERTIES values.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
_qt_internal_dealias_target(target)
|
|
|
|
|
|
|
|
set(property_names "")
|
|
|
|
set(internal_property_names "")
|
|
|
|
|
|
|
|
math(EXPR last "${count} - 1")
|
|
|
|
foreach(name_idx RANGE 0 ${last} 2)
|
|
|
|
list(GET arg_PROPERTIES ${name_idx} interface_property_name)
|
|
|
|
if(interface_property_name MATCHES "^INTERFACE_(.+)$")
|
|
|
|
set(property_name "${CMAKE_MATCH_1}")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Incorrect property name ${interface_property_name}. The property"
|
|
|
|
" name must have the INTERFACE_ prefix. Use regular set_target_properties call to set"
|
|
|
|
" the non-transitive property.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
string(TOLOWER "${property_name}" property_name_lower)
|
|
|
|
list(APPEND property_names ${property_name})
|
|
|
|
|
|
|
|
math(EXPR value_idx "${name_idx} + 1")
|
|
|
|
list(GET arg_PROPERTIES ${value_idx} property_value)
|
|
|
|
|
|
|
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
|
|
|
|
# The collected interface properties exposed in module build tree and have the
|
|
|
|
# same transitive capabilities as after the module is installed. Supported for
|
|
|
|
# CMake version >= 3.30
|
|
|
|
set_property(TARGET ${target} PROPERTY ${interface_property_name} "${property_value}")
|
|
|
|
else()
|
|
|
|
# Internal properties are exported within the Qt module. They have limitations that
|
|
|
|
# EXPORT_PROPERTIES apply. These properties are exported even if we are building Qt
|
|
|
|
# with CMake versions that do not support transitive properties. It allows using
|
|
|
|
# them as transitive properties in user projects if CMake allows this.
|
|
|
|
list(APPEND internal_property_names _qt_internal_${property_name_lower})
|
|
|
|
set_property(TARGET ${target} PROPERTY
|
|
|
|
_qt_internal_${property_name_lower} "${property_value}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
_qt_internal_add_transitive_property(${target} ${arg_TYPE} ${property_name})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
get_target_property(transitive_properties ${target} _qt_transitive_${type_lower}_properties)
|
|
|
|
if(NOT transitive_properties)
|
|
|
|
set(transitive_properties "")
|
|
|
|
endif()
|
|
|
|
list(APPEND transitive_properties ${property_names})
|
|
|
|
list(REMOVE_DUPLICATES transitive_properties)
|
|
|
|
|
|
|
|
get_target_property(export_properties ${target} EXPORT_PROPERTIES)
|
|
|
|
if(NOT export_properties)
|
|
|
|
set(export_properties "")
|
|
|
|
endif()
|
|
|
|
list(APPEND export_properties ${internal_property_names})
|
|
|
|
list(REMOVE_DUPLICATES export_properties)
|
|
|
|
|
|
|
|
string(TOLOWER "${arg_TYPE}" type_lower)
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
EXPORT_PROPERTIES "${export_properties}"
|
|
|
|
_qt_transitive_${type_lower}_properties "${transitive_properties}"
|
|
|
|
)
|
|
|
|
endfunction()
|