Skip to content

Commit dad1617

Browse files
committed
add exception for MSVC CUDA EP build for now...
1 parent 2213158 commit dad1617

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

cmake/CMakeLists.txt

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "IntelLLVM")
2121
endif()
2222
endif()
2323

24-
# Needed for Java
25-
if (NOT CMAKE_CXX_STANDARD)
26-
set(CMAKE_C_STANDARD 99)
27-
endif()
28-
2924
include(CheckCXXCompilerFlag)
3025
include(CheckLanguage)
3126
include(CMakeDependentOption)
@@ -34,10 +29,6 @@ include(CheckFunctionExists)
3429
include(CheckSymbolExists)
3530
include(GNUInstallDirs) # onnxruntime_providers_* require CMAKE_INSTALL_* variables
3631

37-
if (NOT CMAKE_CXX_STANDARD)
38-
set(CMAKE_CXX_STANDARD 20)
39-
endif()
40-
4132
if (MSVC)
4233
# Make sure Visual Studio sets __cplusplus macro correctly: https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus
4334
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
@@ -249,6 +240,24 @@ option(onnxruntime_USE_OPENVINO_INTERFACE "Build ONNXRuntime shared lib which is
249240
option(onnxruntime_USE_VITISAI_INTERFACE "Build ONNXRuntime shared lib which is compatible with Vitis-AI EP interface" OFF)
250241
option(onnxruntime_USE_QNN_INTERFACE "Build ONNXRuntime shared lib which is compatible with QNN EP interface" OFF)
251242

243+
# Set C/C++ standard versions
244+
if (NOT CMAKE_C_STANDARD)
245+
# Needed for Java
246+
set(CMAKE_C_STANDARD 99)
247+
endif()
248+
249+
if (NOT CMAKE_CXX_STANDARD)
250+
# TODO move all builds to C++20
251+
if (MSVC AND onnxruntime_USE_CUDA)
252+
# There's a compilation error from CUTLASS header "cute/tensor.hpp" when attempting to use C++20:
253+
# cutlass-src\include\cute\stride.hpp(299,46): error C3545: 'Ints': parameter pack expects a non-type template
254+
# argument
255+
set(CMAKE_CXX_STANDARD 17)
256+
else()
257+
set(CMAKE_CXX_STANDARD 20)
258+
endif()
259+
endif()
260+
252261
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 11.1)
253262
message(FATAL_ERROR "GCC version must be greater than or equal to 11.1")
254263
endif()

0 commit comments

Comments
 (0)