Fixed CUDA build with newer SDKs

Recent CUDA SDKs no longer support the "compute_11"
gpu architecture. We now fallback to "compute_20"
instead for newer SDK versions. Additionally, this
behavior can be overriden using the new CMake list
variable OSD_CUDA_NVCC_FLAGS so that it is easier
for clients to target newer architectures and specify
additional arguments.
This commit is contained in:
David G Yu 2016-09-29 20:37:36 -07:00 committed by David G Yu
parent 8929b3062b
commit c824dc34e0
3 changed files with 16 additions and 7 deletions

View File

@ -475,6 +475,22 @@ if(CUDA_FOUND)
-DOPENSUBDIV_HAS_CUDA
)
set(OSD_GPU TRUE)
if (UNIX)
list( APPEND CUDA_NVCC_FLAGS -Xcompiler -fPIC )
if (NOT DEFINED OSD_CUDA_NVCC_FLAGS)
if (CUDA_VERSION_MAJOR LESS 6)
set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_11 )
else()
set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_20 )
endif()
endif()
endif()
if (DEFINED OSD_CUDA_NVCC_FLAGS)
list( APPEND CUDA_NVCC_FLAGS ${OSD_CUDA_NVCC_FLAGS})
endif()
else()
if (NOT NO_CUDA)
message(WARNING

View File

@ -105,9 +105,6 @@ if (NOT NO_LIB)
if( CUDA_FOUND )
include_directories( "${CUDA_INCLUDE_DIRS}" )
if (UNIX)
list( APPEND CUDA_NVCC_FLAGS -Xcompiler -fPIC --gpu-architecture compute_11 )
endif()
endif()

View File

@ -294,10 +294,6 @@ if( CUDA_FOUND )
cudaD3D11VertexBuffer.h
)
endif()
if (UNIX)
list( APPEND CUDA_NVCC_FLAGS -Xcompiler -fPIC --gpu-architecture compute_11 )
endif()
endif()
list(APPEND DOXY_HEADER_FILES ${CUDA_PUBLIC_HEADERS})