Skip to content

Commit

Permalink
Merge pull request #650 from rapidsai/branch-24.08
Browse files Browse the repository at this point in the history
Forward-merge branch-24.08 into branch-24.10
  • Loading branch information
GPUtester authored Jul 22, 2024
2 parents 85c34ce + 00e3799 commit fef5453
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions rapids-cmake/test/generate_resource_spec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@ files to be generated.
function(rapids_test_generate_resource_spec DESTINATION filepath)
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.test.generate_resource_spec")

if(NOT DEFINED CMAKE_CUDA_COMPILER AND NOT DEFINED CMAKE_CXX_COMPILER)
unset(rapids_lang)
get_property(rapids_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
if("CXX" IN_LIST rapids_languages)
set(rapids_lang CXX)
# Even when the CUDA language is disabled we want to pass this since it is used by
# find_package(CUDAToolkit) to find the location
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_CUDA_COMPILER)
endif()
if("CUDA" IN_LIST rapids_languages)
set(rapids_lang CUDA)
endif()

if(NOT rapids_lang)
message(FATAL_ERROR "rapids_test_generate_resource_spec Requires the CUDA or C++ language to be enabled."
)
endif()
Expand All @@ -58,18 +70,11 @@ function(rapids_test_generate_resource_spec DESTINATION filepath)
find_package(CUDAToolkit QUIET)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rapids-cmake/")

set(compiler "${CMAKE_CXX_COMPILER}")
set(lang CXX)
if(DEFINED CMAKE_CUDA_COMPILER)
set(compiler "${CMAKE_CUDA_COMPILER}")
set(lang CUDA)
endif()

try_compile(result "${PROJECT_BINARY_DIR}/rapids-cmake/generate_ctest_json-build"
"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/detail/generate_resource_spec"
generate_resource_spec
CMAKE_FLAGS "-DCUDAToolkit_ROOT=${CUDAToolkit_ROOT}" "-Doutput_file=${eval_exe}"
"-Dlang=${lang}" "-Dcuda_toolkit=${CUDAToolkit_FOUND}"
"-Dlang=${rapids_lang}" "-Dcuda_toolkit=${CUDAToolkit_FOUND}"
OUTPUT_VARIABLE compile_output)

if(NOT result)
Expand Down

0 comments on commit fef5453

Please sign in to comment.