From 4861151e8e3b9b412cf426526db5173eeff9180c Mon Sep 17 00:00:00 2001 From: Sauci Date: Thu, 4 Jul 2019 07:27:03 +0200 Subject: [PATCH] add documentation generation target. --- .gitignore | 1 + CMakeLists.txt | 12 +++++++++--- Dockerfile | 2 ++ README.md | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 105ed66..db5a28f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .pytest_cache *__pycache__* *build* +doc/* extern/* !extern/CMakeLists.txt generated/CanTp_Cfg.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c44def..c18b0ed 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,14 +5,20 @@ project(CanTp VERSION 0.1.0 LANGUAGES C) option(ENABLE_DET "enable/disable developement error detection feature." ON) option(ENABLE_TEST "enable/disable tests." ON) option(ENABLE_SCA "enable/disable static code analysis." OFF) +option(ENABLE_DOC "enable/disable documentation generation." OFF) set(MISRA_C_VERSION 2012 CACHE STRING "MISRA standard.") set(CANTP_CONFIG_FILEPATH ${CMAKE_CURRENT_SOURCE_DIR}/config/can_tp.json CACHE FILEPATH "") -# find a distribution of Python 3. Python is used for: -# - generation of the static configuration sources (CanTp_Cfg.c and CanTp_Cfg.h) -# - running the tests find_package(PythonInterp 3.6 REQUIRED) +if (${ENABLE_DOC}) + find_package(Doxygen REQUIRED dot) + + set(DOXYGEN_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/doc) + + doxygen_add_docs(${PROJECT_NAME}.doc source interface COMMENT "generating CanTp documentation") +endif() + if (${ENABLE_SCA}) add_subdirectory(extern) endif () diff --git a/Dockerfile b/Dockerfile index 418246a..1d7eb2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,9 @@ ENV BUILD_DIR=$PROJECT_DIR/docker_build RUN apk update && apk add \ build-base \ cmake \ + doxygen \ git \ + graphviz \ libffi-dev \ python3-dev diff --git a/README.md b/README.md index e892263..a79c53f 100644 --- a/README.md +++ b/README.md @@ -13,5 +13,6 @@ The following definitions might be set by the user, depending on the needs. | ```ENABLE_SCA``` | ```ON```/```OFF``` | ```OFF``` | enables/disables generation of targets related to static code analysis (should be disabled if [lint](https://www.gimpel.com) software is not available) | | ```MISRA_C_VERSION``` | ```1998```/```2004```/```2012``` | ```2012``` | specifies which version of **MISRA** should be used when performing static code analysis (only used if ```ENABLE_SCA``` is set) | | ```CANTP_CONFIG_FILEPATH``` | ```-``` | ```CanTp/config/can_tp.json``` | specifies which json configuration file should be used to generate the auto-generated code | +| ```ENABLE_DOC``` | ```ON```/```OFF``` | ```OFF``` | enables/disables generation of [Doxygen](http://www.doxygen.nl/) documentation | To use this feature, simply add ```-D=``` when configuring the build with CMake.