]> Creatis software - gdcm.git/blobdiff - Dicts/CMakeLists.txt
ENH: Remove function instead of putting stoopid comment
[gdcm.git] / Dicts / CMakeLists.txt
index 797156774ba64d5c4dbafffb38f101f57b6ac23e..a26115476e2c79991567bfb53e2d78e2e9564082 100644 (file)
@@ -1,23 +1,46 @@
 #-----------------------------------------------------------------------------\r
 # DICOM dictionary stuff\r
 \r
-#SET(dictsdir \r
-#  ${GDCM_SOURCE_DIR}/gdcm\r
-#)\r
 \r
-#SET(dicts_DATA\r
-#  dicomV3.dic\r
-#  README\r
-#)\r
-\r
-#SET(EXTRA_DIST\r
-#  dicomV3.dic\r
-#)\r
-\r
-# For now INSTALL doesn't work on Win32 \r
 INSTALL_FILES(${GDCM_DATA_DIR} FILES \r
-  dicomV3.dic \r
-  dicomVR.dic \r
+  dicomV3.dic\r
+  dicomVR.dic\r
   dicomTS.dic\r
   DicomDir.dic\r
-  README)\r
+)\r
+\r
+# Nice trick to avoid creating a .h file each time we compile gdcm\r
+# Since CONFIGURE_FILE do a 'copy if different'\r
+# We have to write the file here since is contains 'DICOM_DICTIONARY'\r
+# Which is a variable afterward...\r
+#FILE(WRITE "/tmp/output.h.in" "@DICOM_DICTIONARY@" )\r
+\r
+# Following code contributing by Andy Cedilnik\r
+SET(INFILE "dicomV3.dic")\r
+\r
+FILE(READ "${INFILE}" ENT)\r
+\r
+STRING(REGEX REPLACE "\n" ";" ENT "${ENT}")\r
+SET(DICOM_DICTIONARY\r
+"//\r
+#include \"gdcmDicomDictionaryEntry.h\"\r
+\r
+static gdcmDicomDictionaryEntry[] =\r
+{")\r
+\r
+FOREACH(line ${ENT})\r
+  STRING(REGEX REPLACE\r
+    "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([A-Z]+) (.*)([ \(RET\)]*)$"\r
+    "   { \\1, \\2, \"\\3\" , \"\\4\" , \"\\5\", \"\\6\"}," nline "${line}")\r
+  SET(DICOM_DICTIONARY "${DICOM_DICTIONARY}\n${nline}")\r
+ENDFOREACH(line)\r
+\r
+SET(DICOM_DICTIONARY "${DICOM_DICTIONARY}\r
+   0\r
+};")\r
+\r
+# See above\r
+#CONFIGURE_FILE("/tmp/output.h.in" "/tmp/output.h")\r
+\r
+#MESSAGE("${DICOM_DICTIONARY}")\r
+\r