From 639450efdc0e5e3028dcedb3cebdc38b205a6c14 Mon Sep 17 00:00:00 2001 From: Philippe FOUBERT Date: Wed, 3 Jul 2013 00:19:22 +0200 Subject: [PATCH 1/2] PvAPI support on Windows with MinGW (PR #1038 applied to the branch 2.4) --- cmake/OpenCVFindLibsVideo.cmake | 9 ++++++++- modules/highgui/CMakeLists.txt | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/OpenCVFindLibsVideo.cmake b/cmake/OpenCVFindLibsVideo.cmake index 0ca4828fe6..da61ad167a 100644 --- a/cmake/OpenCVFindLibsVideo.cmake +++ b/cmake/OpenCVFindLibsVideo.cmake @@ -58,7 +58,14 @@ if(WITH_PVAPI) set(_PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_OPENCV_GCC_VERSION_MAJOR}.${CMAKE_OPENCV_GCC_VERSION_MINOR}") endif() - set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_STATIC_LIBRARY_PREFIX}PvAPI${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE PATH "The PvAPI library") + if(WIN32) + if(MINGW) + set(PVAPI_DECLARATIONS "-DPVDECL=__stdcall") + endif(MINGW) + set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/PvAPI.lib" CACHE PATH "The PvAPI library") + else(WIN32) + set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/${CMAKE_STATIC_LIBRARY_PREFIX}PvAPI${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE PATH "The PvAPI library") + endif(WIN32) if(EXISTS "${PVAPI_LIBRARY}") set(HAVE_PVAPI TRUE) endif() diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 05ab99a78c..8e2909843f 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -197,6 +197,7 @@ endif(HAVE_FFMPEG) if(HAVE_PVAPI) add_definitions(-DHAVE_PVAPI) + add_definitions(${PVAPI_DECLARATIONS}) ocv_include_directories(${PVAPI_INCLUDE_PATH}) set(highgui_srcs src/cap_pvapi.cpp ${highgui_srcs}) list(APPEND HIGHGUI_LIBRARIES ${PVAPI_LIBRARY}) From 9c04db554f753b7648f0a2a8e19eb9e93e085c0c Mon Sep 17 00:00:00 2001 From: Philippe FOUBERT Date: Sat, 20 Jul 2013 15:03:30 +0200 Subject: [PATCH 2/2] Rename PVAPI_DECLARATIONS to PVAPI_DEFINITIONS --- cmake/OpenCVFindLibsVideo.cmake | 2 +- modules/highgui/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVFindLibsVideo.cmake b/cmake/OpenCVFindLibsVideo.cmake index da61ad167a..b7c8382858 100644 --- a/cmake/OpenCVFindLibsVideo.cmake +++ b/cmake/OpenCVFindLibsVideo.cmake @@ -60,7 +60,7 @@ if(WITH_PVAPI) if(WIN32) if(MINGW) - set(PVAPI_DECLARATIONS "-DPVDECL=__stdcall") + set(PVAPI_DEFINITIONS "-DPVDECL=__stdcall") endif(MINGW) set(PVAPI_LIBRARY "${_PVAPI_LIBRARY}/PvAPI.lib" CACHE PATH "The PvAPI library") else(WIN32) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 8e2909843f..834eb821c7 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -197,7 +197,7 @@ endif(HAVE_FFMPEG) if(HAVE_PVAPI) add_definitions(-DHAVE_PVAPI) - add_definitions(${PVAPI_DECLARATIONS}) + add_definitions(${PVAPI_DEFINITIONS}) ocv_include_directories(${PVAPI_INCLUDE_PATH}) set(highgui_srcs src/cap_pvapi.cpp ${highgui_srcs}) list(APPEND HIGHGUI_LIBRARIES ${PVAPI_LIBRARY})