aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/_static/serd.svg20
-rw-r--r--doc/c/Doxyfile.in (renamed from doc/c/Doxyfile)9
-rw-r--r--doc/c/api/meson.build6
-rw-r--r--doc/c/meson.build52
-rw-r--r--doc/c/wscript41
-rw-r--r--doc/c/xml/meson.build18
-rw-r--r--doc/conf.py.in7
-rw-r--r--doc/meson.build38
8 files changed, 144 insertions, 47 deletions
diff --git a/doc/_static/serd.svg b/doc/_static/serd.svg
new file mode 100644
index 00000000..570a4f98
--- /dev/null
+++ b/doc/_static/serd.svg
@@ -0,0 +1,20 @@
+<svg height="128" viewBox="0 0 33.867 33.867" width="128" xmlns="http://www.w3.org/2000/svg">
+ <g stroke="#444" stroke-linejoin="round" stroke-width="1.058">
+ <path d="M26.726 7.14h6.529V.613h-6.529z" fill="#fff" fill-rule="evenodd"/>
+ <path d="M26.726 7.14h6.529V.613h-6.529z" fill="none"/>
+ <path d="M13.67 7.14h6.528V.613h-6.529z" fill="#fff" fill-rule="evenodd"/>
+ <path d="M13.67 7.14h6.528V.613h-6.529z" fill="none"/>
+ <path d="M.612 7.14h6.529V.613H.612z" fill="#fff" fill-rule="evenodd"/>
+ <path d="M.612 7.14h6.529V.613H.612z" fill="none"/>
+ <path d="M26.726 33.255h6.529v-6.529h-6.529z" fill="#fff" fill-rule="evenodd"/>
+ <path d="M26.726 33.255h6.529v-6.529h-6.529z" fill="none"/>
+ <path d="M13.67 33.255h6.528v-6.529h-6.529z" fill="#fff" fill-rule="evenodd"/>
+ <path d="M13.67 33.255h6.528v-6.529h-6.529z" fill="none"/>
+ <path d="M.612 33.255h6.529v-6.529H.612z" fill="#fff" fill-rule="evenodd"/>
+ <path d="M.612 33.255h6.529v-6.529H.612z" fill="none"/>
+ <path d="M13.67 20.198h6.528v-6.529h-6.529z" fill="#fff" fill-rule="evenodd"/>
+ <g fill="none">
+ <path d="M13.67 20.198h6.528v-6.529h-6.529zM20.198 3.876h6.528M7.14 3.876h6.53M7.14 7.14l6.53 6.53M20.198 20.198l6.528 6.528M7.14 29.99h6.53M20.198 29.99h6.528"/>
+ </g>
+ </g>
+</svg>
diff --git a/doc/c/Doxyfile b/doc/c/Doxyfile.in
index 600e0e94..12d0440b 100644
--- a/doc/c/Doxyfile
+++ b/doc/c/Doxyfile.in
@@ -2,12 +2,13 @@ PROJECT_NAME = Serd
PROJECT_BRIEF = "A lightweight C library for working with RDF data"
QUIET = YES
-WARN_AS_ERROR = NO
+WARN_AS_ERROR = YES
WARN_IF_UNDOCUMENTED = NO
WARN_NO_PARAMDOC = NO
JAVADOC_AUTOBRIEF = YES
+FULL_PATH_NAMES = NO
CASE_SENSE_NAMES = YES
HIDE_IN_BODY_DOCS = YES
REFERENCES_LINK_SOURCE = NO
@@ -28,6 +29,8 @@ PREDEFINED = SERD_ALLOCATED \
SERD_NULLABLE= \
SERD_PURE_FUNC=
-INPUT = ../../include/serd/serd.h
+RECURSIVE = YES
+STRIP_FROM_PATH = @SERD_SRCDIR@
+INPUT = @SERD_SRCDIR@/include
-OUTPUT_DIRECTORY = .
+OUTPUT_DIRECTORY = @DOX_OUTPUT@
diff --git a/doc/c/api/meson.build b/doc/c/api/meson.build
new file mode 100644
index 00000000..bc75345a
--- /dev/null
+++ b/doc/c/api/meson.build
@@ -0,0 +1,6 @@
+c_serd_rst = custom_target(
+ 'serd.rst',
+ command: [dox_to_sphinx, '-f', '@INPUT0@', '@OUTDIR@'],
+ input: [c_index_xml] + c_rst_files,
+ output: 'serd.rst',
+)
diff --git a/doc/c/meson.build b/doc/c/meson.build
new file mode 100644
index 00000000..ee104b13
--- /dev/null
+++ b/doc/c/meson.build
@@ -0,0 +1,52 @@
+config = configuration_data()
+config.set('SERD_VERSION', meson.project_version())
+config.set('SERD_SRCDIR', serd_src_root)
+config.set('SERD_TITLE', get_option('title'))
+
+conf_py = configure_file(
+ configuration: config,
+ input: files('../conf.py.in'),
+ output: 'conf.py',
+)
+
+configure_file(
+ copy: true,
+ input: files('../summary.rst'),
+ output: 'summary.rst',
+)
+
+c_rst_files = files(
+ 'index.rst',
+ 'overview.rst',
+)
+
+foreach f : c_rst_files
+ configure_file(copy: true, input: f, output: '@PLAINNAME@')
+endforeach
+
+subdir('xml')
+subdir('api')
+
+# TODO: Add install_tag: 'doc' after requiring meson 0.60.0
+
+custom_target(
+ 'singlehtml',
+ build_by_default: true,
+ command: [sphinx_build, '-M', 'singlehtml', '@OUTDIR@', '@OUTDIR@',
+ '-E', '-q', '-t', 'singlehtml'],
+ input: [c_rst_files, c_serd_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / versioned_name,
+ output: 'singlehtml',
+)
+
+custom_target(
+ 'html',
+ build_by_default: true,
+ command: [sphinx_build, '-M', 'html', '@OUTDIR@', '@OUTDIR@',
+ '-E', '-q', '-t', 'html'],
+ input: [c_rst_files, c_serd_rst, c_index_xml],
+ install: true,
+ install_dir: docdir / versioned_name,
+ output: 'html',
+)
diff --git a/doc/c/wscript b/doc/c/wscript
deleted file mode 100644
index 9a524e3a..00000000
--- a/doc/c/wscript
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-
-def build(bld):
- dox_to_sphinx = bld.path.find_node("../../scripts/dox_to_sphinx.py")
- index_xml = bld.path.get_bld().make_node("xml/index.xml")
-
- files = [
- ("../../resources/serd.svg", "sphinx/_static/serd.svg"),
- ("../summary.rst", "sphinx/summary.rst"),
- ("index.rst", "sphinx/index.rst"),
- ("overview.rst", "sphinx/overview.rst"),
- ]
-
- # Run Doxygen to generate XML documentation
- bld(features="doxygen", doxyfile="Doxyfile")
-
- # Substitute variables to make Sphinx configuration file
- bld(features="subst",
- source="../conf.py.in",
- target="sphinx/conf.py",
- SERD_VERSION=bld.env.SERD_VERSION)
-
- # Copy static documentation files to Sphinx build directory
- for f in files:
- bld(features="subst", is_copy=True, source=f[0], target=f[1])
-
- # Generate Sphinx markup from Doxygen XML
- bld.add_group()
- bld(rule="${PYTHON} " + dox_to_sphinx.abspath() + " -f ${SRC} ${TGT}",
- source=index_xml,
- target="sphinx/api/")
-
- doc_dir = bld.env.DOCDIR + "/serd-%s/" % bld.env.SERD_MAJOR_VERSION
-
- # Run Sphinx to generate HTML documentation
- for builder in ["html", "singlehtml"]:
- bld(features="sphinx",
- sphinx_source=bld.path.get_bld().make_node("sphinx"),
- sphinx_output_format=builder,
- sphinx_options=["-E", "-q", "-t", builder],
- install_path=doc_dir + "c/%s/" % builder)
diff --git a/doc/c/xml/meson.build b/doc/c/xml/meson.build
new file mode 100644
index 00000000..a49e2754
--- /dev/null
+++ b/doc/c/xml/meson.build
@@ -0,0 +1,18 @@
+doxygen = find_program('doxygen')
+
+config = configuration_data()
+config.set('SERD_SRCDIR', serd_src_root)
+config.set('DOX_OUTPUT', meson.current_build_dir() / '..')
+
+c_doxyfile = configure_file(
+ configuration: config,
+ input: files('../Doxyfile.in'),
+ output: 'Doxyfile',
+)
+
+c_index_xml = custom_target(
+ 'index.xml',
+ command: [doxygen, '@INPUT0@'],
+ input: [c_doxyfile] + c_headers,
+ output: 'index.xml',
+)
diff --git a/doc/conf.py.in b/doc/conf.py.in
index de3f183c..af0ea25a 100644
--- a/doc/conf.py.in
+++ b/doc/conf.py.in
@@ -1,6 +1,6 @@
# Project information
-project = "Serd"
+project = "@SERD_TITLE@"
copyright = "2022, David Robillard"
author = "David Robillard"
release = "@SERD_VERSION@"
@@ -47,9 +47,10 @@ nitpick_ignore = list(map(lambda x: ("c:identifier", x), _opaque))
# HTML output
-html_static_path = ["_static"]
html_copy_source = False
-html_short_title = "Serd"
+html_short_title = "@SERD_TITLE@"
+html_static_path = ["@SERD_SRCDIR@/doc/_static"]
+html_theme = "sphinx_lv2_theme"
if have_lv2_theme:
html_theme = "sphinx_lv2_theme"
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 00000000..13ce7f1d
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,38 @@
+docdir = get_option('datadir') / 'doc'
+
+doxygen = find_program('doxygen', required: get_option('docs'))
+dox_to_sphinx = files('../scripts/dox_to_sphinx.py')
+sphinx_build = find_program('sphinx-build', required: get_option('docs'))
+mandoc = find_program('mandoc', required: false)
+
+build_docs = doxygen.found() and sphinx_build.found()
+
+if build_docs
+ subdir('c')
+endif
+
+mandoc_css = files('mandoc.css')
+
+if not get_option('tests').disabled()
+ stylelint = find_program('stylelint', required: false)
+ if stylelint.found()
+ test('stylelint', stylelint, args: [mandoc_css], suite: 'data')
+ endif
+endif
+
+if mandoc.found()
+ configure_file(input: mandoc_css, output: '@PLAINNAME@', copy: true)
+
+ serdi_html = custom_target(
+ 'serdi.html',
+ build_by_default: true,
+ capture: true,
+ command: [mandoc, '-Thtml', '-Werror', '-O', 'style=mandoc.css', '@INPUT@'],
+ input: files('serdi.1'),
+ output: 'serdi.html',
+ )
+endif
+
+if not meson.is_subproject()
+ summary('API Documentation', build_docs, bool_yn: true)
+endif