Skip to content

Commit df154c1

Browse files
committed
docs: Add documentation generation
1 parent 1198d07 commit df154c1

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

src/CMakeLists.txt

+33-2
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,13 @@ if (INTROSPECTION)
6464
HINTS ${PC_g_ir_compiler}
6565
)
6666

67-
set(G_IR_SCANNER_CMD "${G_IR_SCANNER}")
6867
set(web_libpath "$<TARGET_FILE_DIR:webembed>")
6968

7069
add_custom_command (
7170
TARGET webembed
7271
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
7372
POST_BUILD
74-
COMMAND ${G_IR_SCANNER_CMD}
73+
COMMAND "${G_IR_SCANNER}"
7574
--warn-all --no-libtool --verbose
7675
--namespace=Web
7776
--nsversion=0.0
@@ -98,4 +97,36 @@ if (INTROSPECTION)
9897
-o ${web_libpath}/Web-0.0.typelib
9998
DEPENDS ${web_libpath}/Web-0.0.gir webembed
10099
)
100+
endif ()
101+
102+
# gi-docgen generate -C config.toml /usr/share/gir-1.0/Gtk-4.0.gir
103+
104+
if (DOCUMENTATION AND INTROSPECTION)
105+
find_package(PkgConfig)
106+
pkg_check_modules(GI_DOCGEN QUIET gi-docgen)
107+
108+
find_program(GI_DOCGEN gi-docgen
109+
HINTS ${PC_gi_docgen}
110+
)
111+
112+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
113+
set(EXTRA_SEARCH_PATH "/opt/homebrew/share/gir-1.0")
114+
else()
115+
set(EXTRA_SEARCH_PATH "")
116+
endif()
117+
118+
119+
add_custom_command (
120+
TARGET webembed
121+
POST_BUILD
122+
COMMAND "${GI_DOCGEN}"
123+
generate
124+
-C ${CMAKE_CURRENT_SOURCE_DIR}/config.toml
125+
${web_libpath}/Web-0.0.gir
126+
--output-dir ${CMAKE_CURRENT_BINARY_DIR}/../docs
127+
--add-include-path "${EXTRA_SEARCH_PATH}"
128+
--no-namespace-dir
129+
DEPENDS ${web_libpath}/Web-0.0.gir webembed
130+
)
131+
101132
endif ()

src/config.toml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[library]
2+
description = "LibWeb GTK"
3+
authors = "Matthew Jakeman"
4+
license = "BSD 2-Clause"
5+
browse_url = "https://github.com/mjakeman/libweb-gtk"
6+
repository_url = "https://github.com/mjakeman/libweb-gtk.git"
7+
website_url = "https://github.com/mjakeman/libweb-gtk"
8+
dependencies = [
9+
"GObject-2.0",
10+
"Gtk-4.0",
11+
"Soup-3.0"
12+
]
13+
14+
[dependencies."GObject-2.0"]
15+
name = "GObject"
16+
description = "The base type system library"
17+
docs_url = "https://docs.gtk.org/gobject/"
18+
19+
[dependencies."Gtk-4.0"]
20+
name = "Gtk"
21+
description = "The GTK toolkit"
22+
docs_url = "https://docs.gtk.org/gtk4/"
23+
24+
[dependencies."Soup-3.0"]
25+
name = "Soup"
26+
description = "HTTP client/server library for GNOME"
27+
docs_url = "https://libsoup.org/libsoup-3.0/"

0 commit comments

Comments
 (0)