From 69d5d2adde1d13578a94e8b1934235987cf9b2bd Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Wed, 6 Jan 2021 23:53:33 +0100
Subject: Switch to Meson

---
 doc/cpp/Doxyfile        | 40 ----------------------------------------
 doc/cpp/Doxyfile.in     | 32 ++++++++++++++++++++++++++++++++
 doc/cpp/api/meson.build |  5 +++++
 doc/cpp/meson.build     | 43 +++++++++++++++++++++++++++++++++++++++++++
 doc/cpp/wscript         | 44 --------------------------------------------
 doc/cpp/xml/meson.build | 21 +++++++++++++++++++++
 6 files changed, 101 insertions(+), 84 deletions(-)
 delete mode 100644 doc/cpp/Doxyfile
 create mode 100644 doc/cpp/Doxyfile.in
 create mode 100644 doc/cpp/api/meson.build
 create mode 100644 doc/cpp/meson.build
 delete mode 100644 doc/cpp/wscript
 create mode 100644 doc/cpp/xml/meson.build

(limited to 'doc/cpp')

diff --git a/doc/cpp/Doxyfile b/doc/cpp/Doxyfile
deleted file mode 100644
index 517ba05..0000000
--- a/doc/cpp/Doxyfile
+++ /dev/null
@@ -1,40 +0,0 @@
-PROJECT_NAME           = Pugl
-PROJECT_BRIEF          = "A minimal portable API for embeddable GUIs"
-
-QUIET                  = YES
-WARN_AS_ERROR          = YES
-WARN_IF_UNDOCUMENTED   = NO
-WARN_NO_PARAMDOC       = NO
-
-JAVADOC_AUTOBRIEF      = YES
-
-CASE_SENSE_NAMES       = YES
-EXCLUDE_SYMBOLS        = pugl::detail
-EXTRACT_LOCAL_CLASSES  = NO
-EXTRACT_PRIVATE        = NO
-HIDE_IN_BODY_DOCS      = YES
-HIDE_UNDOC_CLASSES     = YES
-HIDE_UNDOC_MEMBERS     = YES
-REFERENCES_LINK_SOURCE = NO
-
-GENERATE_HTML          = NO
-GENERATE_LATEX         = NO
-GENERATE_XML           = YES
-XML_PROGRAMLISTING     = NO
-SHOW_FILES             = NO
-
-MACRO_EXPANSION        = YES
-PREDEFINED             = PUGL_API PUGL_DISABLE_DEPRECATED PUGL_CONST_API= PUGL_CONST_FUNC=
-
-INPUT                  = ../../include/pugl/cairo.h \
-                         ../../include/pugl/gl.h \
-                         ../../include/pugl/pugl.h \
-                         ../../include/pugl/stub.h \
-                         ../../include/pugl/vulkan.h \
-                         ../../bindings/cxx/include/pugl/cairo.hpp \
-                         ../../bindings/cxx/include/pugl/gl.hpp \
-                         ../../bindings/cxx/include/pugl/pugl.hpp \
-                         ../../bindings/cxx/include/pugl/stub.hpp \
-                         ../../bindings/cxx/include/pugl/vulkan.hpp
-
-OUTPUT_DIRECTORY       = .
diff --git a/doc/cpp/Doxyfile.in b/doc/cpp/Doxyfile.in
new file mode 100644
index 0000000..889ac0b
--- /dev/null
+++ b/doc/cpp/Doxyfile.in
@@ -0,0 +1,32 @@
+PROJECT_NAME           = Pugl
+PROJECT_BRIEF          = "A minimal portable API for embeddable GUIs"
+
+QUIET                  = YES
+WARN_AS_ERROR          = YES
+WARN_IF_UNDOCUMENTED   = NO
+WARN_NO_PARAMDOC       = NO
+
+JAVADOC_AUTOBRIEF      = YES
+
+CASE_SENSE_NAMES       = YES
+EXCLUDE_SYMBOLS        = pugl::detail
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_PRIVATE        = NO
+HIDE_IN_BODY_DOCS      = YES
+HIDE_UNDOC_CLASSES     = YES
+HIDE_UNDOC_MEMBERS     = YES
+REFERENCES_LINK_SOURCE = NO
+
+GENERATE_HTML          = NO
+GENERATE_LATEX         = NO
+GENERATE_XML           = YES
+XML_PROGRAMLISTING     = NO
+SHOW_FILES             = NO
+
+MACRO_EXPANSION        = YES
+PREDEFINED             = PUGL_API PUGL_DISABLE_DEPRECATED PUGL_CONST_API= PUGL_CONST_FUNC=
+
+STRIP_FROM_PATH        = @PUGL_SRCDIR@
+INPUT                  = @PUGL_HEADERS@
+
+OUTPUT_DIRECTORY       = doc/cpp
diff --git a/doc/cpp/api/meson.build b/doc/cpp/api/meson.build
new file mode 100644
index 0000000..4bbbec2
--- /dev/null
+++ b/doc/cpp/api/meson.build
@@ -0,0 +1,5 @@
+cpp_pugl_rst = custom_target(
+  'C++ API ReST Documentation',
+  command: [dox_to_sphinx, '-l', 'cpp', '-f', '@INPUT@', 'doc/cpp/api'],
+  input: cpp_index_xml,
+  output: 'pugl.rst')
diff --git a/doc/cpp/meson.build b/doc/cpp/meson.build
new file mode 100644
index 0000000..d8bae11
--- /dev/null
+++ b/doc/cpp/meson.build
@@ -0,0 +1,43 @@
+config = configuration_data()
+config.set('PUGL_VERSION', meson.project_version())
+
+conf_py = configure_file(configuration: config,
+                         input: '../conf.py.in',
+                         output: 'conf.py')
+
+configure_file(copy: true, input: '../deployment.rst', output: 'deployment.rst')
+configure_file(copy: true, input: '../summary.rst', output: 'summary.rst')
+
+cpp_rst_files = files(
+  'index.rst',
+  'overview.rst',
+  'world.rst',
+  'view.rst',
+  'events.rst',
+  'event-loop.rst',
+)
+
+foreach f : cpp_rst_files
+  configure_file(copy: true, input: f, output: '@PLAINNAME@')
+endforeach
+
+subdir('xml')
+subdir('api')
+
+docs = custom_target(
+  'C++ API Documentation (singlehtml)',
+  command: [sphinx_build, '-M', 'singlehtml', 'doc/cpp/', 'doc/cpp/', '-E', '-q', '-t', 'singlehtml'],
+  input: [cpp_rst_files, cpp_pugl_rst, cpp_index_xml],
+  output: 'singlehtml',
+  build_by_default: true,
+  install: true,
+  install_dir: docdir / 'puglxx-0')
+
+docs = custom_target(
+  'C++ API Documentation (html)',
+  command: [sphinx_build, '-M', 'html', 'doc/cpp/', 'doc/cpp/', '-E', '-q', '-t', 'html'],
+  input: [cpp_rst_files, cpp_pugl_rst, cpp_index_xml],
+  output: 'html',
+  build_by_default: true,
+  install: true,
+  install_dir: docdir / 'puglxx-0')
diff --git a/doc/cpp/wscript b/doc/cpp/wscript
deleted file mode 100644
index 4bef6c2..0000000
--- a/doc/cpp/wscript
+++ /dev/null
@@ -1,44 +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/pugl.svg", "sphinx/_static/pugl.svg"),
-        ("../deployment.rst", "sphinx/deployment.rst"),
-        ("../summary.rst", "sphinx/summary.rst"),
-        ("event-loop.rst", "sphinx/event-loop.rst"),
-        ("events.rst", "sphinx/events.rst"),
-        ("index.rst", "sphinx/index.rst"),
-        ("overview.rst", "sphinx/overview.rst"),
-        ("view.rst", "sphinx/view.rst"),
-        ("world.rst", "sphinx/world.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",
-        PUGL_VERSION=bld.env.PUGL_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() + " -l cpp -f ${SRC} ${TGT}",
-        source=index_xml,
-        target="sphinx/api/")
-
-    # Run Sphinx to generate HTML documentation
-    doc_dir = bld.env.DOCDIR + "/pugl-%s/" % bld.env.PUGL_MAJOR_VERSION
-    bld(features="sphinx",
-        sphinx_source=bld.path.get_bld().make_node("sphinx"),
-        sphinx_output_format="singlehtml",
-        sphinx_options=["-E", "-q", "-t", "singlehtml"],
-        install_path=doc_dir + "cpp/singlehtml/")
diff --git a/doc/cpp/xml/meson.build b/doc/cpp/xml/meson.build
new file mode 100644
index 0000000..3f87f2a
--- /dev/null
+++ b/doc/cpp/xml/meson.build
@@ -0,0 +1,21 @@
+doxygen = find_program('doxygen')
+
+cpp_doxygen_input = []
+foreach h : c_headers + cpp_headers
+  cpp_doxygen_input += ['..' / h]
+endforeach
+
+config = configuration_data()
+config.set('PUGL_HEADERS', ' '.join(cpp_doxygen_input))
+config.set('PUGL_SRCDIR', pugl_src_root)
+
+cpp_doxyfile = configure_file(configuration: config,
+                              input: '../Doxyfile.in',
+                              output: 'Doxyfile')
+
+cpp_index_xml = custom_target(
+  'cpp-index.xml',
+  command: [doxygen, '@INPUT0@'],
+  input: [cpp_doxyfile] + c_header_files + cpp_header_files,
+  output: 'index.xml')
+
-- 
cgit v1.2.1