Merge lp:~midori/midori/gtkdoc into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6416
Merged at revision: 6419
Proposed branch: lp:~midori/midori/gtkdoc
Merge into: lp:midori
Diff against target: 104 lines (+80/-0)
3 files modified
CMakeLists.txt (+5/-0)
cmake/GtkDoc.cmake (+61/-0)
docs/api/CMakeLists.txt (+14/-0)
To merge this branch: bzr merge lp:~midori/midori/gtkdoc
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+187922@code.launchpad.net

Commit message

Add USE_APIDOCS to build API docs with CMake

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

gtkdoc is a bitch… I kind got it to build something incomplete once, but then it started failing again in unexpected ways. And there's a ton of error messages.

Revision history for this message
Paweł Forysiuk (tuxator) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-09-26 22:40:31 +0000
3+++ CMakeLists.txt 2013-09-27 16:43:59 +0000
4@@ -134,6 +134,7 @@
5 option(HALF_BRO_INCOM_WEBKIT2 "Serve as a guniea pig" OFF)
6 option(USE_ZEITGEIST "Zeitgeist history integration" ON)
7 option(USE_GRANITE "Fancy notebook and pop-overs" OFF)
8+option(USE_APIDOCS "API documentation" OFF)
9
10 if (USE_GRANITE)
11 if (NOT USE_GTK3 AND NOT HALF_BRO_INCOM_WEBKIT2)
12@@ -240,3 +241,7 @@
13 enable_testing()
14 add_subdirectory (tests)
15 add_subdirectory (extensions)
16+
17+if (USE_APIDOCS)
18+ add_subdirectory (docs/api)
19+endif ()
20
21=== added file 'cmake/GtkDoc.cmake'
22--- cmake/GtkDoc.cmake 1970-01-01 00:00:00 +0000
23+++ cmake/GtkDoc.cmake 2013-09-27 16:43:59 +0000
24@@ -0,0 +1,61 @@
25+# GtkDoc.cmake
26+#
27+# Macros for building Midori API documentation.
28+# Copyright (C) 2013 Olivier Duchateau
29+
30+find_program (GTKDOC_SCAN_BIN gtkdoc-scan)
31+find_program (GTKDOC_MKDB_BIN gtkdoc-mkdb)
32+find_program (GTKDOC_MKHTML_BIN gtkdoc-mkhtml)
33+find_program (GTKDOC_MKTMPL_BIN gtkdoc-mktmpl)
34+
35+if (GTKDOC_SCAN_BIN AND GTKDOC_MKTMPL_BIN AND GTKDOC_MKDB_BIN
36+ AND GTKDOC_MKHTML_BIN)
37+
38+ set (GTKDOC_FOUND TRUE)
39+
40+ macro (gtkdoc_build module)
41+ message("gtkdoc: module ${module}")
42+ # file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module}")
43+ add_custom_target ("gtkdoc-scan_${module}" ALL
44+ ${GTKDOC_SCAN_BIN} --module=${module}
45+ --source-dir="${CMAKE_SOURCE_DIR}/${module}"
46+ --output-dir="${CMAKE_CURRENT_BINARY_DIR}/${module}"
47+ --rebuild-sections --rebuild-types
48+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
49+
50+ add_custom_target ("gtkdoc-tmpl_${module}" ALL
51+ ${GTKDOC_MKTMPL_BIN} --module=${module}
52+ --output-dir="${CMAKE_CURRENT_BINARY_DIR}"
53+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module}"
54+ DEPENDS "gtkdoc-scan_${module}")
55+
56+ add_custom_target ("gtkdoc-docbook_${module}" ALL
57+ ${GTKDOC_MKDB_BIN} --module=${module}
58+ --output-dir="xml"
59+ --source-dir="${CMAKE_SOURCE_DIR}/${module}"
60+ --source-suffixes=c,h --output-format=xml
61+ --default-includes=${module}/${module}.h
62+ --sgml-mode --main-sgml-file=${module}.sgml
63+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module}"
64+ DEPENDS "gtkdoc-tmpl_${module}")
65+
66+ # Keep this target alone, otherwise build fails
67+ add_custom_target ("gtkdoc-html_${module}" ALL
68+ ${GTKDOC_MKHTML_BIN} ${module}
69+ "${CMAKE_CURRENT_BINARY_DIR}/${module}/${module}.sgml"
70+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module}/html"
71+ DEPENDS "gtkdoc-docbook_${module}")
72+
73+ endmacro (gtkdoc_build module)
74+
75+ macro (gtkdoc module)
76+ file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module}/html")
77+ gtkdoc_build (${module})
78+
79+ set (DOC_DIR "html/midori-${MIDORI_MAJOR_VERSION}-${MIDORI_MINOR_VERSION}")
80+ install (DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module}/html/"
81+ DESTINATION "${CMAKE_INSTALL_DATADIR}/gtk-doc/${DOC_DIR}/${module}"
82+ PATTERN "html/*"
83+ PATTERN "index.sgml" EXCLUDE)
84+ endmacro (gtkdoc module)
85+endif ()
86
87=== added file 'docs/api/CMakeLists.txt'
88--- docs/api/CMakeLists.txt 1970-01-01 00:00:00 +0000
89+++ docs/api/CMakeLists.txt 2013-09-27 16:43:59 +0000
90@@ -0,0 +1,14 @@
91+# Copyright (C) 2013 Olivier Duchateau
92+
93+include (GtkDoc)
94+
95+if (GTKDOC_FOUND)
96+ list (APPEND MODULES "katze" "midori")
97+ foreach (MOD ${MODULES})
98+ if (EXISTS "${CMAKE_SOURCE_DIR}/${MOD}")
99+ gtkdoc (${MOD})
100+ endif ()
101+ endforeach ()
102+else ()
103+ message (FATAL_ERROR "gtk-doc not found")
104+endif ()

Subscribers

People subscribed via source and target branches

to all changes: