Additional patch for #83850: Please consider deprecating CINTAUTOLINK (Christian)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 12 Jul 2011 14:09:12 +0000 (14:09 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 12 Jul 2011 14:09:12 +0000 (14:09 +0000)
cmake/ALICE_CMake.cmake
cmake/GenerateLinkDef.sh [new file with mode: 0755]

index 2484664..ab31982 100644 (file)
@@ -556,20 +556,13 @@ macro(ALICE_GenerateLinkDef)
   set(PCLASSES)
   foreach (class ${PCINTCLASSES})
     get_filename_component(classname ${class} NAME)
-    set(PCLASSES ${PCLASSES} "\\n#pragma link C++ class ${classname}+;")
+    # set(PCLASSES ${PCLASSES} "\\n#pragma link C++ class ${classname}+;")
+    set(PCLASSES ${PCLASSES} "${classname}")
   endforeach(class)
 
   add_custom_command(OUTPUT ${PDAL}
-    COMMAND echo "// Auto generated file - do not edit" > ${PDAL}
-    COMMAND echo "#ifdef __CINT__" >> ${PDAL} 
-    COMMAND echo "#pragma link off all globals;" >> ${PDAL}
-    COMMAND echo "#pragma link off all classes;" >> ${PDAL}
-    COMMAND echo "#pragma link off all functions;" >> ${PDAL}
-    COMMAND echo "${PCLASSES}" >> ${PDAL}
-    COMMAND echo "#endif // __CINT__" >> ${PDAL} 
-    DEPENDS ${PCINTHDRS}
-    VERBATIM)
-
+    COMMAND sh ${CMAKE_SOURCE_DIR}/cmake/GenerateLinkDef.sh ${PCLASSES} > ${PDAL} 
+    DEPENDS ${PCINTHDRS} ${CMAKE_SOURCE_DIR}/cmake/GenerateLinkDef.sh)
 endmacro(ALICE_GenerateLinkDef)
 
 macro(ALICE_BuildPAR)
diff --git a/cmake/GenerateLinkDef.sh b/cmake/GenerateLinkDef.sh
new file mode 100755 (executable)
index 0000000..160c3f3
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# 
+# Script to generate LinkDef file from a list of classes. 
+#
+# Usage: GenerateLinkDef.sh [CLASS ...]
+#
+# Author: Christian Holm Christensen <cholm@nbi.dk>
+#
+
+# --- Help message ---------------------------------------------------
+usage()
+{
+    cat<<EOF
+Usage: [OPTIONS] $0 [CLASS ...] 
+
+Options:
+       -h,--help               This help 
+       -S,--no-evolution       Do not enable schema evolution 
+       -C,--custom-streamer    Use custom streamers 
+EOF
+}
+
+# --- Default options ------------------------------------------------
+schema="+"
+custom=""
+
+# --- Process options ------------------------------------------------
+while test $# -gt 0 ; do 
+    case $1 in 
+       -h|--help)              usage ; exit 0 ;; 
+       -S|--no-evolution)      schema="" ;;
+       -C|--custom-streamer)   custom="-" ;; 
+       *) break ;; 
+    esac
+    shift 
+done 
+
+# --- Header ---------------------------------------------------------
+cat <<EOF
+// Auto generated file - do not edit
+#ifndef __CINT__
+# error Not for compilation
+#else 
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+EOF
+
+# --- Link definitions -----------------------------------------------
+while test $# -gt 0 ; do 
+    echo "#pragma link C++ class ${1}${schema}${custom};" 
+    shift 
+done 
+
+# --- Trailer --------------------------------------------------------
+cat <<EOF
+
+#endif // __CINT__
+//
+// EOF
+//
+EOF
+
+#
+# EOF
+#
+
+
+