Skip to content

Commit

Permalink
Use doxygen-awesome.css instead of doxybook
Browse files Browse the repository at this point in the history
  • Loading branch information
dantti committed Jul 12, 2024
1 parent 17de31c commit 775ea68
Show file tree
Hide file tree
Showing 9 changed files with 3,287 additions and 379 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ci:
autoupdate_schedule: monthly

exclude: ^(cmake/|3rdparty/)
exclude: ^(cmake/|3rdparty/|docs/api/doxygen-awesome.css)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -25,4 +25,6 @@ repos:
rev: v0.6.13
hooks:
- id: cmake-lint
exclude: (.py.cmake|Doxyfile.cmake)
- id: cmake-format
exclude: (.py.cmake|Doxyfile.cmake)
10 changes: 10 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Files: cmake/ECM/modules/*
Copyright:
License: BSD-3-Clause

#misc config files
Files: .pre-commit-config.yaml .codespellrc .krazy .cmake-format.py .clang-format .clazy .gitignore .mdlrc .mdlrc.rb .pep8 .pylintrc docs/api/Doxyfile.cmake distro/*
Copyright: Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
License: BSD-3-Clause

#3rdparty C++
Files: src/kdbindings/genindex_array.h
Copyright: 2021 Jeremy Burns
Expand All @@ -25,3 +30,8 @@ License: MIT
Files: tests/doctest/doctest.h
Copyright: 2016-2021 Viktor Kirilov <[email protected]>
License: MIT

# doxygen awesome
Files: docs/api/doxygen-awesome.css
Copyright: 2021 - 2023 jothepro
License: MIT
86 changes: 40 additions & 46 deletions docs/api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,72 +1,66 @@
# This file is part of KDBindings.
#
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
# Author: Allen Winter <[email protected]>
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group
# company <[email protected]> Author: Allen Winter <[email protected]>
#
# SPDX-License-Identifier: MIT
#
# Contact KDAB at <[email protected]> for commercial licensing options.
#

find_program(DOXYBOOK2_EXECUTABLE doxybook2)
if(NOT DOXYBOOK2_EXECUTABLE)
message(FATAL_ERROR "\ndoxybook2 (a Doxygen XML to Markdown (or JSON) converter) could not be found. This tool is required to build the API documentation. Consider installing it by following the directions at https://github.com/matusnovak/doxybook2.\nAlternatively, re-run cmake with the -D${PROJECT_NAME}_DOCS=False option.")
endif()

find_program(MKDOCS_EXECUTABLE mkdocs)
if(NOT MKDOCS_EXECUTABLE)
message(FATAL_ERROR "\nmkdocs (a project documentation tool using Markdown) could not be found. This tool is required to build the API documentation. Consider installing it by following the directions at https://www.mkdocs.org/user-guide/installation.\nAlso you'll need to 'pip install pymdown-extensions mkdocs-material'\nAlternatively, re-run cmake with the -D${PROJECT_NAME}_DOCS=False option.")
message(
FATAL_ERROR
"\nmkdocs (a project documentation tool using Markdown) could not be found. This tool is required to build the API documentation. Consider installing it by following the directions at https://www.mkdocs.org/user-guide/installation.\nAlso you'll need to 'pip install pymdown-extensions mkdocs-material'\nAlternatively, re-run cmake with the -D${PROJECT_NAME}_DOCS=False option."
)
endif()

# dot should come with Doxygen find_package(Doxygen)
if(DOXYGEN_DOT_EXECUTABLE)
set(HAVE_DOT "YES")
set(HAVE_DOT "YES")
else()
set(HAVE_DOT "NO")
message(STATUS "Unable to provide inheritance diagrams for the API documentation. To fix, install the graphviz project from https://www.graphviz.org")
set(HAVE_DOT "NO")
message(
STATUS
"Unable to provide inheritance diagrams for the API documentation. To fix, install the graphviz project from https://www.graphviz.org"
)
endif()

file(GLOB _dox_deps *.dox *.html)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})

#apidox generation using doxygen
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/mkdocs/mkdocs.yml.cmake
${CMAKE_CURRENT_BINARY_DIR}/mkdocs/mkdocs.yml
)

add_custom_target(docs
# Execute Doxygen
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile

COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/mkdocs ${DOXYGEN_OUTPUT_DIR}/mkdocs
#copy some files by-hand that are referred to by the markdown README.
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/MIT.txt ${DOXYGEN_OUTPUT_DIR}/mkdocs/docs/license.md

# Run Doxybook2 to generate mkdocs compatible documentation
COMMAND ${DOXYBOOK2_EXECUTABLE} --config "${CMAKE_CURRENT_SOURCE_DIR}/doxybook/config.json" --input "${DOXYGEN_OUTPUT_DIR}/xml" --output "${DOXYGEN_OUTPUT_DIR}/mkdocs/docs"

# Run MkDocs to build html documentation
COMMAND ${MKDOCS_EXECUTABLE} build --config-file "${DOXYGEN_OUTPUT_DIR}/mkdocs/mkdocs.yml" --site-dir "${DOXYGEN_OUTPUT_DIR}/html"
# apidox generation using doxygen
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mkdocs/mkdocs.yml.cmake ${CMAKE_CURRENT_BINARY_DIR}/mkdocs/mkdocs.yml)

DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building Documentation"
add_custom_target(
docs
# Execute Doxygen
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/mkdocs ${DOXYGEN_OUTPUT_DIR}/mkdocs
# copy some files by-hand that are referred to by the markdown README.
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/LICENSES/MIT.txt
${DOXYGEN_OUTPUT_DIR}/mkdocs/docs/license.md
# Run MkDocs to build html documentation
COMMAND ${MKDOCS_EXECUTABLE} build --config-file "${DOXYGEN_OUTPUT_DIR}/mkdocs/mkdocs.yml" --site-dir
"${DOXYGEN_OUTPUT_DIR}/html"
DEPENDS ${_dox_deps} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Building Documentation"
)

add_custom_command(TARGET docs
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan ""
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Built MkDocs documentation"
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Use 'mkdocs serve' in the '${DOXYGEN_OUTPUT_DIR}/mkdocs' directory to view the documentation."
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan ""
VERBATIM
add_custom_command(
TARGET docs
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan ""
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Built MkDocs documentation"
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan
"Use 'mkdocs serve' in the '${DOXYGEN_OUTPUT_DIR}/mkdocs' directory to view the documentation."
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan ""
VERBATIM
)
#The tags file is only created when 'make docs' is run first
# The tags file is only created when 'make docs' is run first
if(EXISTS "${DOXYGEN_OUTPUT_DIR}/kdbindings.tags")
install(FILES ${DOXYGEN_OUTPUT_DIR}/kdbindings.tags DESTINATION ${INSTALL_DOC_DIR})
install(FILES ${DOXYGEN_OUTPUT_DIR}/kdbindings.tags DESTINATION ${INSTALL_DOC_DIR})
endif()
Loading

0 comments on commit 775ea68

Please sign in to comment.