From b0bd0e6eee6650770bc1e53565b17ae64064a491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Montan=CC=83ana?= Date: Wed, 22 May 2024 11:10:21 +0200 Subject: [PATCH] Create doc target to build documentation --- .gitignore | 4 ++++ CMakeLists.txt | 17 +++++++---------- Makefile | 7 ++++++- docs/Doxyfile.in | 6 +++--- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index a1c4460..fa86698 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,8 @@ puml/** .vscode/settings.json sample/build **/.DS_Store +docs/manual +docs/man3 +docs/man +docs/Doxyfile diff --git a/CMakeLists.txt b/CMakeLists.txt index ffaabd6..5a2d731 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,14 +92,11 @@ install(FILES ${CMAKE_BINARY_DIR}/configured_files/include/bayesnet/config.h DES # Documentation # ------------- -set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in) -set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) +find_package(Doxygen REQUIRED dot) +set(DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs) +set(doxyfile_in ${DOC_DIR}/Doxyfile.in) +set(doxyfile ${DOC_DIR}/Doxyfile) configure_file(${doxyfile_in} ${doxyfile} @ONLY) - -# doc build only target, target is not in default build, so it must be -# triggered explicitly -add_custom_target(doc - COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMENT "Generating API documentation with Doxygen" - VERBATIM) \ No newline at end of file +doxygen_add_docs(doxygen + WORKING_DIRECTORY ${DOC_DIR} + CONFIG_FILE ${doxyfile}) diff --git a/Makefile b/Makefile index 729db2f..aab1cc5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash .DEFAULT_GOAL := help -.PHONY: viewcoverage coverage setup help install uninstall diagrams buildr buildd test clean debug release sample updatebadge +.PHONY: viewcoverage coverage setup help install uninstall diagrams buildr buildd test clean debug release sample updatebadge doc f_release = build_Release f_debug = build_Debug @@ -145,6 +145,11 @@ updatebadge: ## Update the coverage badge in README.md @env python update_coverage.py $(f_debug)/tests @echo ">>> Done"; +doc: ## Generate documentation + @echo ">>> Generating documentation..." + @cmake --build $(f_release) -t doxygen + @echo ">>> Done"; + help: ## Show help message @IFS=$$'\n' ; \ help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \ diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 147e0b5..95acb53 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -42,19 +42,19 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = BayesNet +PROJECT_NAME = "@CMAKE_PROJECT_NAME@" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.0.5 +PROJECT_NUMBER = @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Bayesian Network Classifiers using libtorch from scratch" +PROJECT_BRIEF = "@CMAKE_PROJECT_DESCRIPTION@" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55