diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 000000000..3d8a6cd3c --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +api +xml diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..78cff35a5 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,72 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'libkiwix' +copyright = '2021, libzim-team' +author = 'libzim-team' + + +# -- General configuration --------------------------------------------------- + +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'breathe', + 'exhale' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +if not on_rtd: + html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +breathe_projects = { + "libkiwix": "./xml" +} +breathe_default_project = 'libkiwix' + +exhale_args = { + "containmentFolder": "./api", + "rootFileName": "ref_api.rst", + "rootFileTitle": "Reference API", + "doxygenStripFromPath":"..", + "treeViewIsBootstrap": True, + "createTreeView" : True, + "exhaleExecutesDoxygen": True, + "exhaleDoxygenStdin": "INPUT = ../include" +} + +primary_domain = 'cpp' + +highlight_language = 'cpp' diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..20b189e57 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,14 @@ +.. libkiwix documentation master file, created by + sphinx-quickstart on Fri Jul 24 15:40:50 2020. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to libzim's documentation! +================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + usage + api/ref_api diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 000000000..71d4fc560 --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,7 @@ + +sphinx = find_program('sphinx-build', native:true) + +sphinx_target = run_target('doc', + command: [sphinx, '-bhtml', + meson.current_source_dir(), + meson.current_build_dir()]) diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 000000000..d805c256d --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +breathe +exhale +sphinx<4 diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 000000000..48faf6a27 --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,17 @@ +Libkiwix programming +==================== + +Introduction +------------ + +libkiwix is written in C++. To use the library, you need the include files of libkiwix have +to link against libzim. + +Errors are handled with exceptions. When something goes wrong, libzim throws an error, +which is always derived from std::exception. + +All classes are defined in the namespace kiwix. + +libkiwix is a set of tools to manage zim files and provide some common functionnality. +While libkiwix has some wrappers around libzim classes, they are deprecated and will be removed +in the future. diff --git a/meson.build b/meson.build index 403c81a82..b09f65579 100644 --- a/meson.build +++ b/meson.build @@ -78,6 +78,9 @@ subdir('scripts') subdir('static') subdir('src') subdir('test') +if get_option('doc') + subdir('docs') +endif pkg_requires = ['libzim', 'icu-i18n', 'pugixml', 'libcurl', 'libmicrohttpd', 'xapian-core'] diff --git a/meson_options.txt b/meson_options.txt index fbcf81d6f..51ec0ff39 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,4 @@ option('wrapper', type:'array', choices:['java', 'android'], value:[], description: 'The wrapper to generate.') +option('doc', type : 'boolean', value : false, + description : 'Build the documentations.')