From 55504d7250d98ccee026da6e69cd2c2e97a050d3 Mon Sep 17 00:00:00 2001 From: SofiaFaraci Date: Tue, 21 May 2024 16:10:40 +0200 Subject: [PATCH] edit following convince_docu_example for c++ Signed-off-by: SofiaFaraci --- .gitignore | 12 ++++++++ CMakeLists.txt => code/CMakeLists.txt | 14 ++++----- docs/Makefile | 3 +- docs/make.bat | 2 +- docs/requirements.txt | 6 ++-- docs/source/{Doxyfile => Doxyfile.in} | 10 +++---- docs/source/_static/css/custom.css | 4 +++ docs/source/api.rst | 9 ++++++ docs/source/conf.py | 41 ++++++++++++++------------- docs/source/index.rst | 2 +- 10 files changed, 66 insertions(+), 37 deletions(-) rename CMakeLists.txt => code/CMakeLists.txt (60%) rename docs/source/{Doxyfile => Doxyfile.in} (99%) create mode 100644 docs/source/api.rst diff --git a/.gitignore b/.gitignore index 68bc17f..703ce2f 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,15 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + + +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +.vscode +*.egg-info/ +*/build/ +*.pyc + +# Sphinx +API/ \ No newline at end of file diff --git a/CMakeLists.txt b/code/CMakeLists.txt similarity index 60% rename from CMakeLists.txt rename to code/CMakeLists.txt index b3572ea..b810158 100644 --- a/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -5,11 +5,11 @@ project(model2code) find_package(tinyxml2 CONFIG REQUIRED) -add_executable(${PROJECT_NAME} code/src/main.cpp) +add_executable(${PROJECT_NAME} src/main.cpp) target_include_directories(${PROJECT_NAME} PRIVATE ${TinyXML2_INCLUDE_DIRS} # Include TinyXML2 directories - ${CMAKE_CURRENT_SOURCE_DIR}/code/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/include/ ) @@ -22,11 +22,11 @@ install( ) target_sources( ${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/code/src/main.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/code/src/utils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/code/src/Generator.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/code/src/ExtractFromXML.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/code/src/ExtractFromElement.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/Generator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ExtractFromXML.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ExtractFromElement.cpp ) set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Command Line Tools") diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf..556d885 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -8,6 +8,7 @@ SPHINXBUILD ?= sphinx-build SOURCEDIR = source BUILDDIR = build + # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @@ -17,4 +18,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat index 6247f7e..fa98a78 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -32,4 +32,4 @@ goto end %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% :end -popd +popd \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 66be1c9..8b6606b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,7 @@ sphinx==7.1.2 sphinx-rtd-theme==1.3.0rc1 -sphinxcontrib-mermaid==0.9.2 -sphinxcontrib-plantuml==0.29 # sphinx-autodoc2==0.5.0 -myst-parser==3.0.1 +# myst-parser==3.0.1 +breathe==4.35.0 +exhale==0.3.7 \ No newline at end of file diff --git a/docs/source/Doxyfile b/docs/source/Doxyfile.in similarity index 99% rename from docs/source/Doxyfile rename to docs/source/Doxyfile.in index 53d0766..ec187fa 100644 --- a/docs/source/Doxyfile +++ b/docs/source/Doxyfile.in @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ./documentation +OUTPUT_DIRECTORY = ../build/doxygen # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -485,7 +485,7 @@ NUM_PROC_THREADS = 1 # normally produced when WARNINGS is set to YES. # The default value is: NO. -EXTRACT_ALL = YES +EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. @@ -864,7 +864,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = code/src code/include +INPUT = ../../code # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -2094,7 +2094,7 @@ MAN_LINKS = NO # captures the structure of the code including all documentation. # The default value is: NO. -GENERATE_XML = NO +GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -2254,7 +2254,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = +PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css index d081701..9f7f676 100644 --- a/docs/source/_static/css/custom.css +++ b/docs/source/_static/css/custom.css @@ -19,6 +19,10 @@ .wy-side-nav-search { background-color: darkgray; } +/* Top Navigation (relevant e.g. on mobile) */ +.wy-nav-top { + background-color: darkgray; +} /* Link on top of logo */ .wy-side-nav-search a { diff --git a/docs/source/api.rst b/docs/source/api.rst new file mode 100644 index 0000000..1a2ebe6 --- /dev/null +++ b/docs/source/api.rst @@ -0,0 +1,9 @@ +API +=== + +.. autosummary:: + :toctree: API + :template: custom-module-template.rst + :recursive: + + demopkg diff --git a/docs/source/conf.py b/docs/source/conf.py index 6a3737a..4f89967 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,5 +1,5 @@ # Configuration file for the Sphinx documentation builder. - +from cgitb import html # -- Project information project = 'MODEL2CODE' @@ -10,29 +10,32 @@ version = '0.1.0' # -- General configuration +# Breathe/exhale configuration +breathe_projects = {"model2code":"../build/doxygen/xml"} +breathe_default_project = "model2code" + +exhale_args = { + "containmentFolder" : "./API", + "rootFileName" : "api.rst", + "rootFileTitle" : "API", + "doxygenStripFromPath" : "..", + "createTreeView": True + } + +# Tell sphinx what the primary language being documented is. +primary_domain = 'cpp' + +# Tell sphinx what the pygments highlight language should be. +highlight_language = 'cpp' extensions = [ - # 'sphinx.ext.autosummary', - # 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', - "sphinx.ext.napoleon", - "autoapi.extension", - # 'myst_parser', - # 'sphinxcontrib.mermaid', - # 'sphinxcontrib.plantuml', - # 'autodoc2', + 'breathe', + 'exhale' ] -autoapi_options = [ - "members", - "undoc-members", - "show-inheritance", - "show-module-summary", - "imported-members", -] - -autoapi_dirs = ["../../src"] - # intersphinx_mapping = { # 'python': ('https://docs.python.org/3/', None), # 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), diff --git a/docs/source/index.rst b/docs/source/index.rst index cf32c18..e2036f0 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,4 +8,4 @@ Contents :maxdepth: 2 tutorials - api \ No newline at end of file + API/api \ No newline at end of file