CMake: Fix dbus and vk headers to be excluded from doc generation
Before this change, if someone called ninja Gui_generate_docs, it
would implicitly depend on sync_all_public_headers -> Gui_sync_headers
which would generate dbus headers.
This caused trouble with the new 'build doc tools from
qttools/dev/HEAD' approach, because an older pre-built dbus tool might
be passed a newer option when integrating a qtbase change that passes
the new option.
To avoid that, we now filter out the dbus headers from the list of
headers that should be processed by syncqt when building a
documentation target.
We do the same for the qvkgen generated headers.
This also removes the dependency on the ${target}_sync_headers target,
which means there is a potential issue when someone manually calls
`ninja sync_all_public_headers Gui_sync_headers` or something like it,
which would spawn two syncqt processes that access the same files
concurrently. This is an edge case that should not happen, but if it
ends up happening, we will have to implement some kind of lock file
mechanism.
Fixes: QTBUG-134672
Task-number: QTBUG-128730
Change-Id: I9061f9495e2faa77744f5f5c0de8fedd362ba228
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e7834e90f38891382f830da7700f00ebd81f21a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b6ab8c113d5615688fa171e6aa19e6183e1f4f9a)
This commit is contained in:
committed by
Qt Cherry-pick Bot
parent
c247194201
commit
a64bfd176f
@@ -79,4 +79,9 @@ function(qt_create_qdbusxml2cpp_command target infile)
|
||||
"${header_file_full}"
|
||||
"${source_file_full}"
|
||||
)
|
||||
set_source_files_properties(
|
||||
"${header_file_full}"
|
||||
"${source_file_full}"
|
||||
PROPERTIES
|
||||
_qt_syncqt_exclude_from_docs TRUE)
|
||||
endfunction()
|
||||
|
||||
@@ -1019,8 +1019,11 @@ function(qt_finalize_module target)
|
||||
# property which supposed to be updated inside every qt_internal_install_module_headers
|
||||
# call.
|
||||
qt_internal_add_headersclean_target(${target} "${module_headers_public}")
|
||||
qt_internal_target_sync_headers(${target} "${module_headers_all}"
|
||||
"${module_headers_generated}")
|
||||
qt_internal_target_sync_headers(${target}
|
||||
"${module_headers_all}"
|
||||
"${module_headers_generated}"
|
||||
"${module_headers_exclude_from_docs}"
|
||||
)
|
||||
get_target_property(module_depends_header ${target} _qt_module_depends_header)
|
||||
qt_internal_install_module_headers(${target}
|
||||
PUBLIC ${module_headers_public} "${module_depends_header}"
|
||||
@@ -1364,6 +1367,7 @@ endfunction()
|
||||
function(qt_internal_collect_module_headers out_var target)
|
||||
set(${out_var}_public "")
|
||||
set(${out_var}_private "")
|
||||
set(${out_var}_exclude_from_docs "")
|
||||
set(${out_var}_qpa "")
|
||||
set(${out_var}_rhi "")
|
||||
set(${out_var}_ssg "")
|
||||
@@ -1438,6 +1442,12 @@ function(qt_internal_collect_module_headers out_var target)
|
||||
set(is_3rdparty_header FALSE)
|
||||
endif()
|
||||
list(APPEND ${out_var}_all "${file_path}")
|
||||
|
||||
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()
|
||||
|
||||
if(qpa_filter AND file_name MATCHES "${qpa_filter}")
|
||||
list(APPEND ${out_var}_qpa "${file_path}")
|
||||
elseif(rhi_filter AND file_name MATCHES "${rhi_filter}")
|
||||
@@ -1480,6 +1490,7 @@ function(qt_internal_collect_module_headers out_var target)
|
||||
endforeach()
|
||||
set(${out_var}_all "${${out_var}_all}" PARENT_SCOPE)
|
||||
set(${out_var}_generated "${${out_var}_generated}" PARENT_SCOPE)
|
||||
set(${out_var}_exclude_from_docs "${${out_var}_exclude_from_docs}" PARENT_SCOPE)
|
||||
|
||||
if(has_header_types_properties)
|
||||
set_target_properties(${target} PROPERTIES ${has_header_types_properties})
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
# 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)
|
||||
function(qt_internal_target_sync_headers target
|
||||
module_headers
|
||||
module_headers_generated
|
||||
module_headers_exclude_from_docs
|
||||
)
|
||||
if(NOT TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::syncqt)
|
||||
message(FATAL_ERROR "${QT_CMAKE_EXPORT_NAMESPACE}::syncqt is not a target.")
|
||||
endif()
|
||||
@@ -146,6 +150,11 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
|
||||
list(FILTER module_headers EXCLUDE REGEX
|
||||
"(.+/(ui_)[^/]+\\.h|${CMAKE_CURRENT_SOURCE_DIR}(/.+)?/doc/+\\.h)")
|
||||
|
||||
# Filter out all headers that should be excluded from documentation generation.
|
||||
# Documentation generation shouldn't depend on headers like the dbus-generated ones.
|
||||
set(module_headers_for_docs "${module_headers}")
|
||||
list(REMOVE_ITEM module_headers_for_docs ${module_headers_exclude_from_docs})
|
||||
|
||||
set(syncqt_staging_dir "${module_build_interface_include_dir}/.syncqt_staging")
|
||||
|
||||
set(syncqt_args "${common_syncqt_arguments}")
|
||||
@@ -225,10 +234,16 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
|
||||
"@${syncqt_all_args_rsp}"
|
||||
${external_headers_dir_copy_cmd}
|
||||
DEPENDS
|
||||
${module_headers}
|
||||
# Note, we don't depend anymore on ${target}_sync_headers so that we don't bring
|
||||
# in the headers that are usually excluded from docs.
|
||||
# This means if someone manually calls
|
||||
# `ninja sync_all_public_headers Gui_sync_headers` it will cause havoc due to two
|
||||
# syncqt calls accessing the same files concurrently. This is an edge case that should
|
||||
# not happen, but it ends up happening, we will have to implement some kind of lock
|
||||
# file mechanism.
|
||||
${module_headers_for_docs}
|
||||
${syncqt_all_args_rsp}
|
||||
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
|
||||
${target}_sync_headers
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
|
||||
@@ -980,6 +980,7 @@ add_custom_command(
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
VERBATIM
|
||||
)
|
||||
set_source_files_properties(${vulkan_fun_outputs} PROPERTIES _qt_syncqt_exclude_from_docs TRUE)
|
||||
|
||||
qt_internal_extend_target(Gui CONDITION WASM
|
||||
SOURCES
|
||||
|
||||
Reference in New Issue
Block a user