Unverified Commit 6948f0b8 authored by Matthew Douglas's avatar Matthew Douglas Committed by GitHub
Browse files

Fix Windows CUDA build compatibility with newest MSVC (#1276)

* Add support for building with latest MSVC

* Update MSVC 1940+ support for CUDA builds.
parent 7be11439
...@@ -64,6 +64,13 @@ endif() ...@@ -64,6 +64,13 @@ endif()
if(BUILD_CUDA) if(BUILD_CUDA)
# NVCC normally will only work with MSVC up to 1939. VS2022 17.10+ starts using versions 1940+.
# Workaround: use --allow-unsupported-compiler
# This needs to be added *before* we try to enable the CUDA language so CMake's compiler check passes.
if(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL 1940)
string(APPEND CMAKE_CUDA_FLAGS " --allow-unsupported-compiler")
endif()
enable_language(CUDA) # This will fail if CUDA is not found enable_language(CUDA) # This will fail if CUDA is not found
find_package(CUDAToolkit REQUIRED) find_package(CUDAToolkit REQUIRED)
...@@ -188,7 +195,6 @@ if(WIN32) ...@@ -188,7 +195,6 @@ if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif() endif()
# Weird MSVC hacks
if(MSVC) if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2 /fp:fast") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2 /fp:fast")
endif() endif()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment