[opengtl-commits] [650] allow test to use PNG/Raw dc without installation

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 650
Author:   cyrille
Date:     2009-03-17 17:16:32 +0100 (Tue, 17 Mar 2009)

Log Message:
-----------
allow test to use PNG/Raw dc without installation

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLImageIO/CMakeLists.txt
    trunk/OpenGTL/OpenGTL/GTLImageIO/ImageDCRegistry.cpp


Modified: trunk/OpenGTL/OpenGTL/GTLImageIO/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLImageIO/CMakeLists.txt	2009-03-17 15:19:55 UTC (rev 649)
+++ trunk/OpenGTL/OpenGTL/GTLImageIO/CMakeLists.txt	2009-03-17 16:16:32 UTC (rev 650)
@@ -17,6 +17,11 @@
 add_definitions( "-D__STDC_LIMIT_MACROS" )
 add_definitions( -DCOUMPONENT_NAME="GTLImageIO" )
 
+if(OPENGTL_BUILD_TESTS)
+add_definitions( -D_GTLIMAGEIO_EXTENSIONS_PNG_DIR_="${CMAKE_BINARY_DIR}/Extensions/PngDC" )
+add_definitions( -D_GTLIMAGEIO_EXTENSIONS_RAW_DIR_="${CMAKE_BINARY_DIR}/Extensions/RawDC" )
+endif(OPENGTL_BUILD_TESTS)
+
 # Set the ABI version of the library
 set_target_properties(GTLImageIO PROPERTIES VERSION ${OPENGTL_LIB_VERSION} SOVERSION ${OPENGTL_LIB_SOVERSION} )
 

Modified: trunk/OpenGTL/OpenGTL/GTLImageIO/ImageDCRegistry.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLImageIO/ImageDCRegistry.cpp	2009-03-17 15:19:55 UTC (rev 649)
+++ trunk/OpenGTL/OpenGTL/GTLImageIO/ImageDCRegistry.cpp	2009-03-17 16:16:32 UTC (rev 650)
@@ -31,22 +31,12 @@
   std::list< ImageDC* > imageDCS;
   GTLCore::String decodableFilter;
   GTLCore::String encodableFilter;
+  void loadExtensionsIn(const GTLCore::String& _extensions);
 };
 
-ImageDCRegistry* global_instance = 0;
-
-ImageDCRegistry::ImageDCRegistry() : d(new Private)
+void ImageDCRegistry::Private::loadExtensionsIn(const GTLCore::String& _extensions)
 {
-}
-
-ImageDCRegistry::~ImageDCRegistry()
-{
-  delete d;
-}
-
-void ImageDCRegistry::initialise()
-{
-  llvm::sys::Path extensionPath(_GTLIMAGEIO_EXTENSIONS_INSTALL_DIR_);
+  llvm::sys::Path extensionPath(_extensions);
   std::set<llvm::sys::Path> paths;
   GTLCore::String errMsg;
   GTL_DEBUG("Loading extensions from " << _GTLIMAGEIO_EXTENSIONS_INSTALL_DIR_ );
@@ -66,6 +56,28 @@
   }
 }
 
+ImageDCRegistry* global_instance = 0;
+
+ImageDCRegistry::ImageDCRegistry() : d(new Private)
+{
+}
+
+ImageDCRegistry::~ImageDCRegistry()
+{
+  delete d;
+}
+
+void ImageDCRegistry::initialise()
+{
+  d->loadExtensionsIn(_GTLIMAGEIO_EXTENSIONS_INSTALL_DIR_);
+#ifdef _GTLIMAGEIO_EXTENSIONS_PNG_DIR_
+  d->loadExtensionsIn(_GTLIMAGEIO_EXTENSIONS_PNG_DIR_);
+#endif
+#ifdef _GTLIMAGEIO_EXTENSIONS_RAW_DIR_
+  d->loadExtensionsIn(_GTLIMAGEIO_EXTENSIONS_RAW_DIR_);
+#endif
+}
+
 ImageDCRegistry* ImageDCRegistry::instance()
 {
   if( not global_instance )


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/