Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/config/cmake/doxygen/doxygen_makeall.cmake

raw
1 #---------------------------------------------------------------------
2 # Helper functions.
3 #---------------------------------------------------------------------
4 function(doxygen_module_has_changed _module _modname _changed)
5 set(changed TRUE)
6
7 # check if we need to build this
8 if(Subversion_FOUND AND EXISTS ${DOXYGEN_SOURCE_DIR}/${_module}/.svn)
9 Subversion_WC_INFO(${DOXYGEN_SOURCE_DIR}/${_module} ${_modname})
10
11 if(DOXYGEN_${_modname}_LAST_BUILD_REV)
12 if(NOT ${_modname}_WC_LAST_CHANGED_REV GREATER ${DOXYGEN_${_modname}_LAST_BUILD_REV})
13 # check whether there are uncommitted modifications
14 execute_process(
15 COMMAND "${Subversion_SVN_EXECUTABLE}"
16 status "${DOXYGEN_SOURCE_DIR}/${_module}"
17 OUTPUT_VARIABLE svn_log_output
18 OUTPUT_STRIP_TRAILING_WHITESPACE
19 )
20
21 if(NOT svn_log_output)
22 set(changed FALSE)
23 endif()
24 endif()
25 endif()
26
27 # Save the last revision built (or attempted to build).
28 if(${_modname}_WC_REVISION)
29 file(APPEND "${CMAKE_BINARY_DIR}/doxygen_last_build_rev.cmake"
30 "set(DOXYGEN_${_modname}_LAST_BUILD_REV ${${_modname}_WC_REVISION})\n"
31 )
32 endif()
33 endif()
34
35 set(${_changed} ${changed} PARENT_SCOPE)
36 endfunction()
37
38 function(_print_header _index_html)
39 set(title "VXL Documentation")
40 file(READ "${DOXYGEN_SCRIPT_DIR}/doxy_header.html" index_html)
41 string(CONFIGURE "${index_html}" index_html @ONLY)
42 set(index_html "${index_html}
43 <h1>VXL Documentation</h1>
44 <p>C++ Libraries for Computer Vision Research and Implementation</p>
45 <hr />"
46 )
47 set(${_index_html} "${index_html}" PARENT_SCOPE)
48 endfunction()
49
50 function(_print_book_links _index_html)
51 set(index_html "${${_index_html}}")
52 foreach(book ${DOXYGEN_BOOK_LIST})
53 string(REPLACE / _ bname ${book})
54 set(index_html "${index_html}
55 <a href=\"books/${book}/book.html\">
56 ${book} : ${DOXYGEN_${bname}_BOOK_DESCRIPTION}
57 </a>
58 <br />"
59 )
60 endforeach()
61 set(${_index_html} "${index_html}" PARENT_SCOPE)
62 endfunction()
63
64 function(_print_library_links _index_html)
65 set(index_html "${${_index_html}}")
66 foreach(package ${DOXYGEN_PACKAGE_LIST})
67 string(REPLACE / _ packname ${package})
68 if(DOXYGEN_${packname}_LIBRARY_LIST)
69 set(index_html "${index_html}
70 <h3>${package} : ${DOXYGEN_${packname}_DESCRIPTION}</h3>
71 <blockquote>"
72 )
73 foreach(library ${DOXYGEN_${packname}_LIBRARY_LIST})
74 string(REPLACE / _ libname ${library})
75 string(REGEX REPLACE ".*/" "" lib ${library})
76 if(DOXYGEN_${libname}_DESCRIPTION)
77 set(index_html "${index_html}
78 <a href=\"${library}/html/index.html\">
79 ${lib} : ${DOXYGEN_${libname}_DESCRIPTION}
80 </a>
81 <br />"
82 )
83 else()
84 set(index_html "${index_html}
85 <a href=\"${library}/html/index.html\">${lib}</a><br />"
86 )
87 endif()
88 endforeach()
89 set(index_html "${index_html}
90 </blockquote>"
91 )
92 endif()
93 endforeach()
94 set(${_index_html} "${index_html}" PARENT_SCOPE)
95 endfunction()
96
97 function(_print_footer _index_html)
98 set(index_html "${${_index_html}}")
99 execute_process(
100 COMMAND ${PERL_EXECUTABLE}
101 -e "$date = localtime(time()); print $date"
102 OUTPUT_VARIABLE date
103 OUTPUT_STRIP_TRAILING_WHITESPACE
104 )
105 set(index_html "${index_html}
106 <h2>Download</h2>
107 See the <a href=\"https://vxl.github.io/\">VXL Homepage</a>.
108 The source for VXL can be downloaded from
109 <a href=\"http://sourceforge.net/projects/vxl\">
110 sourceforge.net/projects/vxl
111 </a>
112 <br />
113 <hr />
114 <h2>Search this Documentation Tree - using Google Site Search</h2>
115 <form method=\"get\" action=\"http://www.google.com/search\">
116 <input type=\"text\"
117 name=\"q\" size=\"31\" maxlength=\"255\" value=\"\" />
118 <input type=\"submit\" value=\"Google Search\" /><br />
119 <input type=\"radio\" name=\"sitesearch\" value=\"\" />
120 The Web<br />
121 <input type=\"radio\" name=\"sitesearch\"
122 value=\"paine.wiau.man.ac.uk/pub/doc_vxl/\" checked />
123 Manchester VXL Documentation<br />
124 <input type=\"radio\" name=\"sitesearch\"
125 value=\"public.kitware.com/vxl/doc/\">
126 Kitware VXL Documentation<br />
127 <input type=\"radio\" name=\"sitesearch\"
128 value=\"lems.brown.edu/vision/vxl_doc/\">
129 Brown VXL Documentation<br />
130 </form>
131 <br />
132 <hr />
133 Index generated by <em>config/cmake/doxygen/doxygen_makeall.cmake</em>
134 on ${date}.
135 <hr />
136 </body>
137 </html>"
138 )
139 set(${_index_html} "${index_html}" PARENT_SCOPE)
140 endfunction()
141
142 #---------------------------------------------------------------------
143 # Initial configuration.
144 #---------------------------------------------------------------------
145 # All the variables used in this script must be loaded from here.
146 include("${CMAKE_BINARY_DIR}/doxygen_configuration.cmake" OPTIONAL)
147
148 # Read in last revision built.
149 include("${CMAKE_BINARY_DIR}/doxygen_last_build_rev.cmake" OPTIONAL)
150
151 find_package(Subversion QUIET)
152
153 # Reset the file for new values.
154 file(WRITE "${CMAKE_BINARY_DIR}/doxygen_last_build_rev.cmake"
155 "# *** This is a auto-generated file. DO NOT edit! ***\n\n"
156 )
157
158 #---------------------------------------------------------------------
159 # Process each book.
160 #---------------------------------------------------------------------
161 foreach(book ${DOXYGEN_BOOK_LIST})
162 string(REPLACE / _ bname ${book})
163
164 doxygen_module_has_changed(${book}/doc/book ${bname}_book changed)
165 if(changed)
166 message(STATUS "Texi2html: ${book} being processed.")
167
168 set(book_source_dir "${DOXYGEN_SOURCE_DIR}/${book}/doc/book")
169 set(book_output_dir "${DOXYGEN_OUTPUT_DIR}/html/books/${book}")
170
171 file(GLOB image_list "${book_source_dir}/*.eps")
172 foreach(image ${image_list})
173 get_filename_component(output_image ${image} NAME_WE)
174
175 # copy if acceptable format is in source
176 set(image_copied FALSE)
177 foreach(ext png jpg jpeg)
178 if(EXISTS "${book_source_dir}/${output_image}.${ext}")
179 configure_file(
180 "${book_source_dir}/${output_image}.${ext}"
181 "${book_output_dir}/${output_image}.${ext}"
182 COPYONLY
183 )
184 set(image_copied TRUE)
185 break()
186 endif()
187 endforeach()
188
189 # convert eps image to png
190 if(NOT image_copied)
191 if(NetPBM_FOUND)
192 execute_process(
193 COMMAND ${PSTOPNM_EXECUTABLE} -portrait -stdout ${image}
194 COMMAND ${PNMTOPNG_EXECUTABLE}
195 OUTPUT_FILE "${book_output_dir}/${output_image}.png"
196 )
197 elseif(ImageMagick_FOUND)
198 execute_process(
199 COMMAND ${ImageMagick_convert_EXECUTABLE}
200 "${image}" "${output_image}.png"
201 WORKING_DIRECTORY "${book_output_dir}"
202 )
203 endif()
204 endif()
205 endforeach()
206
207 # copy texi files; else texi2html uses absolute paths for images
208 file(GLOB texifile_list RELATIVE "${book_source_dir}"
209 "${book_source_dir}/*.texi"
210 )
211 foreach(texifile ${texifile_list})
212 configure_file(
213 "${book_source_dir}/${texifile}"
214 "${book_output_dir}/${texifile}"
215 COPYONLY
216 )
217 endforeach()
218
219 execute_process(
220 COMMAND ${TEXI2HTML_EXECUTABLE}
221 -split=chapter -l2h -number -output=. -I=. book.texi
222 WORKING_DIRECTORY "${book_output_dir}"
223 OUTPUT_FILE
224 "${CMAKE_BINARY_DIR}/doxy/output/texi2html_${bname}.out"
225 ERROR_FILE
226 "${CMAKE_BINARY_DIR}/doxy/output/texi2html_${bname}.out"
227 )
228 else()
229 message(STATUS "Texi2html: ${book} previously processed.")
230 endif()
231 endforeach()
232
233 #---------------------------------------------------------------------
234 # Process each library.
235 #---------------------------------------------------------------------
236 file(MAKE_DIRECTORY "${DOXYGEN_OUTPUT_DIR}/tags")
237 foreach(library ${DOXYGEN_LIBRARY_LIST})
238 string(REPLACE / _ libname ${library})
239
240 doxygen_module_has_changed(${library} ${libname} changed)
241 if(changed)
242 message(STATUS "Doxygen: ${library} being processed.")
243
244 # generate dep list
245 set(prev_result 0)
246 list(REMOVE_DUPLICATES DOXYGEN_${libname}_DEPS)
247 list(LENGTH DOXYGEN_${libname}_DEPS result)
248 while(NOT result EQUAL prev_result)
249 set(prev_result ${result})
250 foreach(dep ${DOXYGEN_${libname}_DEPS})
251 string(REPLACE / _ depname ${dep})
252 if(DOXYGEN_${depname}_DEPS)
253 list(APPEND DOXYGEN_${libname}_DEPS ${DOXYGEN_${depname}_DEPS})
254 endif()
255 endforeach()
256 list(REMOVE_DUPLICATES DOXYGEN_${libname}_DEPS)
257 list(LENGTH DOXYGEN_${libname}_DEPS result)
258 endwhile()
259
260 # Work out how to get from current library to base
261 # (e.g., "dir1" -> "..", "dir1/dir2" -> "../..", etc).
262 string(REGEX REPLACE "[^/]+" .. relpath ${library})
263
264 # set tagfiles for configuring @tagfiles@ entry in doxyfile
265 set(tagfiles)
266 foreach(dep ${DOXYGEN_${libname}_DEPS})
267 string(REPLACE / _ depname ${dep})
268 set(tagfiles
269 "${tagfiles} \\\n \"${DOXYGEN_OUTPUT_DIR}/tags/${depname}.tag")
270 set(tagfiles
271 "${tagfiles} \\\n = ${relpath}/../${dep}/html\"")
272 endforeach()
273
274 # configure @tagfiles@ entry
275 configure_file(
276 "${CMAKE_BINARY_DIR}/doxy/output/doxyfile.${libname}"
277 "${CMAKE_BINARY_DIR}/doxy/output/doxyfile.${libname}"
278 )
279
280 file(MAKE_DIRECTORY "${DOXYGEN_OUTPUT_DIR}/html/${library}/html")
281 execute_process(
282 COMMAND
283 ${DOXYGEN_EXECUTABLE}
284 "${CMAKE_BINARY_DIR}/doxy/output/doxyfile.${libname}"
285 WORKING_DIRECTORY "${DOXYGEN_SOURCE_DIR}"
286 OUTPUT_FILE
287 "${CMAKE_BINARY_DIR}/doxy/output/${libname}.doxy_out"
288 ERROR_FILE
289 "${CMAKE_BINARY_DIR}/doxy/output/${libname}.doxy_out"
290 )
291 else()
292 message(STATUS "Doxygen: ${library} previously processed.")
293 endif()
294 endforeach()
295
296 #---------------------------------------------------------------------
297 # Build global index.
298 #---------------------------------------------------------------------
299 message(STATUS
300 "Doxygen: generating index at "
301 "${DOXYGEN_OUTPUT_DIR}/html/${DOXYGEN_INDEX_FILE}."
302 )
303
304 if(DOXYGEN_MERGE_DOCS_WITH)
305 set(external_books_tag "@external_books@")
306 set(external_libraries_tag "@external_libraries@")
307 set(external_books "-->")
308 _print_book_links(external_books)
309 set(external_books "${external_books}
310 <!-- @external_books_tag@ "
311 )
312
313 set(external_libraries "-->")
314 _print_library_links(external_libraries)
315 set(external_libraries "${external_libraries}
316 <!-- @external_libraries_tag@ "
317 )
318
319 file(READ "${DOXYGEN_OUTPUT_DIR}/html/${DOXYGEN_MERGE_DOCS_WITH}"
320 index_html
321 )
322 string(CONFIGURE "${index_html}" index_html)
323 else()
324 _print_header(index_html)
325 set(index_html "${index_html}
326 <h2>Overview Documentation</h2>
327 <a href=\"https://vxl.github.io\">VXL Homepage</a>
328 <br />
329 <br />
330 <p>
331 Overviews are compiled from the doc/book directory of each package.
332 </p>"
333 )
334 _print_book_links(index_html)
335 set(index_html "${index_html}
336 <!-- @external_books@ -->
337 <br />
338 <hr />
339 <h2>Library Documentation</h2>"
340 )
341 _print_library_links(index_html)
342 set(index_html "${index_html}
343 <!-- @external_libraries@ -->
344 <br />
345 <hr />"
346 )
347 _print_footer(index_html)
348 endif()
349
350 file(WRITE "${DOXYGEN_OUTPUT_DIR}/html/${DOXYGEN_INDEX_FILE}"
351 "${index_html}"
352 )