@@ -11,13 +11,20 @@
version: 2
build:
- os: ubuntu-22.04
+ os: ubuntu-24.04
tools:
python: "3.12"
apt_packages:
+ - autoconf
+ - autoconf-archive
# doxygen is available by default, but just in case.
- doxygen
+ - gi-docgen
+ - gir1.2-glib-2.0-dev
+ - gobject-introspection
- graphviz
+ - libtool
+ - pkg-config
sphinx:
configuration: docs/conf.py
@@ -32,6 +32,7 @@ DOCS_DEPS = \
cpp_request_config.rst \
Doxyfile \
index.rst \
+ glib_api.rst \
python_api.rst \
python_chip_info.rst \
python_chip.rst \
@@ -19,3 +19,4 @@ C library.
cpp_api
python_api
+ glib_api
@@ -62,8 +62,46 @@ def autodoc_skip_init(app, what, name, obj, would_skip, options):
return would_skip
+# We need to know where to put docs generated by gi-docgen but app.outdir is
+# only set once the builder is initialized. Let's delay running gi-docgen
+# until we're notified.
+def make_glib_docs(app):
+ # For some reason on RTD we're in the docs/ directory while during a local
+ # build, we're still in the top source directory.
+ prefix = "../" if os.getenv("READTHEDOCS") == "True" else ""
+
+ subprocess.run(
+ [
+ "gi-docgen",
+ "generate",
+ "--config",
+ f"{prefix}bindings/glib/gi-docgen.toml",
+ f"{prefix}bindings/glib/Gpiodglib-1.0.gir",
+ "--output-dir",
+ f"{app.outdir}",
+ ],
+ check=True,
+ )
+
+
def setup(app):
app.connect("autodoc-skip-member", autodoc_skip_init)
+ app.connect("builder-inited", make_glib_docs)
subprocess.run(["doxygen", "Doxyfile"])
+
+cwd = os.getcwd()
+os.chdir("..")
+subprocess.run(["autoreconf", "-ifv"], check=True)
+subprocess.run(
+ [
+ "./configure",
+ "--enable-tools",
+ "--enable-bindings-glib",
+ "--enable-introspection",
+ ],
+ check=True,
+)
+subprocess.run(["make", "-j"], check=True)
+os.chdir(cwd)
new file mode 100644
@@ -0,0 +1,23 @@
+..
+ SPDX-License-Identifier: CC-BY-SA-4.0
+ SPDX-FileCopyrightText: 2024-2025 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+
+..
+ This file is part of libgpiod.
+
+ libgpiod GObject API documentation
+
+libgpiod GObject bindings API
+=============================
+
+**GObject bindings** for libgpiod provide a high-level, object-oriented
+interface to interact with GPIO (General Purpose Input/Output) lines on Linux
+systems. These bindings leverage the **GObject framework**, commonly used in
+GNOME and GTK+ applications, to wrap the lower-level C API of libgpiod.
+
+.. warning::
+ The documentation for GObject bindings is generated using gi-docgen and
+ cannot be easily integrated with sphinx documentation. Please navigate to
+ a separate section dedicated exclusively to the GLib part of the API.
+
+`Navigate to GObject bindings documentation <Gpiodglib-1.0/index.html>`_