Преглед на файлове

Conditional include of scu.h depending on DCMTK version

Marco Nolden преди 12 години
родител
ревизия
d7b7885de4
променени са 2 файла, в които са добавени 29 реда и са изтрити 2 реда
  1. 22 1
      Libs/DICOM/Core/CMakeLists.txt
  2. 7 1
      Libs/DICOM/Core/ctkDcmSCU.h

+ 22 - 1
Libs/DICOM/Core/CMakeLists.txt

@@ -7,6 +7,23 @@ project(CTKDICOMCore)
 set(KIT_export_directive "CTK_DICOM_CORE_EXPORT")
 
 
+# determine the DCMTK version we're using
+if(EXISTS ${DCMTK_config_INCLUDE_DIR}/cfunix.h)
+  set(_DCMTK_CONFIG_HEADER ${DCMTK_config_INCLUDE_DIR}/cfunix.h)
+elseif(EXISTS ${DCMTK_config_INCLUDE_DIR}/osconfig.h)
+  set(_DCMTK_CONFIG_HEADER ${DCMTK_config_INCLUDE_DIR}/osconfig.h)
+else()
+  message(SEND_ERROR "DCMTK version cannot be determined!")
+endif()
+
+
+file(READ ${_DCMTK_CONFIG_HEADER} _DCMTK_CONFIG)
+# simple check, we do not expect anything else
+if(_DCMTK_CONFIG MATCHES "PACKAGE_VERSION_NUMBER 360")
+  set(DCMTK_VERSION_IS_360 1)
+  message(STATUS "Detected DCMTK 3.6.0, will include backported SCU")
+endif()
+
 # Source files
 set(KIT_SRCS
   ctkDICOMAbstractThumbnailGenerator.cpp
@@ -30,9 +47,13 @@ set(KIT_SRCS
   ctkDICOMRetrieve.h
   ctkDICOMTester.cpp
   ctkDICOMTester.h
-  ctkDcmSCU.cc
 )
 
+if(DCMTK_VERSION_IS_360)
+  list(APPEND KIT_SRCS ctkDcmSCU.cc)
+endif(DCMTK_VERSION_IS_360)
+
+
 # Abstract class should not be wrapped !
 set_source_files_properties(
   ctkDICOMAbstractThumbnailGenerator.h

+ 7 - 1
Libs/DICOM/Core/ctkDcmSCU.h

@@ -18,11 +18,15 @@
  *  Purpose: Base class for Service Class Users (SCUs)
  *
  */
+#include "dcmtk/config/osconfig.h"  /* make sure OS specific configuration is included first */
+
+#if ! ( PACKAGE_VERSION_NUMBER == 360 )
+#include "dcmtk/dcmnet/scu.h"
+#else
 
 #ifndef SCU_H
 #define SCU_H
 
-#include "dcmtk/config/osconfig.h"  /* make sure OS specific configuration is included first */
 
 #include "dcmtk/dcmdata/dctk.h"     /* Covers most common dcmdata classes */
 #include "dcmtk/dcmnet/dcompat.h"
@@ -1038,4 +1042,6 @@ private:
   Uint16 nextMessageID();
 };
 
+#endif // DCMTK 3.6.0
+
 #endif // SCU_H