]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Remove this embarrassment in the document generation
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 2 Apr 2013 22:41:47 +0000 (22:41 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 2 Apr 2013 22:41:47 +0000 (22:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@29155 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/doxygen/scripts/make_step [new file with mode: 0644]
deal.II/doc/doxygen/scripts/make_step.pl [new file with mode: 0644]
deal.II/doc/doxygen/tutorial/CMakeLists.txt
deal.II/doc/doxygen/tutorial/_plain.snippet.in [deleted file]
deal.II/doc/doxygen/tutorial/_toc.final.snippet [deleted file]
deal.II/doc/doxygen/tutorial/_toc.intro.snippet.in [deleted file]
deal.II/doc/doxygen/tutorial/_toc.prog.snippet [deleted file]
deal.II/doc/doxygen/tutorial/_toc.results.snippet [deleted file]

diff --git a/deal.II/doc/doxygen/scripts/make_step b/deal.II/doc/doxygen/scripts/make_step
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/deal.II/doc/doxygen/scripts/make_step.pl b/deal.II/doc/doxygen/scripts/make_step.pl
new file mode 100644 (file)
index 0000000..f4994e5
--- /dev/null
@@ -0,0 +1,66 @@
+#---------------------------------------------------------------------------
+#    $Id$
+#    Version: $Name$
+#
+#    Copyright (C) 2013 by the deal.II authors
+#
+#    This file is subject to QPL and may not be  distributed
+#    without copyright and license information. Please refer
+#    to the file deal.II/doc/license.html for the  text  and
+#    further information on this license.
+#
+#---------------------------------------------------------------------------
+
+if ($#ARGV != 1) {
+  print "\nUsage: make_step.pl step cmake_source_dir\n";
+  exit;
+}
+
+$step=$ARGV[0];
+$step_underscore=$step;
+$step_underscore=~ s/-/_/;
+
+$cmake_source_dir=$ARGV[1];
+
+print
+"/**
+  * \@page $step_underscore The $step tutorial 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\">
+<ol>
+  <li> <a href=\"#Intro\" class=bold>Introduction</a>
+";
+
+system("perl $cmake_source_dir/doc/doxygen/scripts/intro2toc < $cmake_source_dir/examples/$step/doc/intro.dox");
+
+print "  <li> <a href=\"#CommProg\" class=bold>The commented program</a>\n";
+
+system("perl $cmake_source_dir/doc/doxygen/scripts/program2toc < $cmake_source_dir/examples/$step/$step.cc");
+
+print
+"</ol></td><td width=\"50%\" valign=\"top\"><ol>
+  <li value=\"3\"> <a href=\"#Results\" class=bold>Results</a>
+";
+
+system("perl $cmake_source_dir/doc/doxygen/scripts/intro2toc < $cmake_source_dir/examples/$step/doc/results.dox");
+
+print
+"  <li> <a href=\"#PlainProg\" class=bold>The plain program</a>
+</ol> </td> </tr> </table>
+\@endhtmlonly
+";
+
+system("perl $cmake_source_dir/doc/doxygen/scripts/create_anchors < $cmake_source_dir/examples/$step/doc/intro.dox");
+
+system("perl $cmake_source_dir/doc/doxygen/scripts/program2doxygen < $cmake_source_dir/examples/$step/$step.cc");
+
+system("perl $cmake_source_dir/doc/doxygen/scripts/create_anchors < $cmake_source_dir/examples/$step/doc/results.dox");
+
+print
+"<a name=\"PlainProg\"></a>
+<h1> The plain program</h1>
+\@include \"$step.cc\"
+ */
+";
index cde334966dd78a7728dd119f9f37bd8836da6cbd..c4905141cafde2dcda2a27c078e86244c892a5cc 100644 (file)
@@ -89,17 +89,6 @@ ADD_CUSTOM_TARGET(tutorial
 
 FOREACH(_step ${_steps})
   GET_FILENAME_COMPONENT(_step "${_step}" NAME)
-  STRING(REGEX REPLACE "-" "_" _step_underscore "${_step}")
-
-  CONFIGURE_FILE(
-    ${CMAKE_CURRENT_SOURCE_DIR}/_toc.intro.snippet.in
-    ${CMAKE_CURRENT_BINARY_DIR}/${_step}_toc.intro.snippet
-    )
-
-  CONFIGURE_FILE(
-    ${CMAKE_CURRENT_SOURCE_DIR}/_plain.snippet.in
-    ${CMAKE_CURRENT_BINARY_DIR}/${_step}_plain.snippet
-    )
 
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.cc
@@ -107,75 +96,29 @@ FOREACH(_step ${_steps})
     ARGS
       ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/program2plain
       < ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.cc
+      > ${CMAKE_CURRENT_BINARY_DIR}/${_step}.cc
     DEPENDS
+      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/program2plain
       ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc
     VERBATIM
     )
 
   ADD_CUSTOM_COMMAND(
-    #
-    # This has to be refactored really, really badly...
-    #
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND cat
-    ARGS
-      ${CMAKE_CURRENT_BINARY_DIR}/${_step}_toc.intro.snippet
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND ${PERL_EXECUTABLE}
-    ARGS
-      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/intro2toc
-      < ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/intro.dox
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND cat
-    ARGS
-      ${CMAKE_CURRENT_SOURCE_DIR}/_toc.prog.snippet
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND ${PERL_EXECUTABLE}
-    ARGS
-      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/program2toc
-      < ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND cat
-    ARGS
-      ${CMAKE_CURRENT_SOURCE_DIR}/_toc.results.snippet
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
     COMMAND ${PERL_EXECUTABLE}
     ARGS
-      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/intro2toc
-      < ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/results.dox
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND cat
-    ARGS
-      ${CMAKE_CURRENT_SOURCE_DIR}/_toc.final.snippet
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND ${PERL_EXECUTABLE}
-    ARGS
-      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/create_anchors
-      < ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/intro.dox
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND ${PERL_EXECUTABLE}
-    ARGS
-      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/program2doxygen
-      < ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND ${PERL_EXECUTABLE}
-    ARGS
-      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/create_anchors
-      < ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/results.dox
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
-    COMMAND cat
-    ARGS
-      ${CMAKE_CURRENT_BINARY_DIR}/${_step}_plain.snippet
-      >> ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
+      ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/make_step.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_step.pl
       ${CMAKE_SOURCE_DIR}/examples/${_step}/${_step}.cc
       ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/intro.dox
       ${CMAKE_SOURCE_DIR}/examples/${_step}/doc/results.dox
-    VERBATIM
     )
+
   ADD_CUSTOM_TARGET(tutorial_${_step}
     DEPENDS
       ${CMAKE_CURRENT_BINARY_DIR}/${_step}.h
@@ -184,7 +127,6 @@ FOREACH(_step ${_steps})
   ADD_DEPENDENCIES(tutorial tutorial_${_step})
 ENDFOREACH()
 
-
 #
 # Install all bits:
 #
diff --git a/deal.II/doc/doxygen/tutorial/_plain.snippet.in b/deal.II/doc/doxygen/tutorial/_plain.snippet.in
deleted file mode 100644 (file)
index f94ec1b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<a name="PlainProg"></a>
-<h1> The plain program</h1>
-@include "${_step}.cc"
- */
diff --git a/deal.II/doc/doxygen/tutorial/_toc.final.snippet b/deal.II/doc/doxygen/tutorial/_toc.final.snippet
deleted file mode 100644 (file)
index ccfc936..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-  <li> <a href="#PlainProg" class=bold>The plain program</a>
-</ol> </td> </tr> </table>
-@endhtmlonly
diff --git a/deal.II/doc/doxygen/tutorial/_toc.intro.snippet.in b/deal.II/doc/doxygen/tutorial/_toc.intro.snippet.in
deleted file mode 100644 (file)
index c476554..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
-  * @page ${_step_underscore} The ${_step} tutorial 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">
-<ol>
-  <li> <a href="#Intro" class=bold>Introduction</a>
diff --git a/deal.II/doc/doxygen/tutorial/_toc.prog.snippet b/deal.II/doc/doxygen/tutorial/_toc.prog.snippet
deleted file mode 100644 (file)
index c582c11..0000000
+++ /dev/null
@@ -1 +0,0 @@
-  <li> <a href="#CommProg" class=bold>The commented program</a>
diff --git a/deal.II/doc/doxygen/tutorial/_toc.results.snippet b/deal.II/doc/doxygen/tutorial/_toc.results.snippet
deleted file mode 100644 (file)
index 3325e2a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-</ol></td><td width="50%" valign="top"><ol>
-  <li value="3"> <a href="#Results" class=bold>Results</a>

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.