1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

[core][cuda] Move throw_no_cuda to it an independant stub so it is not included in the same file that requires cudart

This commit is contained in:
cudawarped
2025-10-20 12:58:39 +03:00
parent 11422da957
commit ff216e8796
5 changed files with 34 additions and 8 deletions
@@ -54,6 +54,7 @@
#include "opencv2/core/base.hpp"
#include "opencv2/core/cuda.hpp"
#include "opencv2/core/private/cuda_stubs.hpp"
#ifdef HAVE_CUDA
# include <cuda.h>
@@ -101,16 +102,10 @@ namespace cv { namespace cuda {
CV_EXPORTS void syncOutput(const GpuMat& dst, OutputArray _dst, Stream& stream);
}}
#ifndef HAVE_CUDA
static inline CV_NORETURN void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The library is compiled without CUDA support"); }
#else // HAVE_CUDA
#ifdef HAVE_CUDA
#define nppSafeSetStream(oldStream, newStream) { if(oldStream != newStream) { cudaStreamSynchronize(oldStream); nppSetStream(newStream); } }
static inline CV_NORETURN void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); }
namespace cv { namespace cuda
{
static inline void checkNppError(int code, const char* file, const int line, const char* func)
@@ -0,0 +1,21 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_CORE_PRIVATE_CUDA_STUBS_HPP
#define OPENCV_CORE_PRIVATE_CUDA_STUBS_HPP
#ifndef __OPENCV_BUILD
# error this is a private header which should not be used from outside of the OpenCV library
#endif
#include "opencv2/core/cvdef.h"
#include "opencv2/core/base.hpp"
#ifndef HAVE_CUDA
static inline CV_NORETURN void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The library is compiled without CUDA support"); }
#else
static inline CV_NORETURN void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); }
#endif
#endif // OPENCV_CORE_PRIVATE_CUDA_STUBS_HPP