fixed TargetArchs implementation in case when HAVE_CUDA=false, added initial structure for multi_gpu sample

This commit is contained in:
Alexey Spizhevoy
2011-01-27 12:17:56 +00:00
parent 85e5de67e4
commit 65b9f3bc10
3 changed files with 124 additions and 93 deletions

View File

@@ -15,6 +15,10 @@ if (BUILD_EXAMPLES)
"${CMAKE_SOURCE_DIR}/modules/contrib/include"
"${CMAKE_SOURCE_DIR}/modules/gpu/include"
)
if(HAVE_CUDA)
include_directories(${CUDA_INCLUDE_DIRS})
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")

34
samples/gpu/multi_gpu.cpp Normal file
View File

@@ -0,0 +1,34 @@
// Disable some warnings which are caused with CUDA headers
#pragma warning(disable: 4201 4408 4100)
#include <iostream>
#include <cvconfig.h>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/highgui/highgui.hpp>
#ifdef HAVE_CUDA
#include <cuda_runtime.h>
#endif
using namespace std;
using namespace cv;
int main()
{
bool can_run = true;
#if !defined(HAVE_CUDA)
cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true).\n";
can_run = false;
#endif
#if !defined(HAVE_TBB)
cout << "TBB support is required (CMake key 'WITH_TBB' must be true).\n";
can_run = false;
#endif
if (!can_run)
return -1;
return 0;
}