fixed problem with VideoInput on Windows when OpenCV compiled statically (ticket...
authorAlexander Shishkov <no@email>
Mon, 30 May 2011 13:32:57 +0000 (13:32 +0000)
committerAlexander Shishkov <no@email>
Mon, 30 May 2011 13:32:57 +0000 (13:32 +0000)
CMakeLists.txt
modules/python/CMakeLists.txt
samples/c/CMakeLists.txt
samples/cpp/CMakeLists.txt
samples/gpu/CMakeLists.txt

index 05fe10b..b7af6fd 100644 (file)
@@ -139,6 +139,12 @@ else()
     set(OPENCV_SVNVERSION "")\r
 endif()\r
 \r
+# ----------------------------------------------------------------------------\r
+# Detect Microsoft compiler:\r
+# ----------------------------------------------------------------------------\r
+if(CMAKE_CL_64)\r
+    set(MSVC64 1)\r
+endif()\r
 \r
 # ----------------------------------------------------------------------------\r
 # Detect GNU version:\r
@@ -805,6 +811,17 @@ if(WIN32)
     \r
     if (MSVC)\r
         set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} vfw32)\r
+               if (NOT BUILD_SHARED_LIBS)\r
+                   if (MSVC64)\r
+                       if(HAVE_VIDEOINPUT)\r
+                           set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${CMAKE_SOURCE_DIR}/3rdparty/lib/videoInput64.lib strmiids)\r
+                       endif()\r
+                   elseif (MSVC)\r
+                       if(HAVE_VIDEOINPUT)\r
+                           set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${CMAKE_SOURCE_DIR}/3rdparty/lib/videoInput.lib strmiids)\r
+                       endif()\r
+                   endif()\r
+               endif()\r
     endif()\r
 \r
     if(MINGW)\r
index 751a285..bd4cdac 100644 (file)
@@ -60,6 +60,10 @@ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; pri
 
 set_target_properties(${cv_target} PROPERTIES SUFFIX ${CVPY_SUFFIX})
 
+if (MSVC AND NOT BUILD_SHARED_LIBS)
+    set_target_properties(${cv_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
+endif()
+
 set(cvpymodules ${cv_target})
 
 if(PYTHON_USE_NUMPY)
index ce07827..7136246 100644 (file)
@@ -43,8 +43,10 @@ if (BUILD_EXAMPLES)
                if(ENABLE_SOLUTION_FOLDERS)\r
                        set_target_properties(${the_target} PROPERTIES FOLDER "samples//c")\r
                endif()\r
-\r
         if(WIN32)\r
+           if (MSVC AND NOT BUILD_SHARED_LIBS)\r
+               set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")\r
+           endif()\r
             install(TARGETS ${the_target}\r
                 RUNTIME DESTINATION "samples/c" COMPONENT main)\r
         endif()\r
index 85e8258..3fde7b7 100644 (file)
@@ -45,6 +45,9 @@ if (BUILD_EXAMPLES)
                endif()
 
         if(WIN32)
+           if (MSVC AND NOT BUILD_SHARED_LIBS)
+               set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
+           endif()
             install(TARGETS ${the_target}
                 RUNTIME DESTINATION "samples/cpp" COMPONENT main)
         endif()
index d3ac2c4..f84ae99 100644 (file)
@@ -47,6 +47,9 @@ if (BUILD_EXAMPLES)
                endif()\r
 \r
         if(WIN32)\r
+           if (MSVC AND NOT BUILD_SHARED_LIBS)\r
+               set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")\r
+           endif()\r
             install(TARGETS ${the_target}\r
                 RUNTIME DESTINATION "samples/gpu" COMPONENT main)\r
         endif()\r