Skip to content

Commit

Permalink
Switch to using my FindQtDocs cmake module
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Jan 22, 2024
1 parent 2a1473d commit 09c3999
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
"$RUNNER_TEMP/doxygen-${DOXYGEN_VERSION}/bin/doxygen" --version
- name: Build docs
run: |
cmake -D "DOXYGEN_EXECUTABLE=$RUNNER_TEMP/doxygen-${DOXYGEN_VERSION}/bin/doxygen" -D "QT_TAGFILES_PATH=/usr/share/qt5/doc" -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
cmake -D "DOXYGEN_EXECUTABLE=$RUNNER_TEMP/doxygen-${DOXYGEN_VERSION}/bin/doxygen" -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
cmake --build "$RUNNER_TEMP" --target doc doc-internal
- name: Upload public docs
uses: actions/upload-artifact@v4
Expand Down
44 changes: 9 additions & 35 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,19 @@
# SPDX-FileCopyrightText: 2022-2024 Paul Colby <[email protected]>
# SPDX-License-Identifier: LGPL-3.0-or-later

# Attempt to detect the QT_INSTALL_DOCS path via qtpaths or qmake.
if(NOT QT_INSTALL_DOCS)
if(QT_VERSION VERSION_GREATER_EQUAL 6.2.0 AND TARGET Qt${QT_VERSION_MAJOR}::qtpaths)
message(DEBUG "Fetching location of imported Qt${QT_VERSION_MAJOR}::qtpaths command")
get_target_property(COMMAND Qt${QT_VERSION_MAJOR}::qtpaths LOCATION)
elseif(TARGET Qt${QT_VERSION_MAJOR}::qmake)
message(DEBUG "Fetching location of imported Qt${QT_VERSION_MAJOR}::qmake command")
get_target_property(COMMAND Qt${QT_VERSION_MAJOR}::qmake LOCATION)
else()
message(STATUS "Neither Qt${QT_VERSION_MAJOR}::qtpaths nor Qt${QT_VERSION_MAJOR}::qmake available")
endif()
if (COMMAND)
message(VERBOSE "Fetching QT_INSTALL_DOCS from ${COMMAND}")
execute_process(
COMMAND "${COMMAND}" -query QT_INSTALL_DOCS
RESULT_VARIABLE COMMAND_RESULT
OUTPUT_VARIABLE COMMAND_OUTPUT
ERROR_VARIABLE COMMNAD_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
message(DEBUG "${COMMAND} result: ${COMMAND_RESULT}")
message(DEBUG "${COMMAND} output: ${COMMAND_OUTPUT}")
message(DEBUG "${COMMAND} error: ${COMMAND_ERROR}")
if(COMMAND_RESULT EQUAL 0)
set(QT_INSTALL_DOCS "${COMMAND_OUTPUT}")
message(STATUS "Found QT_INSTALL_DOCS: ${QT_INSTALL_DOCS}")
else()
message(STATUS "Failed to find QT_INSTALL_DOCS: ${COMMAND_OUTPUT} ${COMMAND_ERROR} [${COMMAND_RESULT}]")
endif()
endif()
endif()
include(FetchContent)
FetchContent_Declare(FindQtDocs GIT_REPOSITORY "https://github.com/pcolby/cmake-modules" GIT_TAG "v1")
FetchContent_MakeAvailable(FindQtDocs)
list(PREPEND CMAKE_MODULE_PATH "${findqtdocs_SOURCE_DIR}")
find_package(QtDocs REQUIRED COMPONENTS Core Bluetooth)

# Include Qt doc tagfiles, if available.
if (QT_INSTALL_DOCS)
if (QtDocs_FOUND)
set(QT_DOCS_BASEURL "https://doc.qt.io/qt-${QT_VERSION_MAJOR}/")
message(STATUS "Using Qt doc tagfiles ${QT_INSTALL_DOCS} (${QT_DOCS_BASEURL})")
message(STATUS "Using Qt doc tagfiles ${QT_INSTALL_DOCS} => ${QT_DOCS_BASEURL}")
set(DOX_TAGFILES "\\
\"${QT_INSTALL_DOCS}/qtcore/qtcore.tags=${QT_DOCS_BASEURL}\" \\
\"${QT_INSTALL_DOCS}/qtbluetooth/qtbluetooth.tags=${QT_DOCS_BASEURL}\" \\")
\"${QtDocs_Core_TAGS}=${QT_DOCS_BASEURL}\" \\
\"${QtDocs_Bluetooth_TAGS}=${QT_DOCS_BASEURL}\" \\")
endif()

find_package(Doxygen)
Expand Down

0 comments on commit 09c3999

Please sign in to comment.