@@ -299,19 +299,6 @@ else()
299
299
endif ()
300
300
set (CMAKE_CXX_EXTENSIONS OFF ) # Improved compatibility
301
301
302
- # FIXME: Remove this workaround once a fixed Visual Studio 16.10 version is released.
303
- if (BUILD_CUDA_MODULE
304
- AND CMAKE_CXX_COMPILER MATCHES "MSVC"
305
- AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.29"
306
- )
307
- # Keep C++14 standard for unaffected C++ files, but use C++17 for CUDA files.
308
- set (CMAKE_CUDA_STANDARD 17)
309
- # Suppress warnings for deprecated C++17 functions.
310
- add_compile_definitions ($<$<COMPILE_LANGUAGE:CUDA>:_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING>)
311
- message (WARNING "Visual Studio 16.10 (MSVC 19.29) introduced a compiler bug when compiling CUDA code with C++14. "
312
- "Workaround this bug by setting the CUDA standard to C++17." )
313
- endif ()
314
-
315
302
# CMake modules
316
303
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" "${CMAKE_CURRENT_SOURCE_DIR} /3rdparty/cmake" )
317
304
@@ -400,6 +387,14 @@ cmake_language(EVAL CODE "cmake_language(DEFER CALL open3d_patch_findthreads_mod
400
387
401
388
# Build CUDA module by default if CUDA is available
402
389
if (BUILD_CUDA_MODULE)
390
+ # Suppress nvcc unsupported compiler error for MSVC 2022 with CUDA 11.7 to 12.4
391
+ # https://forums.developer.nvidia.com/t/problems-with-latest-vs2022-update/294150/12
392
+ if (MSVC AND MSVC_VERSION VERSION_LESS_EQUAL "1949" )
393
+ # Set this before any CUDA checks
394
+ set (CMAKE_CUDA_FLAGS "--allow-unsupported-compiler" CACHE STRING "Additional flags for nvcc" FORCE)
395
+ message (WARNING "Using --allow-unsupported-compiler flag for nvcc with MSVC 2022." )
396
+ endif ()
397
+
403
398
include (Open3DMakeCudaArchitectures)
404
399
open3d_make_cuda_architectures(CUDA_ARCHS)
405
400
set (CMAKE_CUDA_ARCHITECTURES ${CUDA_ARCHS} )
0 commit comments