Skip to content

Commit e2d87de

Browse files
authored
Merge pull request #27522 from chacha21:fix_cuda129_msvc
Fix compilation problems with MSVC+Cuda 12.9 #27522 fix for #27521 Actually, when ENABLE_CUDA_FIRST_CLASS_LANGUAGE is enabled, the fix it not necessary. However, even when ENABLE_CUDA_FIRST_CLASS_LANGUAGE is enabled, I have checked that the fix is harmless So I propose to keep it simple for now and enable the fix whatever the state of ENABLE_CUDA_FIRST_CLASS_LANGUAGE ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [X] The PR is proposed to the proper branch - [X] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
1 parent f54286b commit e2d87de

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmake/OpenCVDetectCUDAUtils.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,13 @@ macro(ocv_nvcc_flags)
388388
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler=-fno-finite-math-only)
389389
endif()
390390

391-
if(WIN32 AND NOT (CUDA_VERSION VERSION_LESS "11.2"))
392-
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcudafe --display_error_number --diag-suppress 1394,1388)
391+
if(WIN32)
392+
if (NOT (CUDA_VERSION VERSION_LESS "11.2"))
393+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcudafe --display_error_number --diag-suppress 1394,1388)
394+
endif()
395+
if(CUDA_VERSION GREATER "12.8")
396+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler=/Zc:preprocessor)
397+
endif()
393398
endif()
394399

395400
if(CMAKE_CROSSCOMPILING AND (ARM OR AARCH64))

0 commit comments

Comments
 (0)