doxy: helper script to generate imgs from macros
authordberzano <dario.berzano@cern.ch>
Thu, 5 Feb 2015 17:25:04 +0000 (18:25 +0100)
committerdberzano <dario.berzano@cern.ch>
Tue, 10 Feb 2015 15:21:12 +0000 (16:21 +0100)
doxygen/CMakeLists.txt
doxygen/alidoxyimg.sh [new file with mode: 0755]

index a38e031..fe60b2a 100644 (file)
@@ -30,4 +30,7 @@ if(CAN_GENERATE_DOC)
         VERBATIM
     )
 
+    # install the helper script to generate images from ROOT macros
+    install(PROGRAMS alidoxyimg.sh DESTINATION bin)
+
 endif(CAN_GENERATE_DOC)
diff --git a/doxygen/alidoxyimg.sh b/doxygen/alidoxyimg.sh
new file mode 100755 (executable)
index 0000000..485403e
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Usage:
+#   alidoxyimg.sh <macro>.C
+#
+# Generates <macro>.png image as the output of <macro>.
+#
+# Needs aliroot executable.
+
+if [[ $1 == '' ]] ; then
+  echo 'Usage:'
+  echo '  alidoxyimg.sh <macro>.C'
+  echo ''
+  echo 'The output will be a file named <macro>.png.'
+  exit 1
+fi
+
+if ! which aliroot > /dev/null 2>&1 ; then
+  echo 'Error: aliroot executable not found in $PATH'
+  exit 2
+fi
+
+base=${1%.*}
+ext='png'
+
+aliroot -b "$1" <<EOF
+gPad->Print("$base.$ext");
+EOF
+
+if [[ ! -e "${base}.${ext}" ]] ; then
+  echo "Error: output file ${base}.${ext} not generated!"
+  exit 3
+fi