From 599f28fe73f70212c2e6357454e910e5cadcd1a0 Mon Sep 17 00:00:00 2001 From: light7734 Date: Mon, 3 Nov 2025 16:09:14 +0330 Subject: [PATCH] add breathe extension for Doxygen doc generation --- docs/.gitignore | 2 + docs/Doxyfile | 86 ++++++++++++++++++++++++++++++++++++++ docs/api/app.rst | 17 ++++++++ docs/api/renderer.rst | 13 ++++++ docs/conf.py | 14 +++++-- docs/generate_changelog.py | 68 ------------------------------ docs/index.rst | 8 ++-- docs/make.bat | 35 ---------------- 8 files changed, 133 insertions(+), 110 deletions(-) create mode 100644 docs/Doxyfile create mode 100644 docs/api/app.rst create mode 100644 docs/api/renderer.rst delete mode 100644 docs/generate_changelog.py delete mode 100644 docs/make.bat diff --git a/docs/.gitignore b/docs/.gitignore index 3c91b2b..a7d37a8 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,3 +1,5 @@ _build/ generated/ +html/ +xml/ diff --git a/docs/Doxyfile b/docs/Doxyfile new file mode 100644 index 0000000..9a239a9 --- /dev/null +++ b/docs/Doxyfile @@ -0,0 +1,86 @@ +TARGET = ./ +INPUT = "../modules" +RECURSIVE = YES + +PROJECT_NAME = "Light" +JAVADOC_AUTOBRIEF = YES +JAVADOC_BANNER = YES +GENERATE_XML = YES + +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO + +GENERATE_TODOLIST = NO +GENERATE_HTML = NO +GENERATE_DOCSET = NO +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +GENERATE_QHP = NO +GENERATE_ECLIPSEHELP = NO +GENERATE_TREEVIEW = NO +GENERATE_LATEX = NO +GENERATE_RTF = NO +GENERATE_MAN = NO +GENERATE_DOCBOOK = NO +GENERATE_AUTOGEN_DEF = NO +GENERATE_SQLITE3 = NO +GENERATE_PERLMOD = NO +GENERATE_TAGFILE = NO +GENERATE_LEGEND = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= NO + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cxxm \ + *.cpp \ + *.cppm \ + *.ccm \ + *.c++ \ + *.c++m \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.l \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice diff --git a/docs/api/app.rst b/docs/api/app.rst new file mode 100644 index 0000000..d6d9516 --- /dev/null +++ b/docs/api/app.rst @@ -0,0 +1,17 @@ +Application +=================================================================================================== +.. toctree:: + :maxdepth: 3 + :caption: App + +Functions +--------------------------------------------------------------------------------------------------- +.. doxygenfunction:: main + +Classes +--------------------------------------------------------------------------------------------------- +.. doxygenclass:: lt::app::ISystem + +.. doxygenstruct:: lt::app::TickInfo + +.. doxygenstruct:: lt::app::TickResult diff --git a/docs/api/renderer.rst b/docs/api/renderer.rst new file mode 100644 index 0000000..1d6c184 --- /dev/null +++ b/docs/api/renderer.rst @@ -0,0 +1,13 @@ +Renderer +=================================================================================================== +.. toctree:: + :maxdepth: 3 + :caption: App + +Classes +--------------------------------------------------------------------------------------------------- +.. doxygenenum:: lt::renderer::Api + +.. doxygenclass:: lt::renderer::System + +.. doxygenstruct:: lt::renderer::components::Sprite diff --git a/docs/conf.py b/docs/conf.py index e967f24..f15c28e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,13 +13,21 @@ author = 'light7734' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = [] +extensions = ['breathe'] + +breathe_projects = {"Light": "./xml"} +breathe_default_project = "Light" +breathe_default_members = () + +# Tell sphinx what the primary language being documented is. +primary_domain = 'cpp' + +# Tell sphinx what the pygments highlight language should be. +highlight_language = 'cpp' templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - - # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output diff --git a/docs/generate_changelog.py b/docs/generate_changelog.py deleted file mode 100644 index d9f252b..0000000 --- a/docs/generate_changelog.py +++ /dev/null @@ -1,68 +0,0 @@ -from git import Repo -import re - -repo = Repo(search_parent_directories=True) -assert not repo.bare - -file_path = "generated/changelog.rst" - -messages = [] -short_shas = [] -hex_shas = [] -logs = [] - -remote_url = "https://git.light7734.com/light7734/light/commit" -def format_log(commit_type, message, major, minor, patch, short_sha, hex_sha): - href = f"{remote_url}/{hex_sha}" - version = f"{major}.{minor}.{patch}-kitten+{short_sha}"; - link = f"`{version} <{remote_url}/{hex_sha}>`__" - return f"| **{message}** ({link})" - -for commit in repo.iter_commits(): - messages.append(commit.summary) - short_shas.append(repo.git.rev_parse(commit.hexsha, short=5)) - hex_shas.append(commit.hexsha) - -ver_major = 0 -ver_minor = 0 -ver_patch = 0 - -idx = len(messages) -for message in reversed(messages): - idx = idx - 1; - - commit_type = re.match("^(feat|fix|refactor|perf|build|asset|test|chore|ci|docs)", message) - if not commit_type: - continue - - match commit_type.group(0): - case "feat": - ver_minor = ver_minor + 1 - ver_patch = 0 - - case "fix": - ver_patch = ver_patch + 1 - - case "refactor": - ver_patch = ver_patch + 1 - - case "perf": - ver_patch = ver_patch + 1 - - case "build": - ver_patch = ver_patch + 1 - - case "asset": - ver_patch = ver_patch + 1 - - logs.append(format_log(commit_type, message, ver_major, ver_minor, ver_patch, short_shas[idx], hex_shas[idx])) - -with open(file_path, "w") as f: - f.write(".. changelogs\n\n\n") - f.write("Changelogs\n") - f.write("==================================================\n\n") - - f.write("KITTEN\n") - f.write("--------------------------------------------------\n\n") - for log in reversed(logs): - f.write(log + '\n') diff --git a/docs/index.rst b/docs/index.rst index 6675023..4c2df73 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,10 +23,10 @@ guidelines/conventions.rst .. toctree:: - :maxdepth: 2 - :caption: Generated Docs + :maxdepth: 3 + :caption: API - generated/api.rst - generated/changelog.rst + api/app.rst + api/renderer.rst diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 32bb245..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@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