diff --git a/CMakeLists.txt b/CMakeLists.txt index 7831430e69..6621a2f99f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,14 +110,15 @@ endif() # Optional 3rd party components # =================================================== -OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (UNIX AND NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (UNIX AND NOT ANDROID AND NOT IOS AND NOT CARMA) ) OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS) OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE ) -OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS AND NOT APPLE) ) OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON) -OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS)) OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_IMAGEIO "ImageIO support for OS X" OFF IF APPLE) @@ -140,9 +141,9 @@ OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON OCV_OPTION(WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON IF WIN32 ) OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT APPLE) ) OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) -OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" OFF IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" OFF IF (NOT ANDROID AND NOT IOS AND NOT CARMA) ) +OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" OFF IF (NOT ANDROID AND NOT IOS AND NOT CARMA) ) +OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" OFF IF (NOT ANDROID AND NOT IOS AND NOT CARMA) ) # OpenCV build components @@ -161,12 +162,12 @@ OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF I OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID ) # 3rd party libs -OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR APPLE ) -OCV_OPTION(BUILD_TIFF "Build libtiff from source" WIN32 OR ANDROID OR APPLE ) -OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR ANDROID OR APPLE ) -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_ZLIB "Build zlib from source" WIN32 OR APPLE OR CARMA ) +OCV_OPTION(BUILD_TIFF "Build libtiff from source" WIN32 OR ANDROID OR APPLE OR CARMA ) +OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR ANDROID OR APPLE OR CARMA ) +OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR ANDROID OR APPLE OR CARMA ) +OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR ANDROID OR APPLE OR CARMA ) +OCV_OPTION(BUILD_OPENEXR "Build openexr from source" WIN32 OR ANDROID OR APPLE OR CARMA ) # OpenCV installation options @@ -776,8 +777,9 @@ if(HAVE_CUDA) status("") status(" NVIDIA CUDA") - status(" Use CUFFT:" HAVE_CUFFT THEN YES ELSE NO) - status(" Use CUBLAS:" HAVE_CUBLAS THEN YES ELSE NO) + status(" Use CUFFT:" HAVE_CUFFT THEN YES ELSE NO) + status(" Use CUBLAS:" HAVE_CUBLAS THEN YES ELSE NO) + status(" USE NVCUVID:" HAVE_NVCUVID THEN YES ELSE NO) status(" NVIDIA GPU arch:" ${OPENCV_CUDA_ARCH_BIN}) status(" NVIDIA PTX archs:" ${OPENCV_CUDA_ARCH_PTX}) status(" Use fast math:" CUDA_FAST_MATH THEN YES ELSE NO) diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake index c1cd83866b..25cfdd225c 100644 --- a/cmake/OpenCVDetectCUDA.cmake +++ b/cmake/OpenCVDetectCUDA.cmake @@ -3,17 +3,17 @@ if(${CMAKE_VERSION} VERSION_LESS "2.8.3") return() endif() -if (WIN32 AND NOT MSVC) - message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler suppoted on your platform).") +if(WIN32 AND NOT MSVC) + message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler supported on your platform).") return() endif() -if (CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - message(STATUS "CUDA compilation is disabled (due to Clang unsuppoted on your platform).") +if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + message(STATUS "CUDA compilation is disabled (due to Clang unsupported on your platform).") return() endif() -find_package(CUDA 4.1) +find_package(CUDA 4.2 QUIET) if(CUDA_FOUND) set(HAVE_CUDA 1) @@ -26,16 +26,21 @@ if(CUDA_FOUND) set(HAVE_CUBLAS 1) endif() + if(WITH_NVCUVID) + find_cuda_helper_libs(nvcuvid) + set(HAVE_NVCUVID 1) + endif() + message(STATUS "CUDA detected: " ${CUDA_VERSION}) - if(${CUDA_VERSION_STRING} VERSION_GREATER "4.1") - set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported") + if (CARMA) + set(CUDA_ARCH_BIN "2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported") + set(CUDA_ARCH_PTX "3.0" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for") else() - set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0)" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported") + set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported") + set(CUDA_ARCH_PTX "2.0 3.0" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for") endif() - set(CUDA_ARCH_PTX "2.0" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for") - string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}") string(REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}") @@ -72,11 +77,20 @@ if(CUDA_FOUND) # Tell NVCC to add PTX intermediate code for the specified architectures string(REGEX MATCHALL "[0-9]+" ARCH_LIST "${ARCH_PTX_NO_POINTS}") - foreach(ARCH IN LISTS ARCH_LIST) - set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=compute_${ARCH}) - set(OPENCV_CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX} ${ARCH}") - set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}") - endforeach() + foreach(ARCH IN LISTS ARCH_LIST) + set(NVCC_FLAGS_EXTRA ${NVCC_FLAGS_EXTRA} -gencode arch=compute_${ARCH},code=compute_${ARCH}) + set(OPENCV_CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX} ${ARCH}") + set(OPENCV_CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES} ${ARCH}") + endforeach() + + if(CARMA) + set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --target-cpu-architecture=ARM" ) + + if (CMAKE_VERSION VERSION_LESS 2.8.10) + set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -ccbin=${CMAKE_CXX_COMPILER}" ) + endif() + + endif() # These vars will be processed in other scripts set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${NVCC_FLAGS_EXTRA}) @@ -84,7 +98,7 @@ if(CUDA_FOUND) message(STATUS "CUDA NVCC target flags: ${CUDA_NVCC_FLAGS}") - OCV_OPTION(CUDA_FAST_MATH "Enable --use_fast_math for CUDA compiler " OFF) + OCV_OPTION(CUDA_FAST_MATH "Enable --use_fast_math for CUDA compiler " OFF) if(CUDA_FAST_MATH) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --use_fast_math) @@ -92,7 +106,6 @@ if(CUDA_FOUND) mark_as_advanced(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_VERBOSE_BUILD CUDA_SDK_ROOT_DIR) - unset(CUDA_npp_LIBRARY CACHE) find_cuda_helper_libs(npp) macro(ocv_cuda_compile VAR) @@ -106,15 +119,15 @@ if(CUDA_FOUND) string(REPLACE "-ggdb3" "" ${var} "${${var}}") endforeach() - if (BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -DCVAPI_EXPORTS) endif() if(UNIX OR APPLE) - set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC) + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC) endif() if(APPLE) - set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only) + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only) endif() # disabled because of multiple warnings during building nvcc auto generated files diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 4cf87536d8..de0a377a7c 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -42,8 +42,9 @@ set(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC_CONFIGCMAKE@) set(OpenCV_CUDA_VERSION @OpenCV_CUDA_VERSION@) -set(OpenCV_USE_CUBLAS @HAVE_CUBLAS@) -set(OpenCV_USE_CUFFT @HAVE_CUFFT@) +set(OpenCV_USE_CUBLAS @HAVE_CUBLAS@) +set(OpenCV_USE_CUFFT @HAVE_CUFFT@) +set(OpenCV_USE_NVCUVID @HAVE_NVCUVID@) # Android API level from which OpenCV has been compiled is remembered set(OpenCV_ANDROID_NATIVE_API_LEVEL @OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE@) @@ -218,17 +219,22 @@ foreach(__opttype OPT DBG) else() #TODO: duplicates are annoying but they should not be the problem endif() - # fix hard coded paths for CUDA libraries under Windows - if(WIN32 AND OpenCV_CUDA_VERSION AND NOT OpenCV_SHARED) + + # CUDA + if(OpenCV_CUDA_VERSION AND (CARMA OR (WIN32 AND NOT OpenCV_SHARED))) if(NOT CUDA_FOUND) find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED) else() if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION) - message(FATAL_ERROR "OpenCV static library compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}") + if(WIN32) + message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}") + else() + message(FATAL_ERROR "OpenCV library for CARMA was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}") + endif() endif() endif() - list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY} ${CUDA_nvcuvid_LIBRARY} ${CUDA_nvcuvenc_LIBRARY}) + list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) if(OpenCV_USE_CUBLAS) list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_CUBLAS_LIBRARIES}) @@ -238,6 +244,13 @@ foreach(__opttype OPT DBG) list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_CUFFT_LIBRARIES}) endif() + if(OpenCV_USE_NVCUVID) + list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_nvcuvid_LIBRARIES}) + endif() + + if(WIN32) + list(APPEND OpenCV_EXTRA_LIBS_${__opttype} ${CUDA_nvcuvenc_LIBRARIES}) + endif() endif() endforeach() diff --git a/cmake/templates/cvconfig.h.cmake b/cmake/templates/cvconfig.h.cmake index 368905fd9c..aa372260e4 100644 --- a/cmake/templates/cvconfig.h.cmake +++ b/cmake/templates/cvconfig.h.cmake @@ -175,21 +175,15 @@ /* NVidia Cuda Runtime API*/ #cmakedefine HAVE_CUDA -/* OpenCL Support */ -#cmakedefine HAVE_OPENCL - -/* AMD's OpenCL Fast Fourier Transform Library*/ -#cmakedefine HAVE_CLAMDFFT - -/* AMD's Basic Linear Algebra Subprograms Library*/ -#cmakedefine HAVE_CLAMDBLAS - /* NVidia Cuda Fast Fourier Transform (FFT) API*/ #cmakedefine HAVE_CUFFT /* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/ #cmakedefine HAVE_CUBLAS +/* NVidia Video Decoding API*/ +#cmakedefine HAVE_NVCUVID + /* Compile for 'real' NVIDIA GPU architectures */ #define CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN}" @@ -202,6 +196,15 @@ /* Create PTX or BIN for 1.0 compute capability */ #cmakedefine CUDA_ARCH_BIN_OR_PTX_10 +/* OpenCL Support */ +#cmakedefine HAVE_OPENCL + +/* AMD's OpenCL Fast Fourier Transform Library*/ +#cmakedefine HAVE_CLAMDFFT + +/* AMD's Basic Linear Algebra Subprograms Library*/ +#cmakedefine HAVE_CLAMDBLAS + /* VideoInput library */ #cmakedefine HAVE_VIDEOINPUT diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index cfa14cdcdb..4c5112e3f9 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -10,7 +10,6 @@ if(HAVE_CUDA) file(GLOB lib_cuda "src/cuda/*.cu") ocv_cuda_compile(cuda_objs ${lib_cuda}) - set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) else() set(lib_cuda "") diff --git a/modules/gpu/CMakeLists.txt b/modules/gpu/CMakeLists.txt index cf69ba1259..0c9f709b15 100644 --- a/modules/gpu/CMakeLists.txt +++ b/modules/gpu/CMakeLists.txt @@ -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() diff --git a/modules/gpu/misc/carma.toolchain.cmake b/modules/gpu/misc/carma.toolchain.cmake new file mode 100644 index 0000000000..18f0e0f934 --- /dev/null +++ b/modules/gpu/misc/carma.toolchain.cmake @@ -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) diff --git a/modules/gpu/src/cuvid_video_source.cpp b/modules/gpu/src/cuvid_video_source.cpp index 5c46913539..7d45b8fee9 100644 --- a/modules/gpu/src/cuvid_video_source.cpp +++ b/modules/gpu/src/cuvid_video_source.cpp @@ -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) { diff --git a/modules/gpu/src/cuvid_video_source.h b/modules/gpu/src/cuvid_video_source.h index a06353fedd..1c4c0e5e00 100644 --- a/modules/gpu/src/cuvid_video_source.h +++ b/modules/gpu/src/cuvid_video_source.h @@ -45,7 +45,7 @@ #include "precomp.hpp" -#if defined(HAVE_CUDA) && !defined(__APPLE__) +#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID) namespace cv { namespace gpu { diff --git a/modules/gpu/src/ffmpeg_video_source.cpp b/modules/gpu/src/ffmpeg_video_source.cpp index 71553d9915..bd3d70058a 100644 --- a/modules/gpu/src/ffmpeg_video_source.cpp +++ b/modules/gpu/src/ffmpeg_video_source.cpp @@ -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 diff --git a/modules/gpu/src/ffmpeg_video_source.h b/modules/gpu/src/ffmpeg_video_source.h index 66bb7c71ca..41bf0cfd0e 100644 --- a/modules/gpu/src/ffmpeg_video_source.h +++ b/modules/gpu/src/ffmpeg_video_source.h @@ -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; diff --git a/modules/gpu/src/frame_queue.cpp b/modules/gpu/src/frame_queue.cpp index 4ed6d0f147..0d93918732 100644 --- a/modules/gpu/src/frame_queue.cpp +++ b/modules/gpu/src/frame_queue.cpp @@ -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), diff --git a/modules/gpu/src/frame_queue.h b/modules/gpu/src/frame_queue.h index 5c049a28e5..00c44a4015 100644 --- a/modules/gpu/src/frame_queue.h +++ b/modules/gpu/src/frame_queue.h @@ -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 { diff --git a/modules/gpu/src/precomp.hpp b/modules/gpu/src/precomp.hpp index c37332ae45..7c53185107 100644 --- a/modules/gpu/src/precomp.hpp +++ b/modules/gpu/src/precomp.hpp @@ -97,12 +97,12 @@ #include #endif - #ifndef __APPLE__ + #ifdef HAVE_NVCUVID #include - #endif - #ifdef WIN32 - #include + #ifdef WIN32 + #include + #endif #endif #include "internal_shared.hpp" diff --git a/modules/gpu/src/thread_wrappers.cpp b/modules/gpu/src/thread_wrappers.cpp index fcfa59827e..f8099aca91 100644 --- a/modules/gpu/src/thread_wrappers.cpp +++ b/modules/gpu/src/thread_wrappers.cpp @@ -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 diff --git a/modules/gpu/src/thread_wrappers.h b/modules/gpu/src/thread_wrappers.h index 9198d3e906..78e675216c 100644 --- a/modules/gpu/src/thread_wrappers.h +++ b/modules/gpu/src/thread_wrappers.h @@ -45,7 +45,7 @@ #include "precomp.hpp" -#if defined(HAVE_CUDA) && !defined(__APPLE__) +#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID) namespace cv { namespace gpu { diff --git a/modules/gpu/src/video_decoder.cpp b/modules/gpu/src/video_decoder.cpp index 41e1d26078..c1e8f86a4c 100644 --- a/modules/gpu/src/video_decoder.cpp +++ b/modules/gpu/src/video_decoder.cpp @@ -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) { diff --git a/modules/gpu/src/video_decoder.h b/modules/gpu/src/video_decoder.h index 9c4dfa9294..634643b889 100644 --- a/modules/gpu/src/video_decoder.h +++ b/modules/gpu/src/video_decoder.h @@ -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 { diff --git a/modules/gpu/src/video_parser.cpp b/modules/gpu/src/video_parser.cpp index 2ff14bd75a..70187fcb2f 100644 --- a/modules/gpu/src/video_parser.cpp +++ b/modules/gpu/src/video_parser.cpp @@ -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) diff --git a/modules/gpu/src/video_parser.h b/modules/gpu/src/video_parser.h index 3935ffcefe..44a53710bf 100644 --- a/modules/gpu/src/video_parser.h +++ b/modules/gpu/src/video_parser.h @@ -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 { diff --git a/modules/gpu/src/video_reader.cpp b/modules/gpu/src/video_reader.cpp index df3c2ff2f0..3224902c6d 100644 --- a/modules/gpu/src/video_reader.cpp +++ b/modules/gpu/src/video_reader.cpp @@ -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 { diff --git a/modules/gpu/src/video_writer.cpp b/modules/gpu/src/video_writer.cpp index 036512d9af..fe44a16f7c 100644 --- a/modules/gpu/src/video_writer.cpp +++ b/modules/gpu/src/video_writer.cpp @@ -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 \ No newline at end of file +#endif // !defined HAVE_CUDA || !defined WIN32