Skip to content

Commit

Permalink
add documentation generation target.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sauci committed Jul 4, 2019
1 parent 9801239 commit 4861151
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.pytest_cache
*__pycache__*
*build*
doc/*
extern/*
!extern/CMakeLists.txt
generated/CanTp_Cfg.c
Expand Down
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<definition>=<value>``` when configuring the build with CMake.

0 comments on commit 4861151

Please sign in to comment.