cuda: Force C++17 Standard for CUDA targets when CUDA Toolkit >=12.8#27112
cuda: Force C++17 Standard for CUDA targets when CUDA Toolkit >=12.8#27112asmorkalov merged 2 commits intoopencv:4.xfrom
Conversation
cuda: Force C++17 Standard for CUDA targets when CUDA Toolkit >=12.8
cmake/OpenCVDetectCUDA.cmake
Outdated
| if(CUDA_VERSION VERSION_GREATER_EQUAL "12.8") | ||
| list(APPEND CUDA_NVCC_FLAGS "--std=c++17") | ||
| endif() |
There was a problem hiding this comment.
Why --std=c++11 and --std=c++14 are set for UNIX or APPLE, but --std=c++17 - for all platforms. Most probably it's a mistake.
There was a problem hiding this comment.
When @opencv-alalek first introduced the additional check it was for these two platforms. I couldn't determine a reason why it wasn't required for Windows. In the end to avoid having to test/install many versions of the Tookit on both platforms and because this is the depreciated FindCuda approach I decided to leave the existing checks as they are to be 100% that it wouldn't break any existing user code.
I can simply apply the condition to all platforms if you want?
There was a problem hiding this comment.
Perhaps Windows requires other flags (of there is similar problem - need Windows configuration to check that first).
BTW, We use CMAKE_CXX_STANDARD variable for general C++ code:
https://github.com/opencv/opencv/blob/4.11.0/cmake/OpenCVDetectCXXCompiler.cmake#L211
May be we should have proper try_compile() check for nvcc?
Perhaps CMAKE_CXX_STANDARD should be tuned (or checked/forced) instead of manual flags
… by the latest versions of Thrust.
df9e6de to
cf04e57
Compare
|
@asmorkalov The original issue was for builds on Windows. Your additional changes prevent this from working on Windows? |
|
Sorry, I missed that. Looking on it now. |
Fix #27095.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.