From 3d594c70ffd29e9bd4d3c93f64fae888514678bc Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Tue, 19 Mar 2013 17:46:01 -0700 Subject: [PATCH] Multiple Windows RT fixes TIFF build was fixed; Direct Show back-end was enabled; More accurate guards implemented. --- 3rdparty/tbb/CMakeLists.txt | 37 +++++++++++++++++++++++++++---------- CMakeLists.txt | 7 +++++-- modules/highgui/CMakeLists.txt | 3 ++- modules/highgui/src/cap.cpp | 6 +++--- modules/highgui/src/cap_ffmpeg.cpp | 16 ++++++++-------- modules/highgui/src/precomp.hpp | 6 +++--- modules/highgui/src/window.cpp | 12 ++++++------ 7 files changed, 54 insertions(+), 33 deletions(-) diff --git a/3rdparty/tbb/CMakeLists.txt b/3rdparty/tbb/CMakeLists.txt index 3c6ae98..6a5d2a8 100644 --- a/3rdparty/tbb/CMakeLists.txt +++ b/3rdparty/tbb/CMakeLists.txt @@ -122,15 +122,32 @@ file(GLOB lib_srcs "${tbb_src_dir}/src/tbb/*.cpp") file(GLOB lib_hdrs "${tbb_src_dir}/src/tbb/*.h") list(APPEND lib_srcs "${tbb_src_dir}/src/rml/client/rml_tbb.cpp") -add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required - -D__TBB_BUILD=1 #required - -D__TBB_SURVIVE_THREAD_SWITCH=0 #no cilk support - -DUSE_PTHREAD #required for Unix - -DTBB_USE_GCC_BUILTINS=1 #required for ARM GCC - -DTBB_USE_DEBUG=0 #just to be sure - -DTBB_NO_LEGACY=1 #don't need backward compatibility - -DDO_ITT_NOTIFY=0 #it seems that we don't need these notifications - ) +if (WIN32) +add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 + -D__TBB_BUILD=1 + -D_UNICODE + -DUNICODE + -DWINAPI_FAMILY=WINAPI_FAMILY_APP + -DDO_ITT_NOTIFY=0 + ) # defines were copied from windows.cl.inc +set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} /APPCONTAINER") +else() + add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required + -D__TBB_BUILD=1 #required + -D__TBB_SURVIVE_THREAD_SWITCH=0 #no cilk support + -DTBB_USE_DEBUG=0 #just to be sure + -DTBB_NO_LEGACY=1 #don't need backward compatibility + -DDO_ITT_NOTIFY=0 #it seems that we don't need these notifications + ) +endif() + +if (HAVE_LIBPTHREAD) + add_definitions(-DUSE_PTHREAD) #required for Unix +endif() + +if (CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-DTBB_USE_GCC_BUILTINS=1) #required for ARM GCC +endif() if(ANDROID_COMPILER_IS_CLANG) add_definitions(-D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1) @@ -145,7 +162,7 @@ endif() set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs}) -if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") +if ((${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") AND NOT WIN32) if (NOT ANDROID) set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/arm_linux_stub.cpp") endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index e5868cf..1f997ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,10 @@ endif() project(OpenCV CXX C) -add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) +if ((${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") AND WIN32) + set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) + add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) +endif() include(cmake/OpenCVUtils.cmake) @@ -171,7 +174,7 @@ OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 O OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR ANDROID OR APPLE ) OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR ANDROID OR APPLE ) OCV_OPTION(BUILD_OPENEXR "Build openexr from source" WIN32 OR ANDROID OR APPLE ) -OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID IF CMAKE_COMPILER_IS_GNUCXX ) +OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID ) # OpenCV installation options # =================================================== diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 12cf2cb..b8600e9 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -106,7 +106,8 @@ elseif(APPLE) endif() #if(WIN32) -# list(APPEND highgui_srcs src/cap_vfw.cpp src/cap_cmu.cpp src/cap_dshow.cpp) + list(APPEND highgui_srcs src/cap_dshow.cpp) + #list(APPEND highgui_srcs src/cap_vfw.cpp src/cap_cmu.cpp) #endif(WIN32) if(HAVE_XINE) diff --git a/modules/highgui/src/cap.cpp b/modules/highgui/src/cap.cpp index 237e315..2c754ca 100644 --- a/modules/highgui/src/cap.cpp +++ b/modules/highgui/src/cap.cpp @@ -197,9 +197,9 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) { #ifdef HAVE_VIDEOINPUT case CV_CAP_DSHOW: - // capture = cvCreateCameraCapture_DShow (index); - // if (capture) - // return capture; + capture = cvCreateCameraCapture_DShow (index); + if (capture) + return capture; return NULL; break; #endif diff --git a/modules/highgui/src/cap_ffmpeg.cpp b/modules/highgui/src/cap_ffmpeg.cpp index 640fc2d..22caab8 100644 --- a/modules/highgui/src/cap_ffmpeg.cpp +++ b/modules/highgui/src/cap_ffmpeg.cpp @@ -209,11 +209,11 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename) if( result->open( filename )) return result; delete result; -//#if defined WIN32 || defined _WIN32 -// return cvCreateFileCapture_VFW(filename); -//#else +#if (defined WIN32 || defined _WIN32) && !defined _M_ARM + return cvCreateFileCapture_VFW(filename); +#else return 0; -//#endif +#endif } class CvVideoWriter_FFMPEG_proxy : @@ -263,9 +263,9 @@ CvVideoWriter* cvCreateVideoWriter_FFMPEG_proxy( const char* filename, int fourc if( result->open( filename, fourcc, fps, frameSize, isColor != 0 )) return result; delete result; -// #if defined WIN32 || defined _WIN32 -// return cvCreateVideoWriter_VFW(filename, fourcc, fps, frameSize, isColor); -// #else +#if (defined WIN32 || defined _WIN32) && !defined _M_ARM + return cvCreateVideoWriter_VFW(filename, fourcc, fps, frameSize, isColor); + #else return 0; -//#endif +#endif } diff --git a/modules/highgui/src/precomp.hpp b/modules/highgui/src/precomp.hpp index 5790bf6..64efbb9 100644 --- a/modules/highgui/src/precomp.hpp +++ b/modules/highgui/src/precomp.hpp @@ -103,12 +103,12 @@ struct CvVideoWriter virtual bool writeFrame(const IplImage*) { return false; } }; -//#if defined WIN32 || defined _WIN32 -//#define HAVE_VFW 1 +#if (defined WIN32 || defined _WIN32) && !defined _M_ARM +#define HAVE_VFW 1 /* uncomment to enable CMUCamera1394 fireware camera module */ //#define HAVE_CMU1394 1 -//#endif +#endif CvCapture * cvCreateCameraCapture_V4L( int index ); diff --git a/modules/highgui/src/window.cpp b/modules/highgui/src/window.cpp index a26bc44..12816f3 100644 --- a/modules/highgui/src/window.cpp +++ b/modules/highgui/src/window.cpp @@ -57,7 +57,7 @@ CV_IMPL void cvSetWindowProperty(const char* name, int prop_id, double prop_valu #if defined (HAVE_QT) cvSetModeWindow_QT(name,prop_value); - #elif defined (HAVE_WIN32_UI) + #elif (defined WIN32 || defined _WIN32) && !defined _M_ARM cvSetModeWindow_W32(name,prop_value); #elif defined (HAVE_GTK) cvSetModeWindow_GTK(name,prop_value); @@ -96,7 +96,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) #if defined (HAVE_QT) return cvGetModeWindow_QT(name); - #elif defined (HAVE_WIN32_UI) + #elif (defined WIN32 || defined _WIN32) && !defined _M_ARM return cvGetModeWindow_W32(name); #elif defined (HAVE_GTK) return cvGetModeWindow_GTK(name); @@ -113,7 +113,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) #if defined (HAVE_QT) return cvGetPropWindow_QT(name); - #elif defined (HAVE_WIN32_UI) + #elif (defined WIN32 || defined _WIN32) && !defined _M_ARM return cvGetPropWindowAutoSize_W32(name); #elif defined (HAVE_GTK) return cvGetPropWindowAutoSize_GTK(name); @@ -126,7 +126,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) #if defined (HAVE_QT) return cvGetRatioWindow_QT(name); - #elif defined (HAVE_WIN32_UI) + #elif (defined WIN32 || defined _WIN32) && !defined _M_ARM return cvGetRatioWindow_W32(name); #elif defined (HAVE_GTK) return cvGetRatioWindow_GTK(name); @@ -139,7 +139,7 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id) #if defined (HAVE_QT) return cvGetOpenGlProp_QT(name); - #elif defined (HAVE_WIN32_UI) + #elif (defined WIN32 || defined _WIN32) && !defined _M_ARM return cvGetOpenGlProp_W32(name); #elif defined (HAVE_GTK) return cvGetOpenGlProp_GTK(name); @@ -450,7 +450,7 @@ int cv::createButton(const string&, ButtonCallback, void*, int , bool ) #endif -#if defined (HAVE_WIN32_UI) // see window_w32.cpp +#if (defined WIN32 || defined _WIN32) && !defined _M_ARM // see window_w32.cpp #elif defined (HAVE_GTK) // see window_gtk.cpp #elif defined (HAVE_COCOA) // see window_carbon.cpp #elif defined (HAVE_CARBON) -- 2.7.4