Skip to content

Commit

Permalink
CMake: Emit useful error message if MSVC >= 1940 and CUDA <= 12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ptheywood committed Aug 29, 2024
1 parent 29e78f7 commit 8afc40e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion cmake/CheckCompilerFunctionality.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,34 @@ function(flamegpu_visualiser_check_compiler_functionality)
enable_language(CXX)
check_language(CUDA)
if(NOT CMAKE_CUDA_COMPILER)
message(WARNING "CUDA Language Support Not Found")
# If using MSVC >= 1940 then CUDA <= 12.3 support requires -allow-unsupported-compiler, so warn about this
if(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
" CUDA Language Support Not Found (with MSVC ${MSVC_VERSION} >= 1940)\n"
" \n"
" If you have CUDA <= 12.3 installed:\n"
" - You must upgrade CMake to be >= 3.29.4\n"
" The CUDAFLAGS environment variable must include '-allow-unsupported-compiler'\n"
" You must clear the CMake Cache before reconfiguring this project\n"
" \n"
" - Alternatively you may upgrade CUDA to >= 12.4 and clear the CMake Cache before reconfiguring\n"
)
else()
message(WARNING
" CUDA Language Support Not Found (with MSVC ${MSVC_VERSION} >= 1940)\n"
" \n"
" If you have CUDA <= 12.3 installed:\n"
" - The CUDAFLAGS environment variable must include '-allow-unsupported-compiler'\n"
" You must clear the CMake Cache before reconfiguring this project\n"
" \n"
" - Alternatively you may upgrade CUDA to >= 12.4 and clear the CMake Cache before reconfiguring\n"
)
endif()
else()
message(WARNING "CUDA Language Support Not Found")
endif()
set(FLAMEGPU_VISUALISER_CheckCompilerFunctionality_RESULT "NO" PARENT_SCOPE)
return()
endif()
Expand Down

0 comments on commit 8afc40e

Please sign in to comment.