Skip to content

Commit

Permalink
MSVC: Add warning if MSVC >= 1711 that >= CUDA 12.4 is required
Browse files Browse the repository at this point in the history
Also moves where CheckCompilerFunctionality is included to ensure it is triggered before CUDA is attempted
  • Loading branch information
ptheywood committed Aug 30, 2024
1 parent 3befb59 commit 6ceeee6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmake/CheckCompilerFunctionality.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,20 @@ function(flamegpu_visualiser_check_compiler_functionality)
enable_language(CXX)
check_language(CUDA)
if(NOT CMAKE_CUDA_COMPILER)
# If using MSVC >= 1940 then CUDA <= 12.3 support requires -allow-unsupported-compiler, so warn about this
# MSVC 1911 (VS2022 17.11) requires CUDA 12.4 or greater - see https://github.com/microsoft/STL/pull/4475
if(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL "1940")
message(WARNING
" CUDA Language Support Not Found (with MSVC ${MSVC_VERSION} >= 1941)\n"
" \n"
" The MSVC STL included with MSVC 1941 requires CUDA 12.4 or newer\n"
" If you have CUDA <= 12.3 installed you must either:\n"
" - Upgrade CUDA to >= 12.4\n"
" - Downgrade MSVC to 1940 and set the CUDAFLAGS environment variable to contain '-allow-unsupported-compiler'\n"
" - Downgrade MSVC to 1939 or older\n"
" You must then clear the CMake cache before reconfiguring\n"
)
# If using MSVC >= 1940 then CUDA <= 12.3 support requires -allow-unsupported-compiler, so warn about this
elseif(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL "1940")
# If this is the case, then CMake >= 3.29.4 is also required, otherwise CMake does not pass -allow-unsupported-compiler along, warn as appropriate
if(CMAKE_VERSION VERSION_LESS "3.29.4")
message(WARNING
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ project(flamegpu_visualiser LANGUAGES NONE)
# handle cpplint.
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/cpplint.cmake)

# Ensure found compilers are actually good enough / don't trigger known issues.
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/CheckCompilerFunctionality.cmake)

# Check to see if CUDA is available, and meets the required minimum version for non-lint builds
if(NOT DEFINED MINIMUM_CUDA_VERSION)
set(MINIMUM_CUDA_VERSION 11.0)
Expand Down

0 comments on commit 6ceeee6

Please sign in to comment.