fixed build for CARMA:
- added CMake toolchain file - added WITH_NVCUVID flag
This commit is contained in:
@@ -5,7 +5,7 @@ endif()
|
||||
set(the_description "GPU-accelerated Computer Vision")
|
||||
ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_nonfree opencv_photo opencv_legacy)
|
||||
|
||||
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda" "${CMAKE_CURRENT_SOURCE_DIR}/../highgui/src")
|
||||
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda")
|
||||
|
||||
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_device_hdrs "include/opencv2/${name}/device/*.hpp" "include/opencv2/${name}/device/*.h")
|
||||
@@ -15,24 +15,21 @@ file(GLOB lib_cuda_hdrs "src/cuda/*.hpp" "src/cuda/*.h")
|
||||
file(GLOB lib_srcs "src/*.cpp")
|
||||
file(GLOB lib_cuda "src/cuda/*.cu*")
|
||||
|
||||
source_group("Include" FILES ${lib_hdrs})
|
||||
source_group("Src\\Host" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs})
|
||||
source_group("Device" FILES ${lib_device_hdrs})
|
||||
source_group("Include" FILES ${lib_hdrs})
|
||||
source_group("Src\\Host" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs})
|
||||
source_group("Device" FILES ${lib_device_hdrs})
|
||||
source_group("Device\\Detail" FILES ${lib_device_hdrs_detail})
|
||||
|
||||
if (HAVE_CUDA)
|
||||
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp")
|
||||
file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp" "src/nvidia/*.h*")
|
||||
file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu")
|
||||
file(GLOB_RECURSE ncv_hdrs "src/nvidia/*.hpp" "src/nvidia/*.h")
|
||||
set(ncv_files ${ncv_srcs} ${ncv_hdrs} ${ncv_cuda})
|
||||
set(ncv_files ${ncv_srcs} ${ncv_cuda})
|
||||
|
||||
source_group("Src\\NVidia" FILES ${ncv_files})
|
||||
ocv_include_directories("src/nvidia" "src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations /wd4211 /wd4201 /wd4100 /wd4505 /wd4408)
|
||||
string(REPLACE "-Wsign-promo" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
|
||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
|
||||
|
||||
if(MSVC)
|
||||
@@ -47,12 +44,9 @@ if (HAVE_CUDA)
|
||||
|
||||
ocv_cuda_compile(cuda_objs ${lib_cuda} ${ncv_cuda})
|
||||
|
||||
#CUDA_BUILD_CLEAN_TARGET()
|
||||
|
||||
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
|
||||
|
||||
if(NOT APPLE)
|
||||
find_cuda_helper_libs(nvcuvid)
|
||||
if(WITH_NVCUVID)
|
||||
set(cuda_link_libs ${cuda_link_libs} ${CUDA_nvcuvid_LIBRARY})
|
||||
endif()
|
||||
|
||||
@@ -61,7 +55,7 @@ if (HAVE_CUDA)
|
||||
set(cuda_link_libs ${cuda_link_libs} ${CUDA_nvcuvenc_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT APPLE AND WITH_FFMPEG)
|
||||
if(WITH_FFMPEG)
|
||||
set(cuda_link_libs ${cuda_link_libs} ${HIGHGUI_LIBRARIES})
|
||||
endif()
|
||||
else()
|
||||
|
26
modules/gpu/misc/carma.toolchain.cmake
Normal file
26
modules/gpu/misc/carma.toolchain.cmake
Normal file
@@ -0,0 +1,26 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-linux-gnueabi-gcc-4.5)
|
||||
set(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++-4.5)
|
||||
|
||||
#suppress compiller varning
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi" )
|
||||
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi" )
|
||||
|
||||
# can be any other plases
|
||||
set(__arm_linux_eabi_root /usr/arm-linux-gnueabi)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${__arm_linux_eabi_root})
|
||||
|
||||
if(EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CUDA_TOOLKIT_ROOT_DIR})
|
||||
endif()
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
|
||||
set(CARMA 1)
|
||||
add_definitions(-DCARMA)
|
@@ -1,7 +1,7 @@
|
||||
#include "cuvid_video_source.h"
|
||||
#include "cu_safe_call.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const std::string& fname)
|
||||
{
|
||||
|
@@ -45,7 +45,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
namespace cv { namespace gpu
|
||||
{
|
||||
|
@@ -42,12 +42,12 @@
|
||||
|
||||
#include "ffmpeg_video_source.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
#include "cap_ffmpeg_impl.hpp"
|
||||
#if defined(HAVE_FFMPEG) && defined(BUILD_SHARED_LIBS)
|
||||
#include "../src/cap_ffmpeg_impl.hpp"
|
||||
#else
|
||||
#include "cap_ffmpeg_api.hpp"
|
||||
#include "../src/cap_ffmpeg_api.hpp"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include "precomp.hpp"
|
||||
#include "thread_wrappers.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
struct InputMediaStream_FFMPEG;
|
||||
|
||||
|
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "frame_queue.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
cv::gpu::detail::FrameQueue::FrameQueue() :
|
||||
endOfDecode_(0),
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include "precomp.hpp"
|
||||
#include "thread_wrappers.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
namespace cv { namespace gpu
|
||||
{
|
||||
|
@@ -97,12 +97,12 @@
|
||||
#include <cublas.h>
|
||||
#endif
|
||||
|
||||
#ifndef __APPLE__
|
||||
#ifdef HAVE_NVCUVID
|
||||
#include <nvcuvid.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <NVEncoderAPI.h>
|
||||
#ifdef WIN32
|
||||
#include <NVEncoderAPI.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "internal_shared.hpp"
|
||||
|
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "thread_wrappers.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
#ifdef WIN32
|
||||
#define NOMINMAX
|
||||
|
@@ -45,7 +45,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
namespace cv { namespace gpu
|
||||
{
|
||||
|
@@ -43,7 +43,7 @@
|
||||
#include "video_decoder.h"
|
||||
#include "frame_queue.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
void cv::gpu::detail::VideoDecoder::create(const VideoReader_GPU::FormatInfo& videoFormat)
|
||||
{
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include "precomp.hpp"
|
||||
#include "cu_safe_call.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
namespace cv { namespace gpu
|
||||
{
|
||||
|
@@ -43,7 +43,7 @@
|
||||
#include "video_parser.h"
|
||||
#include "cu_safe_call.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
cv::gpu::detail::VideoParser::VideoParser(VideoDecoder* videoDecoder, FrameQueue* frameQueue) :
|
||||
videoDecoder_(videoDecoder), frameQueue_(frameQueue), unparsedPackets_(0), hasError_(false)
|
||||
|
@@ -48,7 +48,7 @@
|
||||
#include "frame_queue.h"
|
||||
#include "video_decoder.h"
|
||||
|
||||
#if defined(HAVE_CUDA) && !defined(__APPLE__)
|
||||
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
|
||||
|
||||
namespace cv { namespace gpu
|
||||
{
|
||||
|
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if !defined HAVE_CUDA || defined(CUDA_DISABLER) || defined(__APPLE__)
|
||||
#if !defined(HAVE_CUDA) || defined(CUDA_DISABLER) || !defined(HAVE_NVCUVID)
|
||||
|
||||
class cv::gpu::VideoReader_GPU::Impl
|
||||
{
|
||||
|
@@ -42,7 +42,7 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if !defined HAVE_CUDA || defined(CUDA_DISABLER) || !defined(WIN32)
|
||||
#if !defined(HAVE_CUDA) || defined(CUDA_DISABLER) || !defined(HAVE_NVCUVID) || !defined(WIN32)
|
||||
|
||||
class cv::gpu::VideoWriter_GPU::Impl
|
||||
{
|
||||
@@ -71,9 +71,9 @@ void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string&) const { t
|
||||
#else // !defined HAVE_CUDA || !defined WIN32
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
#include "cap_ffmpeg_impl.hpp"
|
||||
#include "../src/cap_ffmpeg_impl.hpp"
|
||||
#else
|
||||
#include "cap_ffmpeg_api.hpp"
|
||||
#include "../src/cap_ffmpeg_api.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1001,4 +1001,4 @@ void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string& configFile
|
||||
cv::write(fs, "DisableSPSPPS" , DisableSPSPPS);
|
||||
}
|
||||
|
||||
#endif // !defined HAVE_CUDA || !defined WIN32
|
||||
#endif // !defined HAVE_CUDA || !defined WIN32
|
||||
|
Reference in New Issue
Block a user