From 85067d1807f0b9c927b13f8b3ea9c838bdab9f09 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Sun, 12 Jun 2011 10:45:07 +0200
Subject: [PATCH] COMP: fix some configuration error introduced previously

---
 Code/Core/otbWrapperApplicationFactory.h | 11 +++++++----
 Example/otbAddition.cxx                  |  2 +-
 Example/otbSmoothing.cxx                 |  2 +-
 Testing/Core/CMakeLists.txt              |  4 ++--
 Testing/Python/CMakeLists.txt            |  5 +++--
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/Code/Core/otbWrapperApplicationFactory.h b/Code/Core/otbWrapperApplicationFactory.h
index 4fb76f7726..16ebfd0b6a 100644
--- a/Code/Core/otbWrapperApplicationFactory.h
+++ b/Code/Core/otbWrapperApplicationFactory.h
@@ -100,13 +100,16 @@ private:
 } //end namespace otb
 
 
-#define OTB_APPLICATION_REGISTER( ApplicationType )                                    \
+#define OTB_APPLICATION_EXPORT( ApplicationType )                                    \
   typedef otb::Wrapper::ApplicationFactory<ApplicationType> ApplicationFactoryType;    \
   static ApplicationFactoryType::Pointer staticFactory;                                \
-  itk::ObjectFactoryBase* itkLoad()                                                    \
+  extern "C"                                                                           \
   {                                                                                    \
-    staticFactory = ApplicationFactoryType::New();                                     \
-    return staticFactory;                                                              \
+    itk::ObjectFactoryBase* itkLoad()                                                  \
+    {                                                                                  \
+      staticFactory = ApplicationFactoryType::New();                                   \
+      return staticFactory;                                                            \
+    }                                                                                  \
   }
 
 
diff --git a/Example/otbAddition.cxx b/Example/otbAddition.cxx
index 61325fa767..104a0a2e22 100644
--- a/Example/otbAddition.cxx
+++ b/Example/otbAddition.cxx
@@ -72,4 +72,4 @@ private:
 }
 }
 
-OTB_APPLICATION_REGISTER(otb::Wrapper::Addition)
+OTB_APPLICATION_EXPORT(otb::Wrapper::Addition)
diff --git a/Example/otbSmoothing.cxx b/Example/otbSmoothing.cxx
index f262db60f2..30b25c33f5 100644
--- a/Example/otbSmoothing.cxx
+++ b/Example/otbSmoothing.cxx
@@ -168,5 +168,5 @@ private:
 }
 }
 
-OTB_APPLICATION_REGISTER(otb::Wrapper::Smoothing)
+OTB_APPLICATION_EXPORT(otb::Wrapper::Smoothing)
 
diff --git a/Testing/Core/CMakeLists.txt b/Testing/Core/CMakeLists.txt
index 323639eab8..fb7d1f0dbd 100644
--- a/Testing/Core/CMakeLists.txt
+++ b/Testing/Core/CMakeLists.txt
@@ -55,8 +55,8 @@ ADD_TEST(owTuApplication ${OTB_WRAPPER_TESTS}
   )
 
 # Application class test
-ADD_TEST(owTvApplicationFactory ${OTB_WRAPPER_TESTS}
-    otbWrapperApplicationFactory
+ADD_TEST(owTvApplicationRegistry ${OTB_WRAPPER_TESTS}
+    otbWrapperApplicationRegistry
   )
 
 # ----------------Source files CXX -----------------------------------
diff --git a/Testing/Python/CMakeLists.txt b/Testing/Python/CMakeLists.txt
index 543c04d799..69dae0bfef 100644
--- a/Testing/Python/CMakeLists.txt
+++ b/Testing/Python/CMakeLists.txt
@@ -4,9 +4,10 @@ FIND_PROGRAM(OTB_TEST_DRIVER otbTestDriver PATHS ${OTB_DIR}/bin ${OTB_DIR}/../..
 
 SET(TEST_DRIVER "${OTB_TEST_DRIVER}"
     --add-before-env PYTHONPATH        "${CMAKE_BINARY_DIR}/Code/Wrappers/SWIG" 
-    --add-before-env ITK_AUTOLOAD_PATH "${CMAKE_BINARY_DIR}/Example/Smoothing"
+    --add-before-env ITK_AUTOLOAD_PATH "${CMAKE_BINARY_DIR}/Example"
 )
-SET(TEMP ${OTBWrapper_BINARY_DIR}/Temporary)
+SET(TEMP ${CMAKE_BINARY_DIR}/Testing/Temporary)
+FILE(MAKE_DIRECTORY ${TEMP})
 
 ADD_TEST( NAME PythonTest1
           COMMAND ${TEST_DRIVER} Execute
-- 
GitLab