]> Creatis software - gdcm.git/blobdiff - Dicts/CMakeLists.txt
* CLEANUP_ROUND (7) for gdcmPixelConvert (lost at sea)
[gdcm.git] / Dicts / CMakeLists.txt
index d89e386b5ae2741409ef9a4b0c916bad395c72a8..a26115476e2c79991567bfb53e2d78e2e9564082 100644 (file)
@@ -1,16 +1,46 @@
-#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
-#IF(UNIX)\r
-  INSTALL_FILES(${GDCM_DATA_DIR} FILES dicomV3.dic README)\r
-#ENDIF(UNIX)
\ No newline at end of file
+#-----------------------------------------------------------------------------\r
+# DICOM dictionary stuff\r
+\r
+\r
+INSTALL_FILES(${GDCM_DATA_DIR} FILES \r
+  dicomV3.dic\r
+  dicomVR.dic\r
+  dicomTS.dic\r
+  DicomDir.dic\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