]> Creatis software - gdcm.git/blobdiff - Dicts/CMakeLists.txt
ENH: Finally fix setup.py.in. both binary and install mode are working again
[gdcm.git] / Dicts / CMakeLists.txt
index e8650ae21aa47a69f77616045c24b73a79921095..a26115476e2c79991567bfb53e2d78e2e9564082 100644 (file)
@@ -1,18 +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
+INSTALL_FILES(${GDCM_DATA_DIR} FILES \r
+  dicomV3.dic\r
+  dicomVR.dic\r
+  dicomTS.dic\r
+  DicomDir.dic\r
+)\r
 \r
-#SET(EXTRA_DIST\r
-#  dicomV3.dic\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
-# For now INSTALL doesn't work on Win32 \r
-INSTALL_FILES(${GDCM_DATA_DIR} FILES dicomV3.dic README)\r