Generate API documentation with CMake.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f4bd5abd01
commit
aeb7396961
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
/build/
|
||||
/doc/
|
||||
/update_doc.sh
|
||||
/examples/example99*
|
||||
|
|
|
@ -29,6 +29,7 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|||
# Project build options.
|
||||
option(WITH_TESTS "Compile tests." NO)
|
||||
option(WITH_EXAMPLES "Compile examples." NO)
|
||||
option(WITH_DOC "Generate API documentation." NO)
|
||||
option(WITH_DEB "Prepare for the building of .deb packages." NO)
|
||||
option(WITH_RPM "Prepare for the building of .rpm packages." NO)
|
||||
option(WITH_CLANG-TIDY "Check sourcecode with clang-tidy while compiling." NO)
|
||||
|
@ -60,4 +61,11 @@ if(WITH_EXAMPLES)
|
|||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
if(WITH_DOC)
|
||||
include(cmake/Doxygen.cmake)
|
||||
enable_doxygen(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
endif()
|
||||
|
||||
include(cmake/packages.cmake)
|
||||
|
|
27
Doxyfile
27
Doxyfile
|
@ -1,27 +0,0 @@
|
|||
# -*- mode: conf-unix -*-
|
||||
INPUT = src/ include/
|
||||
RECURSIVE = YES
|
||||
STRIP_FROM_INC_PATH = "include"
|
||||
EXAMPLE_PATH = examples/
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = doc/html
|
||||
GENERATE_LATEX = NO
|
||||
ALLOW_UNICODE_NAMES = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = YES
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
MARKDOWN_SUPPORT = YES
|
||||
AUTOLINK_SUPPORT = YES
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
BUILTIN_STL_SUPPORT = YES
|
||||
VERBATIM_HEADERS = YES
|
||||
INLINE_SOURCES = YES
|
||||
SEARCHENGINE = YES
|
||||
SHOW_FILES = YES
|
|
@ -151,6 +151,7 @@ cmake --build . -- -j$(nproc --ignore=1)
|
|||
* `-DCMAKE_BUILD_TYPE=Debug` for a debug build.
|
||||
* `-DWITH_TESTS=YES` if you want to compile the tests.
|
||||
* `-DWITH_EXAMPLES=YES` if you want to compile the examples.
|
||||
* `-DWITH_DOC=YES` if you want to generate the API documentation.
|
||||
* `-DWITH_CLANG-TIDY=YES` to check the sourcecode with
|
||||
link:{uri-clang-tidy}[clang-tidy] while compiling.
|
||||
* One of:
|
||||
|
|
11
build_doc.sh
11
build_doc.sh
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
project="$(realpath --relative-base=.. .)"
|
||||
version="$(grep -Eo '[0-9]+.[0-9]+.[0-9]+$' CMakeLists.txt)"
|
||||
|
||||
if [[ -f Doxyfile ]]; then
|
||||
mkdir -p doc
|
||||
(doxygen -s -g - && cat Doxyfile &&
|
||||
echo "PROJECT_NAME = ${project}" &&
|
||||
echo "PROJECT_NUMBER = ${version}") | doxygen -
|
||||
fi
|
43
cmake/Doxygen.cmake
Normal file
43
cmake/Doxygen.cmake
Normal file
|
@ -0,0 +1,43 @@
|
|||
include(GNUInstallDirs)
|
||||
|
||||
function(enable_doxygen)
|
||||
find_package(Doxygen REQUIRED dot)
|
||||
|
||||
set(DOXYGEN_RECURSIVE YES)
|
||||
set(DOXYGEN_STRIP_FROM_INC_PATH "include")
|
||||
if (WITH_EXAMPLES)
|
||||
set(DOXYGEN_EXAMPLE_PATH "examples/")
|
||||
set(DOXYGEN_EXAMPLE_RECURSIVE YES)
|
||||
endif()
|
||||
set(DOXYGEN_GENERATE_HTML YES)
|
||||
set(DOXYGEN_HTML_OUTPUT "doc/html")
|
||||
set(DOXYGEN_GENERATE_LATEX NO)
|
||||
set(DOXYGEN_ALLOW_UNICODE_NAMES YES)
|
||||
set(DOXYGEN_BRIEF_MEMBER_DESC YES)
|
||||
set(DOXYGEN_REPEAT_BRIEF YES)
|
||||
set(DOXYGEN_ALWAYS_DETAILED_SEC YES)
|
||||
set(DOXYGEN_INLINE_INHERITED_MEMB NO)
|
||||
set(DOXYGEN_INHERIT_DOCS YES)
|
||||
set(DOXYGEN_SEPARATE_MEMBER_PAGES NO)
|
||||
set(DOXYGEN_TAB_SIZE 4)
|
||||
set(DOXYGEN_MARKDOWN_SUPPORT YES)
|
||||
set(DOXYGEN_AUTOLINK_SUPPORT YES)
|
||||
set(DOXYGEN_INLINE_SIMPLE_STRUCTS NO)
|
||||
set(DOXYGEN_QUIET YES)
|
||||
set(DOXYGEN_WARNINGS YES)
|
||||
set(DOXYGEN_WARN_IF_UNDOCUMENTED YES)
|
||||
set(DOXYGEN_BUILTIN_STL_SUPPORT YES)
|
||||
set(DOXYGEN_VERBATIM_HEADERS YES)
|
||||
set(DOXYGEN_INLINE_SOURCES YES)
|
||||
set(DOXYGEN_SEARCHENGINE YES)
|
||||
set(DOXYGEN_SHOW_FILES YES)
|
||||
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc")
|
||||
|
||||
doxygen_add_docs(${PROJECT_NAME}_doxygen "${ARGV}")
|
||||
# Make sure doxygen is run with every build.
|
||||
add_custom_target(${PROJECT_NAME}_docs ALL DEPENDS ${PROJECT_NAME}_doxygen)
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||
endfunction()
|
Loading…
Reference in New Issue
Block a user