Skip to content

Commit d32e6d8

Browse files
authored
Merge pull request #61 from OpenSimulationInterface/feature/add-doxygen-doc
Resolve issue #38 (doxygen documentation)
2 parents 6a032b6 + ff396db commit d32e6d8

21 files changed

+1750
-954
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ CTestTestfile.cmake
1111
build
1212
*.egg-info
1313
osi
14-
.project
14+
.project
15+
doc/html
16+
doc/latex

CMakeLists.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.7)
22

3+
# set name and version of the project
34
project(open_simulation_interface)
5+
set(VERSION_MAJOR 2)
6+
set(VERSION_MINOR 1)
7+
set(VERSION_PATCH 1)
8+
49

510
find_package(Protobuf 2.6.1 REQUIRED)
611

@@ -60,3 +65,34 @@ target_include_directories(${PROJECT_NAME}
6065
${CMAKE_CURRENT_BINARY_DIR}
6166
)
6267
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY})
68+
69+
70+
# add a target to generate API documentation with Doxygen
71+
# Dependencies: Doxygen and proto2cpp.py
72+
FIND_PACKAGE(Doxygen)
73+
set(FILTER_PROTO2CPP_PY_PATH CACHE PATH "directory to the filter proto2cpp.py")
74+
75+
if(NOT DOXYGEN_FOUND)
76+
77+
message(WARNING "Doxygen could not be found.")
78+
79+
else()
80+
81+
if(NOT EXISTS ${FILTER_PROTO2CPP_PY_PATH}/proto2cpp.py)
82+
83+
message(WARNING "${FILTER_PROTO2CPP_PY_PATH}/proto2cpp.py could not be found.")
84+
85+
else()
86+
87+
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/doxygen_config.cmake.in)
88+
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
89+
90+
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
91+
92+
ADD_CUSTOM_TARGET(api_doc ALL
93+
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
94+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
95+
96+
endif(NOT EXISTS ${FILTER_PROTO2CPP_PY_PATH}/proto2cpp.py)
97+
98+
endif(NOT DOXYGEN_FOUND)

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ Open Simulation Interface (OSI)
33

44
[![Travis Build Status](https://travis-ci.org/OpenSimulationInterface/open-simulation-interface.svg?branch=master)](https://travis-ci.org/OpenSimulationInterface/open-simulation-interface)
55

6+
67
General description
78
-------------------
8-
https://www.hot.ei.tum.de/forschung/automotive-veroeffentlichungen/
9+
[TUM Department of Electrical and Computer Engineering](https://www.hot.ei.tum.de/forschung/automotive-veroeffentlichungen/)
910

1011

1112
Global remarks
@@ -38,13 +39,16 @@ Fault injection: how-to
3839
Injection of pre-defined sensor errors should be handled by a specialized "fault injector" component that acts like a
3940
sensor model component, i.e. it takes a SensorData message as input and returns a modified SensorData message as output.
4041
Specific errors should be handled as follows:
41-
- Ghost objects / false positive: An additional SensorDataObject is added to the list of objects in SensorData.object
42-
with SensorDataObject.model_internal_object.ground_truth_type set to kTypeGhost.
43-
- False negative: The object is marked as not seen by the sensor by setting the property
44-
SensorDataObject.model_internal_object.is_seen to false. The implementation of field-of-view calculation modules
45-
should respect this flag and never reset an object marked as not-seen to seen.
42+
- Ghost objects / false positive:
43+
An additional SensorDataObject is added to the list of objects in SensorData.object
44+
with SensorDataObject.model_internal_object.ground_truth_type set to kTypeGhost.
45+
- False negative:
46+
The object is marked as not seen by the sensor by setting the property
47+
SensorDataObject.model_internal_object.is_seen to false. The implementation
48+
of field-of-view calculation modules should respect this flag and never reset
49+
an object marked as not-seen to seen.
50+
4651

47-
4852
Versioning
4953
----------
5054
The version number is defined in InterfaceVersion::version_number in osi_common.proto as the field's default value.
@@ -70,9 +74,24 @@ The compatibility of both recorded files and code remains.
7074
- Changing or adding comments
7175
- Clarification of text passages explaining the message content
7276

77+
7378
Packaging
7479
---------
7580

7681
A specification to package sensor models using OSI as (extended)
7782
Functional Mock-up Units (FMUs) for use in simulation environments
7883
is available [here](https://github.com/OpenSimulationInterface/osi-sensor-model-packaging).
84+
85+
86+
Documentation
87+
-------------
88+
89+
In order to generate the doxygen documentation for OSI, please follow the following steps:
90+
1. Install [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html), set an environmental variable 'doxygen' with the path to the binary file and add it to the PATH variable: `PATH += %doxygen%`.
91+
2. Download the [vg-1.5.0.zip](https://github.com/vgteam/vg/releases/tag/v1.5.0). Unpack and copy the content of folder /vg-1.5.0/contrib/proto2cpp to your desired `<path-to-proto2cpp.py>`
92+
3. Install [graphviz-2.38](http://www.graphviz.org/Download_windows.php ), set an environmental variable 'graphviz' with the path to the binary file and add it to the PATH variable: `PATH += %graphviz%`.
93+
4. From the cmd navigate to the build directory and run:
94+
```cmd
95+
cmake -DFILTER_PROTO2CPP_PY_PATH=<path-to-proto2cpp.py> <path-to-CMakeLists.txt>
96+
```
97+
5. The build process will then generate the doxygen documentation under the directory doc.

doxygen_config.cmake.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#set the name and version of the project according to the configuration in CMakeLists.txt
2+
PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
3+
PROJECT_NUMBER = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
4+
5+
#Set input and output directories
6+
INPUT = "@CMAKE_CURRENT_SOURCE_DIR@"
7+
INPUT += "@CMAKE_CURRENT_SOURCE_DIR@/README.md"
8+
9+
USE_MDFILE_AS_MAINPAGE = "@CMAKE_CURRENT_SOURCE_DIR@/README.md"
10+
11+
OUTPUT_DIRECTORY = "@CMAKE_CURRENT_SOURCE_DIR@/doc"
12+
IMAGE_PATH = "@CMAKE_CURRENT_SOURCE_DIR@/doc/images"
13+
14+
# There is no standard configuration for .proto files documentation.
15+
# A Doxygen filter for .proto files has to be added under the directory doc/.
16+
JAVADOC_AUTOBRIEF = NO
17+
EXTENSION_MAPPING = proto=C
18+
FILE_PATTERNS = *.proto
19+
INPUT_FILTER = "python @FILTER_PROTO2CPP_PY_PATH@/proto2cpp.py"
20+
HAVE_DOT = YES
21+

0 commit comments

Comments
 (0)