ocl: fix world compilation on Windows
authorAlexander Alekhin <alexander.alekhin@intel.com>
Wed, 11 Oct 2017 13:19:29 +0000 (16:19 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Wed, 11 Oct 2017 16:04:42 +0000 (19:04 +0300)
modules/core/include/opencv2/core/opencl/runtime/opencl_clamdblas.hpp
modules/core/include/opencv2/core/opencl/runtime/opencl_clamdfft.hpp
modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp
modules/world/CMakeLists.txt

index a64447e..2ad8ac0 100644 (file)
 
 #ifdef HAVE_CLAMDBLAS
 
-#ifndef CL_RUNTIME_EXPORT
-#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE)
-#define CL_RUNTIME_EXPORT __declspec(dllimport)
-#else
-#define CL_RUNTIME_EXPORT
-#endif
-#endif
+#include "opencl_core.hpp"
 
 #include "autogenerated/opencl_clamdblas.hpp"
 
index e96dad2..a328f72 100644 (file)
 
 #ifdef HAVE_CLAMDFFT
 
-#ifndef CL_RUNTIME_EXPORT
-#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE)
-#define CL_RUNTIME_EXPORT __declspec(dllimport)
-#else
-#define CL_RUNTIME_EXPORT
-#endif
-#endif
+#include "opencl_core.hpp"
 
 #include "autogenerated/opencl_clamdfft.hpp"
 
index ad46e25..ea9a7ff 100644 (file)
@@ -45,7 +45,8 @@
 #ifdef HAVE_OPENCL
 
 #ifndef CL_RUNTIME_EXPORT
-#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE)
+#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE) && \
+    !(defined(__OPENCV_BUILD) && defined(OPENCV_MODULE_IS_PART_OF_WORLD))
 #define CL_RUNTIME_EXPORT __declspec(dllimport)
 #else
 #define CL_RUNTIME_EXPORT
index 96d12f8..943a27e 100644 (file)
@@ -59,6 +59,8 @@ ocv_module_include_directories()
 #message(STATUS "${OPENCV_MODULE_${the_module}_SOURCES}")
 ocv_create_module(${link_deps})
 
+ocv_target_compile_definitions(${the_module} PRIVATE OPENCV_MODULE_IS_PART_OF_WORLD=1)
+
 if(BUILD_opencv_imgcodecs AND OPENCV_MODULE_opencv_imgcodecs_IS_PART_OF_WORLD)
   ocv_imgcodecs_configure_target()
 endif()