2022-07-05 11:26:52 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
2022-08-19 13:21:34 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2022-07-05 11:26:52 +00:00
|
|
|
|
2022-08-15 16:29:41 +00:00
|
|
|
# The function generates the Qt module header structure in build directory and creates install
|
|
|
|
# rules. Apart the lists of header files the function takes into account
|
|
|
|
# QT_REPO_PUBLIC_NAMESPACE_REGEX cache variable, that can be set by repository in .cmake.conf file.
|
|
|
|
# The variable tells the syncqt program, what namespaces are treated as public. Symbols in public
|
|
|
|
# namespaces are considered when generating CaMeL case header files.
|
|
|
|
function(qt_internal_target_sync_headers target module_headers module_headers_generated)
|
|
|
|
if(NOT TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::syncqt)
|
|
|
|
message(FATAL_ERROR "${QT_CMAKE_EXPORT_NAMESPACE}::syncqt is not a target.")
|
|
|
|
endif()
|
|
|
|
get_target_property(has_headers ${target} _qt_module_has_headers)
|
|
|
|
if(NOT has_headers)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
qt_internal_module_info(module "${target}")
|
|
|
|
|
|
|
|
get_target_property(sync_source_directory ${target} _qt_sync_source_directory)
|
|
|
|
set(syncqt_timestamp "${CMAKE_CURRENT_BINARY_DIR}/${target}_syncqt_timestamp")
|
|
|
|
set(syncqt_outputs "${syncqt_timestamp}")
|
|
|
|
|
|
|
|
set(is_interface_lib FALSE)
|
|
|
|
get_target_property(type ${target} TYPE)
|
|
|
|
if(type STREQUAL "INTERFACE_LIBRARY")
|
|
|
|
set(is_interface_lib TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(version_script_private_content_file "")
|
|
|
|
if(NOT is_interface_lib)
|
|
|
|
list(APPEND syncqt_outputs
|
|
|
|
"${module_build_interface_include_dir}/${module}Version"
|
|
|
|
"${module_build_interface_include_dir}/qt${module_lower}version.h")
|
|
|
|
if(TEST_ld_version_script)
|
|
|
|
set(version_script_private_content_file
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${target}.version.private_content")
|
|
|
|
set(version_script_args
|
|
|
|
"-versionScript" "${version_script_private_content_file}")
|
|
|
|
list(APPEND syncqt_outputs "${version_script_private_content_file}")
|
|
|
|
qt_internal_add_linker_version_script(${target}
|
|
|
|
PRIVATE_CONTENT_FILE "${version_script_private_content_file}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Check for _qt_module_is_3rdparty_header_library flag to detect non-Qt modules and
|
|
|
|
# indicate this to syncqt.
|
|
|
|
get_target_property(is_3rd_party_library ${target} _qt_module_is_3rdparty_header_library)
|
|
|
|
set(non_qt_module_argument "")
|
|
|
|
if(is_3rd_party_library)
|
|
|
|
set(non_qt_module_argument "-nonQt")
|
|
|
|
else()
|
|
|
|
list(APPEND syncqt_outputs "${module_build_interface_include_dir}/${module}")
|
2022-10-24 16:35:12 +00:00
|
|
|
get_target_property(no_headersclean_check ${target} _qt_no_headersclean_check)
|
|
|
|
if(NOT no_headersclean_check)
|
2022-08-15 16:29:41 +00:00
|
|
|
list(APPEND syncqt_outputs
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${module}_header_check_exceptions")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(is_framework FALSE)
|
|
|
|
if(NOT is_interface_lib)
|
|
|
|
get_target_property(is_framework ${target} FRAMEWORK)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
qt_internal_get_qt_all_known_modules(known_modules)
|
|
|
|
|
|
|
|
get_target_property(is_internal_module ${target} _qt_is_internal_module)
|
|
|
|
set(internal_module_argument "")
|
|
|
|
if(is_internal_module)
|
|
|
|
set(internal_module_argument "-internal")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
get_target_property(qpa_filter_regex ${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 11:16:29 +00:00
|
|
|
get_target_property(rhi_filter_regex ${target} _qt_module_rhi_headers_filter_regex)
|
2023-08-04 14:57:42 +00:00
|
|
|
get_target_property(ssg_filter_regex ${target} _qt_module_ssg_headers_filter_regex)
|
2022-08-15 16:29:41 +00:00
|
|
|
get_target_property(private_filter_regex ${target} _qt_module_private_headers_filter_regex)
|
|
|
|
|
|
|
|
# We need to use the real paths since otherwise it may lead to the invalid work of the
|
|
|
|
# std::filesystem API
|
|
|
|
get_filename_component(source_dir_real "${sync_source_directory}" REALPATH)
|
|
|
|
get_filename_component(binary_dir_real "${CMAKE_CURRENT_BINARY_DIR}" REALPATH)
|
|
|
|
|
|
|
|
if(QT_REPO_PUBLIC_NAMESPACE_REGEX)
|
|
|
|
set(public_namespaces_filter -publicNamespaceFilter "${QT_REPO_PUBLIC_NAMESPACE_REGEX}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(qpa_filter_regex)
|
|
|
|
set(qpa_filter_argument
|
|
|
|
-qpaHeadersFilter "${qpa_filter_regex}"
|
|
|
|
)
|
|
|
|
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 11:16:29 +00:00
|
|
|
if(rhi_filter_regex)
|
|
|
|
set(rhi_filter_argument
|
|
|
|
-rhiHeadersFilter "${rhi_filter_regex}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2023-08-04 14:57:42 +00:00
|
|
|
if(ssg_filter_regex)
|
|
|
|
set(ssg_filter_argument
|
|
|
|
-ssgHeadersFilter "${ssg_filter_regex}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-08-15 16:29:41 +00:00
|
|
|
set(common_syncqt_arguments
|
|
|
|
-module "${module}"
|
|
|
|
-sourceDir "${source_dir_real}"
|
|
|
|
-binaryDir "${binary_dir_real}"
|
|
|
|
-privateHeadersFilter "${private_filter_regex}"
|
|
|
|
-includeDir "${module_build_interface_include_dir}"
|
|
|
|
-privateIncludeDir "${module_build_interface_private_include_dir}"
|
|
|
|
-qpaIncludeDir "${module_build_interface_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 11:16:29 +00:00
|
|
|
-rhiIncludeDir "${module_build_interface_rhi_include_dir}"
|
2023-08-04 14:57:42 +00:00
|
|
|
-ssgIncludeDir "${module_build_interface_ssg_include_dir}"
|
2023-03-30 12:46:16 +00:00
|
|
|
-generatedHeaders ${module_headers_generated}
|
2022-08-15 16:29:41 +00:00
|
|
|
${qpa_filter_argument}
|
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 11:16:29 +00:00
|
|
|
${rhi_filter_argument}
|
2023-08-04 14:57:42 +00:00
|
|
|
${ssg_filter_argument}
|
2022-08-15 16:29:41 +00:00
|
|
|
${public_namespaces_filter}
|
|
|
|
${non_qt_module_argument}
|
|
|
|
${internal_module_argument}
|
|
|
|
)
|
|
|
|
|
|
|
|
if(QT_INTERNAL_ENABLE_SYNCQT_DEBUG_OUTPUT)
|
|
|
|
list(APPEND common_syncqt_arguments -debug)
|
|
|
|
endif()
|
|
|
|
|
2022-09-30 10:46:18 +00:00
|
|
|
set(build_time_syncqt_arguments "")
|
|
|
|
if(WARNINGS_ARE_ERRORS)
|
2022-11-02 16:05:40 +00:00
|
|
|
if(is_interface_lib)
|
|
|
|
set(warnings_are_errors_enabled_genex 1)
|
|
|
|
else()
|
|
|
|
set(warnings_are_errors_enabled_genex
|
|
|
|
"$<NOT:$<BOOL:$<TARGET_PROPERTY:${target},QT_SKIP_WARNINGS_ARE_ERRORS>>>")
|
|
|
|
endif()
|
|
|
|
list(APPEND build_time_syncqt_arguments
|
|
|
|
"$<${warnings_are_errors_enabled_genex}:-warningsAreErrors>")
|
2022-09-30 10:46:18 +00:00
|
|
|
endif()
|
2022-08-15 16:29:41 +00:00
|
|
|
|
|
|
|
if(is_framework)
|
|
|
|
list(REMOVE_ITEM module_headers "${CMAKE_CURRENT_BINARY_DIR}/${target}_fake_header.h")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Filter the generated ui_ header files and header files located in the 'doc/' subdirectory.
|
|
|
|
list(FILTER module_headers EXCLUDE REGEX
|
|
|
|
"(.+/(ui_)[^/]+\\.h|${CMAKE_CURRENT_SOURCE_DIR}(/.+)?/doc/+\\.h)")
|
|
|
|
|
2022-12-28 14:10:53 +00:00
|
|
|
set(syncqt_staging_dir "${module_build_interface_include_dir}/.syncqt_staging")
|
2022-08-15 16:29:41 +00:00
|
|
|
|
2022-12-28 14:10:53 +00:00
|
|
|
set(syncqt_args "${common_syncqt_arguments}")
|
|
|
|
list(APPEND syncqt_args
|
|
|
|
-headers ${module_headers}
|
|
|
|
-stagingDir "${syncqt_staging_dir}"
|
|
|
|
-knownModules ${known_modules}
|
|
|
|
${version_script_args}
|
|
|
|
)
|
|
|
|
list(JOIN syncqt_args "\n" syncqt_args_string)
|
|
|
|
set(syncqt_args_rsp "${binary_dir_real}/${target}_syncqt_args")
|
2023-01-11 13:02:13 +00:00
|
|
|
qt_configure_file(OUTPUT "${syncqt_args_rsp}" CONTENT "${syncqt_args_string}")
|
2022-08-15 16:29:41 +00:00
|
|
|
|
2023-06-08 14:20:47 +00:00
|
|
|
get_target_property(external_headers_dir ${target} _qt_external_headers_dir)
|
|
|
|
if(external_headers_dir)
|
|
|
|
if(NOT IS_ABSOLUTE "${external_headers_dir}")
|
|
|
|
get_filename_component(external_headers_dir "${external_headers_dir}" ABSOLUTE)
|
|
|
|
endif()
|
|
|
|
if(EXISTS "${external_headers_dir}")
|
|
|
|
set(external_headers_dir_copy_cmd
|
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND}
|
|
|
|
-E copy_directory
|
|
|
|
"${external_headers_dir}"
|
|
|
|
"${module_build_interface_include_dir}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
2022-08-15 16:29:41 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
${syncqt_outputs}
|
|
|
|
COMMAND
|
|
|
|
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
|
2022-12-28 14:10:53 +00:00
|
|
|
"@${syncqt_args_rsp}"
|
2022-09-30 10:46:18 +00:00
|
|
|
${build_time_syncqt_arguments}
|
2023-06-08 14:20:47 +00:00
|
|
|
${external_headers_dir_copy_cmd}
|
2022-08-15 16:29:41 +00:00
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND} -E touch "${syncqt_timestamp}"
|
|
|
|
DEPENDS
|
2022-12-28 14:10:53 +00:00
|
|
|
${syncqt_args_rsp}
|
2022-08-15 16:29:41 +00:00
|
|
|
${module_headers}
|
|
|
|
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
|
2023-05-25 17:32:12 +00:00
|
|
|
"$<GENEX_EVAL:$<TARGET_PROPERTY:${target},_qt_internal_sync_headers_deps>>"
|
2022-08-15 16:29:41 +00:00
|
|
|
COMMENT
|
|
|
|
"Running syncqt.cpp for module: ${module}"
|
|
|
|
VERBATIM
|
|
|
|
)
|
2023-07-06 16:47:14 +00:00
|
|
|
|
|
|
|
set(add_sync_headers_to_all "")
|
|
|
|
if(is_interface_lib)
|
|
|
|
set(add_sync_headers_to_all ALL)
|
|
|
|
endif()
|
|
|
|
|
2022-08-15 16:29:41 +00:00
|
|
|
add_custom_target(${target}_sync_headers
|
2023-07-06 16:47:14 +00:00
|
|
|
${add_sync_headers_to_all}
|
2022-08-15 16:29:41 +00:00
|
|
|
DEPENDS
|
|
|
|
${syncqt_outputs}
|
|
|
|
)
|
|
|
|
add_dependencies(sync_headers ${target}_sync_headers)
|
2023-05-25 17:32:12 +00:00
|
|
|
set_target_properties(${target}
|
|
|
|
PROPERTIES _qt_internal_sync_headers_target ${target}_sync_headers)
|
2022-08-15 16:29:41 +00:00
|
|
|
|
2023-06-08 14:20:47 +00:00
|
|
|
if(is_3rd_party_library)
|
|
|
|
add_dependencies(thirdparty_sync_headers ${target}_sync_headers)
|
|
|
|
endif()
|
2022-08-15 16:29:41 +00:00
|
|
|
# This target is required when building docs, to make all header files and their aliases
|
|
|
|
# available for qdoc.
|
|
|
|
# ${target}_sync_headers is added as dependency to make sure that
|
|
|
|
# ${target}_sync_all_public_headers is running after ${target}_sync_headers, when building docs.
|
2022-12-28 14:10:53 +00:00
|
|
|
set(syncqt_all_args "${common_syncqt_arguments};-all")
|
|
|
|
list(JOIN syncqt_all_args "\n" syncqt_all_args_string)
|
|
|
|
set(syncqt_all_args_rsp "${binary_dir_real}/${target}_syncqt_all_args")
|
2023-01-11 13:02:13 +00:00
|
|
|
qt_configure_file(OUTPUT "${syncqt_all_args_rsp}" CONTENT "${syncqt_all_args_string}")
|
2022-08-15 16:29:41 +00:00
|
|
|
add_custom_target(${target}_sync_all_public_headers
|
|
|
|
COMMAND
|
|
|
|
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
|
2022-12-28 14:10:53 +00:00
|
|
|
"@${syncqt_all_args_rsp}"
|
2023-06-08 14:20:47 +00:00
|
|
|
${external_headers_dir_copy_cmd}
|
2022-08-15 16:29:41 +00:00
|
|
|
DEPENDS
|
|
|
|
${module_headers}
|
2022-12-28 14:10:53 +00:00
|
|
|
${syncqt_all_args_rsp}
|
2022-08-15 16:29:41 +00:00
|
|
|
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
|
|
|
|
${target}_sync_headers
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT TARGET sync_all_public_headers)
|
|
|
|
add_custom_target(sync_all_public_headers)
|
|
|
|
endif()
|
|
|
|
add_dependencies(sync_all_public_headers ${target}_sync_all_public_headers)
|
|
|
|
|
2023-05-26 10:04:17 +00:00
|
|
|
if(NOT is_3rd_party_library AND NOT is_framework AND module_headers)
|
2022-08-15 16:29:41 +00:00
|
|
|
# Install all the CaMeL style aliases of header files from the staging directory in one rule
|
|
|
|
qt_install(DIRECTORY "${syncqt_staging_dir}/"
|
|
|
|
DESTINATION "${module_install_interface_include_dir}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT is_interface_lib)
|
|
|
|
set_property(TARGET ${target}
|
|
|
|
APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "${target}_sync_headers")
|
|
|
|
endif()
|
|
|
|
add_dependencies(${target} "${target}_sync_headers")
|
|
|
|
|
|
|
|
|
|
|
|
get_target_property(private_module_target ${target} _qt_private_module_target_name)
|
|
|
|
if(private_module_target)
|
|
|
|
add_dependencies(${private_module_target} "${target}_sync_headers")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Run sync Qt first time at configure step to make all header files available for the code model
|
|
|
|
# of IDEs.
|
|
|
|
get_property(synced_modules GLOBAL PROPERTY _qt_synced_modules)
|
Introduce QT_SYNC_HEADERS_AT_CONFIGURE_TIME flag
The syncqt tool was originally designed to run at build time, as a
part of dependency chain of Qt modules. This works well unless we need
the code model of the Qt project in IDE, since Qt source code actively
uses header aliases, and creating them at build time breaks the code
model until the initial build is done. So we made syncqt the configure
time tool to not break the developer experience.
It's more likely that developers build Qt using command line or don't
need the code model before the first build. So running the tool at
configure time should be optional.
QT_SYNC_HEADERS_AT_CONFIGURE_TIME switches the "mode" of the syncqt
tool from build time tool to the configure time tool. Without the
option enabled build procedure runs all the syncing targets at build
time only. The exception are the developer builds, if the
'-developer-build' option is enabled, QT_SYNC_HEADERS_AT_CONFIGURE_TIME
is set to TRUE by default. This gives better development experience for
the developers that don't use the code model in their IDE or don't
require it before the first build is finished. Also this build time
mode is preferred for the CI or similar build procedures where code
model is not required at all.
By default, the option initialized from the
QT_INTERNAL_CONFIGURE_FROM_IDE CMake variable.
TODO: The option is forced to TRUE for the static Ninja Multi-Config
builds. See QTBUG-113974 for details.
[ChangeLog][Build System] When building Qt from sources, syncqt and Qt
header files are now created at build time, not configure time. This
should speed up the configuration step. You can set the CMake variable
QT_CONFIGURE_TIME_SYNC_HEADERS to ON to use the previous behavior,
though. The old behavior is also preserved if cmake/configure is run
from inside an IDE - Qt Creator, Visual Studio Code, and CLion are
currently detected.
Task-number: QTBUG-111163
Task-number: QTBUG-109792
Pick-to: 6.6
Change-Id: Ib61bda9546e58492be874a8591c37e100313d02c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-02-15 14:36:44 +00:00
|
|
|
if(NOT "${module}" IN_LIST synced_modules AND QT_SYNC_HEADERS_AT_CONFIGURE_TIME)
|
2022-08-15 16:29:41 +00:00
|
|
|
message(STATUS "Running syncqt.cpp for module: ${module}")
|
|
|
|
get_target_property(syncqt_location ${QT_CMAKE_EXPORT_NAMESPACE}::syncqt LOCATION)
|
|
|
|
execute_process(
|
|
|
|
COMMAND
|
|
|
|
${syncqt_location}
|
2022-12-28 14:10:53 +00:00
|
|
|
"@${syncqt_args_rsp}"
|
2022-08-15 16:29:41 +00:00
|
|
|
RESULT_VARIABLE syncqt_result
|
|
|
|
OUTPUT_VARIABLE syncqt_output
|
|
|
|
ERROR_VARIABLE syncqt_output
|
|
|
|
)
|
|
|
|
if(NOT syncqt_result EQUAL 0)
|
2023-04-25 13:42:59 +00:00
|
|
|
if(syncqt_output STREQUAL "")
|
|
|
|
string(JOIN "" syncqt_output "The syncqt process exited with code ${syncqt_result}"
|
|
|
|
" and without any useful output. This can happen if syncqt crashes due to the"
|
|
|
|
" incompatibilities with the standard C++ library located by either PATH or"
|
|
|
|
" LD_LIBRARY_PATH environment variables. Please make sure that PATH or"
|
|
|
|
" LD_LIBRARY_PATH don't point to the standard libraries different from the one you"
|
|
|
|
" use for building Qt.")
|
|
|
|
endif()
|
2022-08-15 16:29:41 +00:00
|
|
|
message(FATAL_ERROR
|
2022-09-30 10:46:18 +00:00
|
|
|
"syncqt.cpp failed for module ${module}:\n${syncqt_output}")
|
|
|
|
endif()
|
|
|
|
if(syncqt_output)
|
2022-10-25 14:48:21 +00:00
|
|
|
message(WARNING "${syncqt_output}")
|
2022-08-15 16:29:41 +00:00
|
|
|
endif()
|
|
|
|
set_property(GLOBAL APPEND PROPERTY _qt_synced_modules ${module})
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(qt_internal_collect_sync_header_dependencies out_var skip_non_existing)
|
|
|
|
list(LENGTH ARGN sync_headers_target_count)
|
|
|
|
if(sync_headers_target_count EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Invalid use of qt_internal_collect_sync_header_dependencies,"
|
|
|
|
" dependencies are not specified")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(${out_var} "")
|
|
|
|
foreach(sync_headers_target IN LISTS ARGN)
|
|
|
|
set(sync_headers_target "${sync_headers_target}_sync_headers")
|
|
|
|
if(NOT skip_non_existing OR TARGET ${sync_headers_target})
|
|
|
|
list(APPEND ${out_var} ${sync_headers_target})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
list(REMOVE_DUPLICATES ${out_var})
|
|
|
|
|
|
|
|
set(${out_var} "${${out_var}}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(qt_internal_add_sync_header_dependencies target)
|
|
|
|
qt_internal_collect_sync_header_dependencies(sync_headers_targets FALSE ${ARGN})
|
|
|
|
if(sync_headers_targets)
|
|
|
|
add_dependencies(${target} ${sync_headers_targets})
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(qt_internal_add_autogen_sync_header_dependencies target)
|
|
|
|
qt_internal_collect_sync_header_dependencies(sync_headers_targets TRUE ${ARGN})
|
|
|
|
foreach(sync_headers_target IN LISTS sync_headers_targets)
|
|
|
|
set_property(TARGET ${target} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS
|
|
|
|
"${sync_headers_target}")
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|