gdcm/gdcm-2.0.17-use_system_charls

103 lines
4.0 KiB
Plaintext

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75bc60f..29f5802 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -271,6 +271,12 @@ ENDIF(UNIX)
OPTION(GDCM_USE_SYSTEM_EXPAT "Use system expat" OFF)
OPTION(GDCM_USE_SYSTEM_LJPEG "Use system ljpeg (ijg lib)" OFF)
OPTION(GDCM_USE_SYSTEM_OPENJPEG "Use system openjpeg (1.x)" OFF)
+
+IF(GDCM_USE_JPEGLS)
+ OPTION(GDCM_USE_SYSTEM_JPEGLS "Use system JPEGLS (CharLS)" OFF)
+ MARK_AS_ADVANCED(GDCM_USE_SYSTEM_JPEGLS)
+ENDIF(GDCM_USE_JPEGLS)
+
MARK_AS_ADVANCED(GDCM_USE_SYSTEM_ZLIB GDCM_USE_SYSTEM_UUID GDCM_USE_SYSTEM_EXPAT GDCM_USE_SYSTEM_OPENSSL)
MARK_AS_ADVANCED(GDCM_USE_SYSTEM_OPENJPEG GDCM_USE_SYSTEM_LJPEG)
OPTION(GDCM_USE_SYSTEM_POPPLER "Use system poppler (pdf)" OFF)
@@ -305,6 +311,13 @@ ELSE(GDCM_USE_SYSTEM_OPENJPEG)
SET(GDCM_OPENJPEG_LIBRARIES gdcmopenjpeg)
ENDIF(GDCM_USE_SYSTEM_OPENJPEG)
+IF(GDCM_USE_SYSTEM_JPEGLS)
+ FIND_PACKAGE(CharLS REQUIRED)
+ SET(GDCM_CHARLS_LIBRARIES ${CHARLS_LIBRARIES})
+ELSE(GDCM_USE_SYSTEM_JPEGLS)
+ SET(GDCM_CHARLS_LIBRARIES gdcmcharls)
+ENDIF(GDCM_USE_SYSTEM_JPEGLS)
+
# Very advanced user option:
# This will cause building of the broken JPEG library released by the Standford PVRG group:
OPTION(GDCM_USE_PVRG "Use pvrg lib, only turn it on if you know what you are doing." OFF)
diff --git a/Source/MediaStorageAndFileFormat/CMakeLists.txt b/Source/MediaStorageAndFileFormat/CMakeLists.txt
index 290a5b7..3eee74c 100644
--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt
+++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt
@@ -141,7 +141,7 @@ ADD_LIBRARY(gdcmMSFF ${MSFF_SRCS})
TARGET_LINK_LIBRARIES(gdcmMSFF gdcmIOD gdcmDSED gdcmDICT ${GDCM_LJPEG_LIBRARIES} ${GDCM_OPENJPEG_LIBRARIES})
SET_TARGET_PROPERTIES(gdcmMSFF PROPERTIES ${GDCM_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "gdcmDSED;gdcmDICT;gdcmIOD")
IF(GDCM_USE_JPEGLS)
- TARGET_LINK_LIBRARIES(gdcmMSFF gdcmcharls)
+ TARGET_LINK_LIBRARIES(gdcmMSFF ${GDCM_CHARLS_LIBRARIES})
ENDIF(GDCM_USE_JPEGLS)
IF(CMAKE_COMPILER_IS_GNUCXX AND MINGW)
diff --git a/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx b/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
index fda51bc..aae07ed 100644
--- a/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEGLSCodec.cxx
@@ -18,6 +18,16 @@
#include "gdcmDataElement.h"
// CharLS includes
+#ifdef GDCM_USE_SYSTEM_EXPAT
+#include "CharLS/stdafx.h" // sigh...
+#include "CharLS/interface.h"
+#include "CharLS/util.h"
+#include "CharLS/defaulttraits.h"
+#include "CharLS/losslesstraits.h"
+#include "CharLS/colortransform.h"
+#include "CharLS/streams.h"
+#include "CharLS/processline.h"
+#else
#include "gdcmcharls/stdafx.h" // sigh...
#include "gdcmcharls/interface.h"
#include "gdcmcharls/util.h"
@@ -26,7 +36,7 @@
#include "gdcmcharls/colortransform.h"
#include "gdcmcharls/streams.h"
#include "gdcmcharls/processline.h"
-
+#endif
namespace gdcm
{
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 8ade58c..8b417aa 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -33,14 +33,17 @@ IF(NOT GDCM_USE_SYSTEM_OPENJPEG)
ENDIF(NOT GDCM_USE_SYSTEM_OPENJPEG)
# Do jpegls (JPEG-LS aka near lossless implementation)
+
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/gdcmcharls/License.txt)
IF(GDCM_USE_JPEGLS)
- SET(CHARLS_NAMESPACE "GDCMCHARLS")
- SET(CHARLS_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
- SET(CHARLS_INSTALL_BIN_DIR ${GDCM_INSTALL_BIN_DIR})
- SET(CHARLS_INSTALL_LIB_DIR ${GDCM_INSTALL_LIB_DIR})
- SET(CHARLS_INSTALL_INCLUDE_DIR ${GDCM_INSTALL_INCLUDE_DIR}/gdcmcharls)
- SUBDIRS(gdcmcharls)
+ IF(NOT GDCM_USE_SYSTEM_JPEGLS)
+ SET(CHARLS_NAMESPACE "GDCMCHARLS")
+ SET(CHARLS_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
+ SET(CHARLS_INSTALL_BIN_DIR ${GDCM_INSTALL_BIN_DIR})
+ SET(CHARLS_INSTALL_LIB_DIR ${GDCM_INSTALL_LIB_DIR})
+ SET(CHARLS_INSTALL_INCLUDE_DIR ${GDCM_INSTALL_INCLUDE_DIR})
+ SUBDIRS(gdcmcharls)
+ ENDIF(NOT GDCM_USE_SYSTEM_JPEGLS)
ENDIF(GDCM_USE_JPEGLS)
# Do md5