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

This commit is contained in:
Vadim Pisarevsky 2010-07-16 22:38:57 +00:00
parent ba60094aca
commit 758e826d2e
24 changed files with 74 additions and 43 deletions

View File

@ -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}")

View File

@ -168,3 +168,7 @@
/* NVidia Cuda Runtime API*/
#cmakedefine HAVE_CUDA
/* VideoInput library */
#cmakedefine HAVE_VIDEOINPUT

View File

@ -459,7 +459,7 @@ int cv::estimateAffine3D(const Mat& from, const Mat& to, Mat& out, vector<uchar>
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);

View File

@ -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 <malloc.h>
#elif defined HAVE_ALLOCA_H

View File

@ -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;

View File

@ -71,7 +71,7 @@
#endif
#if (_MSC_VER >= 1400 && defined _M_X64) || (__GNUC__ >= 4 && defined __x86_64__)
#if defined WIN64
#if defined WIN32
#include <intrin.h>
#endif
#include <emmintrin.h>
@ -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 <ipl.h>
#else
#include <ipl/ipl.h>
@ -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

View File

@ -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

View File

@ -42,7 +42,7 @@
#include "precomp.hpp"
#if defined WIN32 || defined WIN64 || defined _WIN64 || defined WINCE
#if defined WIN32 || defined _WIN32 || defined WINCE
#include <tchar.h>
#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 )

View File

@ -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")

View File

@ -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()

View File

@ -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 <windows.h>
#undef min
#undef max

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) )

View File

@ -51,13 +51,13 @@
#include "opencv2/core/core.hpp"
#include <limits.h>
#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
#if defined WIN32 || defined _WIN32
#include <windows.h>
#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

View File

@ -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

View File

@ -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);

View File

@ -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 <windows.h>
#undef min
#undef max

View File

@ -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