]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Provide the basic building blocks to hook in the code gallery.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 31 Dec 2015 04:21:08 +0000 (22:21 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 5 Jan 2016 02:53:53 +0000 (20:53 -0600)
In particular, track dependencies and set up a stub for generating doxygen input.

doc/doxygen/CMakeLists.txt
doc/doxygen/code-gallery/CMakeLists.txt
doc/doxygen/scripts/make_gallery.pl [new file with mode: 0644]

index c37070dbef52f40d24b1022f0d6aaa7343b37475..490454dcaf572d45abe15ca478eb1c7b0e1c226f 100644 (file)
@@ -124,6 +124,7 @@ LIST(APPEND _doxygen_depend
   ${CMAKE_CURRENT_BINARY_DIR}/tutorial/tutorial.h
   )
 
+# find all tutorial programs so we can add dependencies as appropriate
 FILE(GLOB _deal_ii_steps
   ${CMAKE_SOURCE_DIR}/examples/step-*
   )
@@ -137,6 +138,26 @@ FOREACH(_step ${_deal_ii_steps})
     )
 ENDFOREACH()
 
+# Also find all code gallery programs (if available) for the same reason.
+# The logic here follows the same as in code-gallery/CMakeLists.txt
+SET_IF_EMPTY(DEAL_II_CODE_GALLERY_DIRECTORY ${CMAKE_SOURCE_DIR}/code-gallery)
+IF (EXISTS ${DEAL_II_CODE_GALLERY_DIRECTORY}/README.md)
+  FILE(GLOB _code_gallery_names
+       "${DEAL_II_CODE_GALLERY_DIRECTORY}/*/doc/author")
+  STRING(REGEX REPLACE "/+doc/+author" "" _code_gallery_names "${_code_gallery_names}")
+
+  FOREACH(_step ${_code_gallery_names})
+    GET_FILENAME_COMPONENT(_step "${_step}" NAME)
+
+    LIST(APPEND _doxygen_depend
+      ${CMAKE_CURRENT_BINARY_DIR}/code-gallery/${_step}.h
+      )
+    LIST(APPEND _doxygen_input
+      ${CMAKE_CURRENT_BINARY_DIR}/code-gallery/${_step}.h
+      )
+  ENDFOREACH()
+ENDIF()
+
 TO_STRING(_doxygen_image_path_string ${_doxygen_image_path})
 TO_STRING(_doxygen_input_string ${_doxygen_input})
 
@@ -162,6 +183,7 @@ ADD_CUSTOM_COMMAND(
   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
   DEPENDS
     tutorial
+    code-gallery
     ${CMAKE_CURRENT_BINARY_DIR}/options.dox
     ${CMAKE_CURRENT_BINARY_DIR}/header.html
     ${CMAKE_CURRENT_BINARY_DIR}/footer.html
index 490d76a0aae7037c9a8a9bfe7ae61302bb1b675e..55e02a94f4b56afc7b3936a5a51fb962687bc3b0 100644 (file)
@@ -46,7 +46,35 @@ IF (EXISTS ${DEAL_II_CODE_GALLERY_DIRECTORY}/README.md)
 
   # Now set up targets for each of the code gallery programs
 
-  # ...TODO...
+  FOREACH(_step ${_code_gallery_names})
+    GET_FILENAME_COMPONENT(_step "${_step}" NAME)
+    MESSAGE(STATUS "  Setting up ${_step}")
+
+    # get all source files so we can properly describe the dependencies
+    FILE(GLOB_RECURSE _src_files *)
+
+    ADD_CUSTOM_COMMAND(
+      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
+      COMMAND ${PERL_EXECUTABLE}
+      ARGS
+        ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl
+        ${_step} ${CMAKE_SOURCE_DIR}
+        > ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
+      WORKING_DIRECTORY
+        ${CMAKE_CURRENT_BINARY_DIR}
+      DEPENDS
+        ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_gallery.pl
+        ${_src_files}
+      )
+
+    ADD_CUSTOM_TARGET(code-gallery_${_step}
+      DEPENDS
+        ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
+      )
+    ADD_DEPENDENCIES(code-gallery code-gallery_${_step})
+
+
+  ENDFOREACH()
 
 ELSE()
   MESSAGE(STATUS "Generating the code-gallery documentation is only possible if the code gallery exists in ${DEAL_II_CODE_GALLERY_DIRECTORY}.")
diff --git a/doc/doxygen/scripts/make_gallery.pl b/doc/doxygen/scripts/make_gallery.pl
new file mode 100644 (file)
index 0000000..a72a97c
--- /dev/null
@@ -0,0 +1,39 @@
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2013, 2015 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+if ($#ARGV != 1) {
+  print "\nUsage: make_gallery.pl gallery cmake_source_dir\n";
+  exit;
+}
+
+$gallery=$ARGV[0];
+$gallery_underscore=$gallery;
+$gallery_underscore=~ s/-/_/;
+
+$cmake_source_dir=$ARGV[1];
+
+print
+"/**
+  * \@page code_gallery_$gallery_underscore The $gallery code gallery program
+\@htmlonly
+<table class=\"tutorial\" width=\"50%\">
+<tr><th colspan=\"2\"><b><small>Table of contents</small></b></th></tr>
+<tr><td width=\"50%\" valign=\"top\">
+\@endhtmlonly
+";
+
+print
+"*/
+";

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.