initial commit

This commit is contained in:
Alexandre Foucher 2024-01-22 18:12:01 +01:00
commit b4895411c1
14 changed files with 189 additions and 0 deletions

6
cpp-example/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
CMakeFiles/
*.cmake
CMakeCache.txt
/Makefile
/my_project

View file

@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.0.0)
project(my_project VERSION 0.1.0 LANGUAGES C CXX)
add_compile_options(-std=c++17)
file(GLOB_RECURSE SRC_FILES
${PROJECT_SOURCE_DIR}/src/*.cpp
${PROJECT_SOURCE_DIR}/include/*.h
)
include_directories(${PROJECT_SOURCE_DIR}/include())
add_executable(my_project ${SRC_FILES})

1
cpp-example/docs/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/

View file

@ -0,0 +1,10 @@
# Doxyfile 1.8.17
PROJECT_NAME = "my_project"
INPUT = ../include
INPUT_ENCODING = UTF-8
RECURSIVE = YES
GENERATE_XML = YES
XML_OUTPUT = build/doxyxml
GENERATE_LATEX = NO
GENERATE_HTML = NO

22
cpp-example/docs/Makefile Normal file
View file

@ -0,0 +1,22 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
# help:
# @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@mkdir -p build
@doxygen ./Doxyfile.in
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

12
cpp-example/docs/conf.py Normal file
View file

@ -0,0 +1,12 @@
from cgitb import html
extensions = ["breathe"]
html_theme = "shibuya"
html_theme_options = {
"globaltoc_expand_depth": 1,
}
breathe_projects = {"my_project": "build/doxyxml/"}
breathe_default_project = "my_project"

View file

@ -0,0 +1,9 @@
driver.h
========
..
doxygenfile:: driver.h
.. doxygenfunction:: add
:project: my_project
:sections: parameters

View file

@ -0,0 +1,13 @@
Reference
=========
ROS est un méta-système d'exploitation à code source ouvert pour votre robot. Il fournit les services que vous attendez d'un système d'exploitation, notamment l'abstraction matérielle, le contrôle des périphériques de bas niveau, la mise en œuvre des fonctionnalités les plus courantes, le passage de messages entre les processus et la gestion des paquets.
.. toctree::
:maxdepth: 2
:caption: Contents:
driver.h
Lancement
---------

View file

@ -0,0 +1,21 @@
.. test documentation master file, created by
sphinx-quickstart on Fri Jan 19 17:24:42 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to test's documentation!
================================
.. toctree::
:maxdepth: 2
:caption: Contents:
cpp-reference/index
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

37
cpp-example/docs/make.bat Executable file
View file

@ -0,0 +1,37 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
mkdir build 2>nul
doxygen ./Doxyfile.in
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

View file

@ -0,0 +1,12 @@
/**
* @file driver.h
*/
/** @brief function short description
*
* function longer description if need
* @param[in] x description of parameter1
* @param[in] y description of parameter2
* @return return_name return description
*/
int add(int x, int y);

19
cpp-example/readme.md Normal file
View file

@ -0,0 +1,19 @@
<div align="center">
# Sphinx documentation for C / C++
</div>
## :wrench: Dependencies installation
```sh
pip3 install sphinx breathe
sudo apt-get install doxygen
```
## :rocket: Compile documentation
```sh
cd docs
make html
```

View file

@ -0,0 +1,6 @@
#include "driver.h"
int add(int x, int y)
{
return x + y;
}

9
cpp-example/src/main.cpp Normal file
View file

@ -0,0 +1,9 @@
#include <iostream>
#include "driver.h"
int main(int argc, char* argv[])
{
std::cout << "Hello, world!";
return 0;
}