CMake: Add doc_tools build and install targets

Add doc_tools and install_doc_tools custom targets.
These are meant to build and install documentation and code generation
tools that participate in documentation generation.

Such tools should be annotated with the IS_DOC_TOOL option to their
qt_internal_add_tool call.

In qtbase, such generator tools are qdbusxml2cpp and qvkgen.

Task-number: QTBUG-91243
Task-number: QTBUG-128730
Change-Id: Idebffc6f50d8547ce76c1102a20d60d436e44cfd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3066e9e38deada5f99a47449e4ef84eebc5219f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2024-09-08 17:01:48 +02:00
parent 6e6d42a3b3
commit 28a5486d53
4 changed files with 23 additions and 0 deletions

View File

@ -308,6 +308,7 @@ macro(qt_build_repo_begin)
if(NOT TARGET host_tools)
add_custom_target(host_tools)
add_custom_target(bootstrap_tools)
add_custom_target(doc_tools)
# TODO: Investigate complexity of installing tools for shared builds.
# Currently installing host tools without libraries only really makes sense for static
@ -321,9 +322,21 @@ macro(qt_build_repo_begin)
COMMAND ${CMAKE_COMMAND}
--install ${CMAKE_BINARY_DIR} --component host_tools --strip
)
add_custom_target(install_doc_tools
COMMAND ${CMAKE_COMMAND}
--install ${CMAKE_BINARY_DIR} --component doc_tools
)
add_custom_target(install_doc_tools_stripped
COMMAND ${CMAKE_COMMAND}
--install ${CMAKE_BINARY_DIR} --component doc_tools --strip
)
if(NOT QT_INTERNAL_NO_INSTALL_TOOLS_BUILD_DEPS)
add_dependencies(install_tools host_tools)
add_dependencies(install_tools_stripped host_tools)
add_dependencies(install_doc_tools doc_tools)
add_dependencies(install_doc_tools_stripped doc_tools)
endif()
endif()
endif()

View File

@ -22,6 +22,10 @@
# TRY_RUN_FLAGS
# Command line flags that are going to be passed to the tool for testing its correctness.
# If no flags were given, we default to `-v`.
# REQUIRED_FOR_DOCS
# Specifies that the built tool is required to generate documentation. Examples are qdoc,
# and qvkgen (because they participate in header file generation, which are needed for
# documentation generation).
#
# One-value Arguments:
# EXTRA_CMAKE_FILES
@ -51,6 +55,7 @@ function(qt_internal_add_tool target_name)
EXCEPTIONS
NO_UNITY_BUILD
TRY_RUN
REQUIRED_FOR_DOCS
${__qt_internal_sbom_optional_args}
)
set(one_value_keywords
@ -170,6 +175,9 @@ function(qt_internal_add_tool target_name)
if(TARGET host_tools)
add_dependencies(host_tools "${target_name}")
if(arg_REQUIRED_FOR_DOCS)
add_dependencies(doc_tools "${target_name}")
endif()
if(arg_CORE_LIBRARY STREQUAL "Bootstrap")
add_dependencies(bootstrap_tools "${target_name}")
endif()

View File

@ -7,6 +7,7 @@
qt_get_tool_target_name(target_name qdbusxml2cpp)
qt_internal_add_tool(${target_name}
REQUIRED_FOR_DOCS
TRY_RUN
TARGET_DESCRIPTION "Qt D-Bus XML to C++ Compiler"
TOOLS_TARGET DBus

View File

@ -7,6 +7,7 @@
qt_get_tool_target_name(target_name qvkgen)
qt_internal_add_tool(${target_name}
REQUIRED_FOR_DOCS
TARGET_DESCRIPTION "Qt Vulkan Header Generator"
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Gui