aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2023-10-12 15:10:23 +0200
committerFelix Morgner <felix.morgner@ost.ch>2023-10-12 15:10:23 +0200
commit0db25b0e76151c43a235ae627cf318b69745c2fb (patch)
treeed402c867bd9e3ba4d6b078fbd5f34850a169a59
parent557643b786e1de7a8a391f998130913cb30a242f (diff)
downloadteachos-0db25b0e76151c43a235ae627cf318b69745c2fb.tar.xz
teachos-0db25b0e76151c43a235ae627cf318b69745c2fb.zip
docs: enable sphinx HTML build
-rw-r--r--.gitignore3
-rw-r--r--docs/conf.py31
-rw-r--r--docs/index.rst13
-rw-r--r--requirements.txt3
-rw-r--r--source/CMakeLists.txt24
-rw-r--r--source/cmake/Modules/FindSphinx.cmake10
6 files changed, 80 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index f8af93d..8a5ffb8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
/.venv
/build
/.conan/install
+/docs/_build
# Conan Generated CMake presets
CMakeUserPresets.json
-.gdb_history \ No newline at end of file
+.gdb_history
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..90ed3dc
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,31 @@
+# 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
+
+project = "TeachOS Kernel"
+copyright = "2023, Felix Morgner"
+author = "Felix Morgner"
+
+# -- General configuration ---------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
+
+extensions = ["breathe"]
+
+templates_path = ["_templates"]
+exclude_patterns = []
+
+# -- Options Breathe ---------------------------------------------------------
+# https://breathe.readthedocs.io/en/stable/directives.html#config-values
+
+breathe_projects = {"kernel": "../build/doxygen/xml"}
+breathe_default_project = "kernel"
+
+# -- Options for HTML output -------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
+
+html_theme = "sphinx_book_theme"
+html_static_path = []
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 0000000..44e7617
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,13 @@
+Welcome to TeachOS Kernel's documentation!
+==========================================
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/requirements.txt b/requirements.txt
index 4479984..5468185 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,6 @@
black>=23
conan~=1.61
mypy~=1.5
+sphinx>=6,<7
+breathe~=4.35
+sphinx-book-theme~=1.0 \ No newline at end of file
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index b2dc9f1..215dd39 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -24,13 +24,31 @@ find_package("Doxygen")
set(DOXYGEN_GENERATE_HTML NO)
set(DOXYGEN_GENERATE_XML YES)
set(DOXYGEN_EXCLUDE_PATTERNS "*.cpp")
-set(DOXYGEN_OUTPUT_DIRECTORY "doxygen-xml")
+set(DOXYGEN_OUTPUT_DIRECTORY "doxygen")
set(DOXYGEN_QUIET YES)
+file(GLOB_RECURSE DOXYGEN_SOURCES CONFIGURE_DEPENDS "*.hpp")
+
doxygen_add_docs("docs"
- ${PROJECT_SOURCE_DIR}
+ ${DOXYGEN_SOURCES}
ALL
- COMMENT "Generating source documentation"
+ USE_STAMP_FILE
+ COMMENT "Generating developer documentation sources"
+)
+
+add_custom_command(TARGET "docs"
+ POST_BUILD
+ COMMAND "${SPHINX_BUILD_EXE}"
+ ARGS
+ "../docs"
+ "docs"
+ "-q"
+ COMMENT "Generating developer documentation html"
+)
+
+set_target_properties("docs" PROPERTIES
+ ADDITIONAL_CLEAN_FILES
+ "${PROJECT_BINARY_DIR}/doxygen;${PROJECT_BINARY_DIR}/docs"
)
#[============================================================================[
diff --git a/source/cmake/Modules/FindSphinx.cmake b/source/cmake/Modules/FindSphinx.cmake
new file mode 100644
index 0000000..a0a1c31
--- /dev/null
+++ b/source/cmake/Modules/FindSphinx.cmake
@@ -0,0 +1,10 @@
+include("FindPackageHandleStandardArgs")
+
+find_program(SPHINX_BUILD_EXE "sphinx-build"
+ HINTS "${PROJECT_SOURCE_DIR}/../.venv/bin"
+)
+
+find_package_handle_standard_args("Sphinx"
+ DEFAULT_MSG
+ SPHINX_BUILD_EXE
+)