Write cmake scripts for building the html manual
authorDiane Trout <diane@caltech.edu>
Thu, 6 Jul 2006 01:40:44 +0000 (01:40 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 6 Jul 2006 01:40:44 +0000 (01:40 +0000)
this is also the start of some docutils CMAKE support

CMakeLists.txt
doc/CMakeLists.txt [new file with mode: 0644]
doc/manual/CMakeLists.txt [new file with mode: 0644]
makelib/FindDocutils.cmake [new file with mode: 0644]

index b92af8dc56dc909cd35199fd70af377d0d6b598e..e5ca03000c79ebf9c11fcfe7dc6930c78f2f9cd1 100644 (file)
@@ -14,6 +14,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
 
 # all of our source files al relative to the root of our project
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+ADD_SUBDIRECTORY( doc )
 ADD_SUBDIRECTORY( alg )
 ADD_SUBDIRECTORY( qui )
 ADD_SUBDIRECTORY( py )
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c22da00
--- /dev/null
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY( manual )
diff --git a/doc/manual/CMakeLists.txt b/doc/manual/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a9c6fc1
--- /dev/null
@@ -0,0 +1,4 @@
+FIND_PACKAGE(Docutils)
+
+RST2HTML(mussagl_manual.rst)
+
diff --git a/makelib/FindDocutils.cmake b/makelib/FindDocutils.cmake
new file mode 100644 (file)
index 0000000..1eed862
--- /dev/null
@@ -0,0 +1,30 @@
+# Macros to make using docutils to build documentation easier
+
+FIND_PROGRAM(RST2HTML_PY
+             NAMES rst2html.py rst2html
+             DOC "location of the python docutils reStructured text html "
+                 "converter"
+             )
+
+IF(RST2HTML_PY)
+  MACRO(RST2HTML)
+    FOREACH(it ${ARGN})
+      GET_FILENAME_COMPONENT(basename ${it} NAME_WE)
+
+      SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it} )
+      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.html)
+
+      ADD_CUSTOM_COMMAND(
+        OUTPUT ${outfile} 
+        COMMAND ${RST2HTML_PY} 
+        ARGS ${infile} ${outfile}
+        DEPENDS ${infile}
+      )
+
+      ADD_CUSTOM_TARGET(RstHTMLDocuments_${outfile} ALL DEPENDS ${outfile})
+
+    ENDFOREACH(it)
+  ENDMACRO(RST2HTML)
+ENDIF(RST2HTML_PY)
+
+# There really should be some code for building the pdf as well