Skip to content

Commit aab8b77

Browse files
committed
CMake: Allow specifying an optional host tools path for doc generation
Introduce a new QT_OPTIONAL_TOOLS_PATH cmake variable that can be set to a path where some of the documentation generation host tools might be located. This allows using specific builds of qdoc, qvkgen, qdbusxml2cpp and qtattributionsscanner for documentation generation. QT_HOST_PATH wouldn't be sufficient in this case, because it requires all host tools to be installed for the given path, otherwise configuration will fail In contrast with QT_OPTIONAL_TOOLS_PATH we can specify the paths only for the tools listed above, while continuing using other build tools from the usual locations, either built or found. As a drive-by, fix the usage of CMAKE_EXECUTABLE_SUFFIX to be based on the host platform. Pick-to: 6.8 Task-number: QTBUG-128730 Change-Id: I2796be3a9772b106788ce63a4aed890516e8b716 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
1 parent 3066e9e commit aab8b77

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

cmake/QtDbusHelpers.cmake

+14-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,22 @@ function(qt_create_qdbusxml2cpp_command target infile)
5555
set(header_file_full "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.h")
5656
set(source_file_full "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.cpp")
5757

58+
if(QT_OPTIONAL_TOOLS_PATH)
59+
if(CMAKE_HOST_WIN32)
60+
set(executable_suffix ".exe")
61+
else()
62+
set(executable_suffix "")
63+
endif()
64+
set(tool_path
65+
"${QT_OPTIONAL_TOOLS_PATH}/${INSTALL_BINDIR}/qdbusxml2cpp${executable_suffix}")
66+
else()
67+
set(tool_path "${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp")
68+
endif()
69+
5870
add_custom_command(OUTPUT "${header_file_full}" "${source_file_full}"
59-
COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp ${arg_FLAGS} "${option}"
71+
COMMAND ${tool_path} ${arg_FLAGS} "${option}"
6072
"${header_file}:${source_file}" "${absolute_in_file_path}"
61-
DEPENDS "${absolute_in_file_path}" ${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp
73+
DEPENDS "${absolute_in_file_path}" ${tool_path}
6274
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
6375
COMMAND_EXPAND_LISTS
6476
VERBATIM)

cmake/QtDocsHelpers.cmake

+13-3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ function(qt_internal_add_docs)
6868
set(tool_dependencies_enabled FALSE)
6969
set(doc_tools_bin "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}")
7070
set(doc_tools_libexec "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}")
71+
elseif(NOT "${QT_OPTIONAL_TOOLS_PATH}" STREQUAL "")
72+
set(tool_dependencies_enabled FALSE)
73+
set(doc_tools_bin "${QT_OPTIONAL_TOOLS_PATH}/${INSTALL_BINDIR}")
74+
set(doc_tools_libexec "${QT_OPTIONAL_TOOLS_PATH}/${INSTALL_LIBEXECDIR}")
7175
elseif(QT_SUPERBUILD)
7276
set(doc_tools_bin "${QtBase_BINARY_DIR}/${INSTALL_BINDIR}")
7377
set(doc_tools_libexec "${QtBase_BINARY_DIR}/${INSTALL_LIBEXECDIR}")
@@ -76,9 +80,15 @@ function(qt_internal_add_docs)
7680
set(doc_tools_libexec "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}")
7781
endif()
7882

79-
set(qdoc_bin "${doc_tools_bin}/qdoc${CMAKE_EXECUTABLE_SUFFIX}")
80-
set(qtattributionsscanner_bin "${doc_tools_libexec}/qtattributionsscanner${CMAKE_EXECUTABLE_SUFFIX}")
81-
set(qhelpgenerator_bin "${doc_tools_libexec}/qhelpgenerator${CMAKE_EXECUTABLE_SUFFIX}")
83+
if(CMAKE_HOST_WIN32)
84+
set(executable_suffix ".exe")
85+
else()
86+
set(executable_suffix "")
87+
endif()
88+
89+
set(qdoc_bin "${doc_tools_bin}/qdoc${executable_suffix}")
90+
set(qtattributionsscanner_bin "${doc_tools_libexec}/qtattributionsscanner${executable_suffix}")
91+
set(qhelpgenerator_bin "${doc_tools_libexec}/qhelpgenerator${executable_suffix}")
8292

8393
get_target_property(target_type ${target} TYPE)
8494
if (NOT target_type STREQUAL "INTERFACE_LIBRARY")

src/gui/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,11 @@ if (QT_FEATURE_vulkan)
957957
"${QT_HOST_PATH}"
958958
"${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}"
959959
"qvkgen${host_executable_suffix}")
960+
elseif(QT_OPTIONAL_TOOLS_PATH)
961+
qt_path_join(qvkgen
962+
"${QT_OPTIONAL_TOOLS_PATH}"
963+
"${INSTALL_LIBEXECDIR}"
964+
"qvkgen${host_executable_suffix}")
960965
else()
961966
set(qvkgen "${QT_CMAKE_EXPORT_NAMESPACE}::qvkgen")
962967
endif()

0 commit comments

Comments
 (0)