Skip to content

Commit

Permalink
add sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Graeter committed Feb 10, 2024
1 parent e44e240 commit 56f276d
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 13 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,23 @@ jobs:
with:
working-directory: './docs'
doxyfile-path: './Doxyfile'
- name: test docs
run: |
ls docs/html
ls -lah docs/html

- name: Install sphinx
working-directory: './docs'
run : |
sudo apt-get update
sudo apt-get install -y python3 python3-pip
pip3 install -r requirements.txt
# - name: Deploy Documentation
# uses: peaceiris/actions-gh-pages@v3
# if: github.ref == 'refs/heads/main'
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/html
- name: Build sphinx
working-directory: './docs'
run : |
make html
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./docs/html/html
source: ./docs/_build/html
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
10 changes: 8 additions & 2 deletions docs/Doxyfile → docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,26 @@ GENERATE_MEMBER_DESCRIPTION = YES
OUTPUT_FORMAT = html

# Output directory
OUTPUT_DIRECTORY = html
OUTPUT_DIRECTORY = "_build"

# Generate navigation tree
GENERATE_TREEVIEW = YES

# Generate index with all symbols
# Generate index with all symbol
GENERATE_INDEX = YES

GENERATE_XML = YES

# Highlight code using a lexer (e.g., cpp)
USE_CLANG_STYLE_HIGHLIGHTING = YES

MARKDOWN_SUPPORT = YES
USE_MDFILE_AS_MAINPAGE = ../README.md

VERBATIM_HEADERS = NO

GENERATE_LATEX = NO

# Customize HTML templates (optional)
# TEMPLATE_RELATIVIZE_LINKS = YES
# TEMPLATE_FILES = my_templates
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1 change: 1 addition & 0 deletions docs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://medium.com/practical-coding/c-documentation-with-doxygen-cmake-sphinx-breathe-for-those-of-use-who-are-totally-lost-part-2-21f4fb1abd9f
80 changes: 80 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

from sphinx.builders.html import StandaloneHTMLBuilder
import glob
#import subprocess

# Doxygen
#subprocess.call('doxygen Doxyfile.in', shell=True)

project = 'Anywho'
copyright = '2024, Johannes Graeter'
author = 'Johannes Graeter'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.autosectionlabel',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx_sitemap',
'sphinx.ext.inheritance_diagram',
'breathe'
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

highlight_language = 'c++'



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_theme_options = {
'canonical_url': '',
'analytics_id': '',
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,

'logo_only': False,

# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
}
html_static_path = ['_static']
html_baseurl = 'base'

breathe_projects = {
"Anywho": "_build/xml/"
}

breathe_projects_source = {
"Anywho" : ( "../include/", [x for x in glob.glob("../include")])
}
breathe_default_project = "Anywho"
breathe_default_members = ('members', 'undoc-members')


16 changes: 16 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. Anywho documentation master file, created by sphinx-quickstart
You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive.
Welcome to Anywho's documentation!
======================================================
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Anywho
======
.. autodoxygenindex::
:project: Anywho
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@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

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
breathe
sphinx_rtd_theme
sphinx_sitemap

0 comments on commit 56f276d

Please sign in to comment.