Skip to content

Commit

Permalink
build: fix CUDA 11.x compilation (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
longhuan2018 authored Dec 16, 2021
1 parent 0d57474 commit 35facc5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ if(OpenMVS_USE_CUDA)
FIND_PACKAGE(CUDA)
if(CUDA_FOUND)
ENABLE_LANGUAGE(CUDA)
# CUDA-11.x can not be compiled using C++14 standard on Windows
string(REGEX MATCH "^[0-9]+" CUDA_MAJOR ${CMAKE_CUDA_COMPILER_VERSION})
if(${CUDA_MAJOR} GREATER 10 AND CMAKE_CXX_COMPILER MATCHES "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.29")
message("Working around windows build failure with visual studio. Visual studio 16.10 introduced a compiler bug with compilng CUDA code with C++14. Set the cuda standard to 17 as a workaround.")
set(CMAKE_CUDA_STANDARD 17)
endif()
if(NOT OpenMVS_MAX_CUDA_COMPATIBILITY)
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
SET(CMAKE_CUDA_ARCHITECTURES 75)
Expand Down

0 comments on commit 35facc5

Please sign in to comment.