From: Vadim Pisarevsky Date: Fri, 16 Jul 2010 22:38:57 +0000 (+0000) Subject: do not use WIN64/_WIN64 anymore - CMake did not set it anyway. Use WIN32 + __x86_64... X-Git-Tag: accepted/2.0/20130307.220821~4736 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=758e826d2e0a047ee4dd0b6a1e860e741003743d;p=profile%2Fivi%2Fopencv.git do not use WIN64/_WIN64 anymore - CMake did not set it anyway. Use WIN32 + __x86_64 or _M_X64 instead. Also, make VideoInput optional (WITH_VIDEOINPUT=ON/OFF) => now Mingw-dw2 can build OpenCV --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 769d14d..41ebe6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,6 +284,10 @@ set(WITH_TBB OFF CACHE BOOL "Include TBB support") set(WITH_EIGEN2 ON CACHE BOOL "Include Eigen2 support") set(WITH_CUDA OFF CACHE BOOL "Include NVidia Cuda Runtime support") +if(WIN32) + set(WITH_VIDEOINPUT ON CACHE BOOL "Enable VideoInput support") +endif() + # =================================================== # Macros that checks if module have been installed. # After it adds module to build and define @@ -609,7 +613,7 @@ if (WITH_TBB) endif() endif() -############################### TBB ################################ +############################### CUDA ################################ if (WITH_CUDA) find_package(CUDA) @@ -619,6 +623,15 @@ if (WITH_CUDA) endif() endif() +############################### VideoInput ################################ + +if (WIN32 AND WITH_VIDEOINPUT) + if(CMAKE_CXX_COMPILER MATCHES "dw2") + else() + set(HAVE_VIDEOINPUT 1) + endif() +endif() + ############################## Eigen2 ############################## if(WITH_EIGEN2) @@ -1241,6 +1254,16 @@ message(STATUS " Video I/O: QTKit") endif() endif() +if(WIN32) +message(STATUS "") +message(STATUS " Video I/O: ") +if(HAVE_VIDEOINPUT) +message(STATUS " VideoInput: 1") +else() +message(STATUS " VideoInput: 0") +endif() +endif() + message(STATUS "") message(STATUS " Interfaces: ") message(STATUS " Python: ${BUILD_NEW_PYTHON_SUPPORT}") diff --git a/cvconfig.h.cmake b/cvconfig.h.cmake index 5fb2d88..ebe9528 100644 --- a/cvconfig.h.cmake +++ b/cvconfig.h.cmake @@ -168,3 +168,7 @@ /* NVidia Cuda Runtime API*/ #cmakedefine HAVE_CUDA + +/* VideoInput library */ +#cmakedefine HAVE_VIDEOINPUT + diff --git a/modules/calib3d/src/modelest.cpp b/modules/calib3d/src/modelest.cpp index 3ffeed8..4c4b00e 100644 --- a/modules/calib3d/src/modelest.cpp +++ b/modules/calib3d/src/modelest.cpp @@ -459,7 +459,7 @@ int cv::estimateAffine3D(const Mat& from, const Mat& to, Mat& out, vector from.depth() == CV_32F && to.depth() == CV_32F && ((from.rows == 1 && from.channels() == 3) || from.cols*from.channels() == 3) && ((to.rows == 1 && to.channels() == 3) || to.cols*to.channels() == 3) && - count == (size_t)to.cols*to.rows*to.channels()/3); + count == to.cols*to.rows*to.channels()/3); out.create(3, 4, CV_64F); outliers.resize(count); diff --git a/modules/core/include/opencv2/core/internal.hpp b/modules/core/include/opencv2/core/internal.hpp index cfb6c3e..3347576 100644 --- a/modules/core/include/opencv2/core/internal.hpp +++ b/modules/core/include/opencv2/core/internal.hpp @@ -264,7 +264,7 @@ CV_INLINE IppiSize ippiSize(int width, int height) #ifdef __GNUC__ #undef alloca #define alloca __builtin_alloca -#elif defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 || \ +#elif defined WIN32 || defined _WIN32 || \ defined WINCE || defined _MSC_VER || defined __BORLANDC__ #include #elif defined HAVE_ALLOCA_H diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index 0e8f49a..92c4c7b 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -74,7 +74,7 @@ #elif defined WIN32 || defined _WIN32 - #if defined _MSC_VER && !defined WIN64 && !defined _WIN64 + #if defined _MSC_VER && defined _M_IX86 static inline int CV_XADD( int* addr, int delta ) { int tmp; diff --git a/modules/core/include/opencv2/core/types_c.h b/modules/core/include/opencv2/core/types_c.h index b58a8fb..d5db676 100644 --- a/modules/core/include/opencv2/core/types_c.h +++ b/modules/core/include/opencv2/core/types_c.h @@ -71,7 +71,7 @@ #endif #if (_MSC_VER >= 1400 && defined _M_X64) || (__GNUC__ >= 4 && defined __x86_64__) - #if defined WIN64 + #if defined WIN32 #include #endif #include @@ -85,7 +85,7 @@ #ifdef HAVE_IPL #ifndef __IPL_H__ - #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 + #if defined WIN32 || defined _WIN32 #include #else #include @@ -96,7 +96,7 @@ #endif #endif // SKIP_INCLUDES -#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 +#if defined WIN32 || defined _WIN32 #define CV_CDECL __cdecl #define CV_STDCALL __stdcall #else @@ -125,14 +125,14 @@ #ifndef CV_INLINE #if defined __cplusplus #define CV_INLINE inline -#elif (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 || defined WINCE) && !defined __GNUC__ +#elif (defined WIN32 || defined _WIN32 || defined WINCE) && !defined __GNUC__ #define CV_INLINE __inline #else #define CV_INLINE static #endif #endif /* CV_INLINE */ -#if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 || defined WINCE) && defined CVAPI_EXPORTS +#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS #define CV_EXPORTS __declspec(dllexport) #else #define CV_EXPORTS diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index 60ebe72..aa5938d 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -45,7 +45,7 @@ namespace cv { // On Win64 optimized versions of DFT and DCT fail the tests (fixed in VS2010) -#if (defined WIN64 || defined _WIN64) && defined _MSC_VER && _MSC_VER < 1600 +#if defined _MSC_VER && !defined CV_ICC && defined _M_X64 && _MSC_VER < 1600 #pragma optimize("", off) #endif diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 55b1ecd..c04469b 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -42,7 +42,7 @@ #include "precomp.hpp" -#if defined WIN32 || defined WIN64 || defined _WIN64 || defined WINCE +#if defined WIN32 || defined _WIN32 || defined WINCE #include #if defined _MSC_VER #if _MSC_VER >= 1400 @@ -184,7 +184,7 @@ bool useOptimized() int64 getTickCount() { -#if defined WIN32 || defined WIN64 || defined _WIN64 || defined WINCE +#if defined WIN32 || defined _WIN32 || defined WINCE LARGE_INTEGER counter; QueryPerformanceCounter( &counter ); return (int64)counter.QuadPart; @@ -204,7 +204,7 @@ int64 getTickCount() double getTickFrequency() { -#if defined WIN32 || defined WIN64 || defined _WIN64 || defined WINCE +#if defined WIN32 || defined _WIN32 || defined WINCE LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); return (double)freq.QuadPart; @@ -266,7 +266,7 @@ int64 getCPUTickCount(void) #endif -#elif defined _MSC_VER && defined WIN32 && !defined _WIN64 +#elif defined _MSC_VER && defined WIN32 && defined _M_IX86 int64 getCPUTickCount(void) { @@ -394,7 +394,7 @@ redirectError( CvErrorCallback errCallback, void* userdata, void** prevUserdata) cvGuiBoxReport( int code, const char *func_name, const char *err_msg, const char *file, int line, void* ) { -#if (!defined WIN32 && !defined WIN64) || defined WINCE +#if (!defined WIN32 && !defined _WIN32) || defined WINCE return cvStdErrReport( code, func_name, err_msg, file, line, 0 ); #else if( code != CV_StsBackTrace && code != CV_StsAutoTrace ) diff --git a/modules/ffmpeg/ffopencv.cpp b/modules/ffmpeg/ffopencv.cpp index 0d56ce7..6fe1f05 100644 --- a/modules/ffmpeg/ffopencv.cpp +++ b/modules/ffmpeg/ffopencv.cpp @@ -533,7 +533,7 @@ extern "C" { __declspec(dllexport) unsigned int __lc_codepage = 0; } #pragma comment(lib, "libgcc_.a") #pragma comment(lib, "libmingwex_.a") #pragma comment(lib, "libcoldname_.a") -#ifdef WIN64 +#ifdef _M_X64 #pragma comment(lib, "libavformat64.a") #pragma comment(lib, "libavcodec64.a") #pragma comment(lib, "libavutil64.a") diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 14e0895..0f61330 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -298,9 +298,15 @@ if(WIN32) if(MINGW) if(MINGW64) - target_link_libraries(${the_target} msvfw32 avifil32 avicap32 winmm videoInput64 strmiids) + target_link_libraries(${the_target} msvfw32 avifil32 avicap32 winmm) + if(HAVE_VIDEOINPUT) + target_link_libraries(${the_target} videoInput64 strmiids) + endif() else() - target_link_libraries(${the_target} vfw32 winmm videoInput strmiids) + target_link_libraries(${the_target} vfw32 winmm) + if(HAVE_VIDEOINPUT) + target_link_libraries(${the_target} videoInput strmiids) + endif() endif() endif() endif() diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h index b76e67f..3e6df3e 100644 --- a/modules/highgui/include/opencv2/highgui/highgui_c.h +++ b/modules/highgui/include/opencv2/highgui/highgui_c.h @@ -43,7 +43,7 @@ #define __OPENCV_HIGHGUI_H__ #include "opencv2/core/core_c.h" -#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 +#if defined WIN32 || defined _WIN32 #include #undef min #undef max diff --git a/modules/highgui/src/cap.cpp b/modules/highgui/src/cap.cpp index cbd7554..1fff192 100644 --- a/modules/highgui/src/cap.cpp +++ b/modules/highgui/src/cap.cpp @@ -45,7 +45,7 @@ #pragma warning( disable: 4711 ) #endif -#if (defined WIN64 || defined _WIN64) && defined _MSC_VER && !defined __ICL +#if defined _M_X64 && defined _MSC_VER && !defined CV_ICC #pragma optimize("",off) #endif diff --git a/modules/highgui/src/cap_dshow.cpp b/modules/highgui/src/cap_dshow.cpp index f3ad3db..20320ce 100644 --- a/modules/highgui/src/cap_dshow.cpp +++ b/modules/highgui/src/cap_dshow.cpp @@ -41,7 +41,8 @@ #include "precomp.hpp" -#ifdef HAVE_VIDEOINPUT +#if defined HAVE_VIDEOINPUT && (_MSC_VER >= 1400 || defined __GNUC__) + #include "videoinput.h" /********************* Capturing video from camera via VFW *********************/ @@ -183,7 +184,11 @@ CvCapture* cvCreateCameraCapture_DShow( int index ) } #ifdef _MSC_VER +#if defined _M_X64 +#pragma comment(lib, "videoInput64.lib") +#else #pragma comment(lib, "videoInput.lib") #endif +#endif #endif diff --git a/modules/highgui/src/cap_mil.cpp b/modules/highgui/src/cap_mil.cpp index 32e827a..f2797e2 100644 --- a/modules/highgui/src/cap_mil.cpp +++ b/modules/highgui/src/cap_mil.cpp @@ -48,7 +48,7 @@ #pragma comment(lib,"milmet2.lib") #endif -#if defined WIN64 && defined EM64T && defined _MSC_VER && !defined __ICL +#if defined _M_X64 #pragma optimize("",off) #endif diff --git a/modules/highgui/src/cap_pvapi.cpp b/modules/highgui/src/cap_pvapi.cpp index ddb05e1..f313ac9 100644 --- a/modules/highgui/src/cap_pvapi.cpp +++ b/modules/highgui/src/cap_pvapi.cpp @@ -50,9 +50,9 @@ #define _LINUX #endif -#if defined(_x64) || defined (__x86_64) || defined (_WIN64) +#if defined(_x64) || defined (__x86_64) || defined (_M_X64) #define _x64 1 -#elif defined(_x86) || defined(__i386) || defined (_WIN32) +#elif defined(_x86) || defined(__i386) || defined (_M_IX86) #define _x86 1 #endif diff --git a/modules/highgui/src/cap_vfw.cpp b/modules/highgui/src/cap_vfw.cpp index 016f572..8721148 100644 --- a/modules/highgui/src/cap_vfw.cpp +++ b/modules/highgui/src/cap_vfw.cpp @@ -52,7 +52,7 @@ #define capSendMessage(hwnd,m,w,l) (IsWindow(hwnd)?SendMessage(hwnd,m,w,l):0) #endif -#if (defined WIN64 || defined _WIN64) && defined _MSC_VER && !defined __ICL +#if defined _M_X64 #pragma optimize("",off) #endif diff --git a/modules/highgui/src/precomp.hpp b/modules/highgui/src/precomp.hpp index 0d8764d..6e1a3d7 100644 --- a/modules/highgui/src/precomp.hpp +++ b/modules/highgui/src/precomp.hpp @@ -103,13 +103,6 @@ struct CvVideoWriter #if defined WIN32 || defined _WIN32 #define HAVE_VFW 1 -#if (_MSC_VER >= 1400 || defined __GNUC__) && !defined WIN64 && !defined _WIN64 -#define HAVE_VIDEOINPUT 1 -#endif - -/* uncomment to enable OpenEXR codec (will not compile under MSVC6) */ -//#define HAVE_OPENEXR 1 - /* uncomment to enable CMUCamera1394 fireware camera module */ //#define HAVE_CMU1394 1 #endif diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp index 1f5833e..5d53a21 100755 --- a/modules/highgui/src/window_QT.cpp +++ b/modules/highgui/src/window_QT.cpp @@ -262,7 +262,7 @@ CV_IMPL int cvWaitKey( int arg ) waitCondition.wait(&dummy, 2); */ -#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 +#if defined WIN32 || defined _WIN32 sleep(2); #else usleep(2);//to decrease CPU usage diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index aa1603c..04cdde1 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -41,7 +41,7 @@ #include "precomp.hpp" -#if defined WIN32 || defined WIN64 || defined _WIN64 +#if defined WIN32 || defined _WIN32 #if _MSC_VER >= 1200 #pragma warning( disable: 4710 ) @@ -57,7 +57,7 @@ static const char* trackbar_text = " "; -#if defined WIN64 || defined _WIN64 +#if defined _M_X64 || defined __x86_64 #define icvGetWindowLongPtr GetWindowLongPtr #define icvSetWindowLongPtr( hwnd, id, ptr ) SetWindowLongPtr( hwnd, id, (LONG_PTR)(ptr) ) diff --git a/modules/ml/include/opencv2/ml/ml.hpp b/modules/ml/include/opencv2/ml/ml.hpp index 33e4cd8..1768a2d 100644 --- a/modules/ml/include/opencv2/ml/ml.hpp +++ b/modules/ml/include/opencv2/ml/ml.hpp @@ -51,13 +51,13 @@ #include "opencv2/core/core.hpp" #include - #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 + #if defined WIN32 || defined _WIN32 #include #endif #else // SKIP_INCLUDES - #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 + #if defined WIN32 || defined _WIN32 #define CV_CDECL __cdecl #define CV_STDCALL __stdcall #else @@ -86,14 +86,14 @@ #ifndef CV_INLINE #if defined __cplusplus #define CV_INLINE inline - #elif (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __GNUC__ + #elif (defined WIN32 || defined _WIN32) && !defined __GNUC__ #define CV_INLINE __inline #else #define CV_INLINE static #endif #endif /* CV_INLINE */ - #if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && defined CVAPI_EXPORTS + #if (defined WIN32 || defined _WIN32) && defined CVAPI_EXPORTS #define CV_EXPORTS __declspec(dllexport) #else #define CV_EXPORTS diff --git a/tests/cv/src/highguitest.cpp b/tests/cv/src/highguitest.cpp index 0ad0281..f4b9843 100644 --- a/tests/cv/src/highguitest.cpp +++ b/tests/cv/src/highguitest.cpp @@ -51,7 +51,7 @@ using namespace cv; using namespace std; -#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 +#if defined WIN32 || defined _WIN32 //#if 0 #else diff --git a/tests/cxcore/src/adatastruct.cpp b/tests/cxcore/src/adatastruct.cpp index fe1aeff..74c9547 100644 --- a/tests/cxcore/src/adatastruct.cpp +++ b/tests/cxcore/src/adatastruct.cpp @@ -2009,7 +2009,7 @@ void CxCore_GraphTest::run( int ) struct_idx = iter = -1; t = cvTsRandReal(rng)*(max_log_storage_block_size - min_log_storage_block_size) + min_log_storage_block_size; int block_size = cvRound( exp(t * CV_LOG2) ); - block_size = MAX(block_size, sizeof(CvGraph) + sizeof(CvMemBlock)); + block_size = MAX(block_size, (int)(sizeof(CvGraph) + sizeof(CvMemBlock))); storage = cvCreateMemStorage(block_size); diff --git a/tests/cxcore/src/cxcoretest.h b/tests/cxcore/src/cxcoretest.h index e528396..84858c6 100644 --- a/tests/cxcore/src/cxcoretest.h +++ b/tests/cxcore/src/cxcoretest.h @@ -42,7 +42,7 @@ #ifndef _CXCORE_TEST_H_ #define _CXCORE_TEST_H_ -#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 +#if defined WIN32 || defined _WIN32 #include #undef min #undef max diff --git a/tests/cxts/_cxts.h b/tests/cxts/_cxts.h index e523fed..e2a53cf 100644 --- a/tests/cxts/_cxts.h +++ b/tests/cxts/_cxts.h @@ -42,7 +42,7 @@ #ifndef __CXTS_INTERNAL_H__ #define __CXTS_INTERNAL_H__ -#if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && (_MSC_VER >= 1200 || defined _ICL) +#if (defined WIN32 || defined _WIN32) && (_MSC_VER >= 1200 || defined _ICL) #pragma warning( disable: 4251 4514 4996 ) #endif