[libclc] Only check the triple architecture for libclc (#194149)

Summary:
Previously, `nvptx64--` would reject `nvptx64-unknown-unknown`. Two
options, either normalize all the triples in CMake, or just check the
architecture. I went with the former because it makes it easier for
people to pass different values.
This commit is contained in:
Joseph Huber
2026-04-25 20:52:20 -05:00
committed by GitHub
parent 0ccb181514
commit e7164d4224

View File

@@ -22,26 +22,21 @@ option(
LIBCLC_USE_SPIRV_BACKEND "Build SPIR-V targets with the SPIR-V backend." OFF LIBCLC_USE_SPIRV_BACKEND "Build SPIR-V targets with the SPIR-V backend." OFF
) )
# List of all supported targets. # List of all supported architectures.
set( LIBCLC_TARGETS_ALL set( LIBCLC_ARCHS_ALL amdgpu amdgcn clspv clspv64 nvptx64 spirv spirv64 )
amdgcn-amd-amdhsa-llvm
clspv--
clspv64--
nvptx64--
nvptx64--nvidiacl
nvptx64-nvidia-cuda
spirv-mesa3d-
spirv64-mesa3d-
)
set(LIBCLC_TARGET ${LLVM_DEFAULT_TARGET_TRIPLE}) set(LIBCLC_TARGET ${LLVM_DEFAULT_TARGET_TRIPLE})
if(NOT LIBCLC_TARGET) if(NOT LIBCLC_TARGET)
message(FATAL_ERROR "libclc target is empty\n") message(FATAL_ERROR "libclc target is empty\n")
endif() endif()
if(NOT "${LIBCLC_TARGET}" IN_LIST LIBCLC_TARGETS_ALL)
message(FATAL_ERROR "Unknown libclc target: ${LIBCLC_TARGET}\n" string( REPLACE "-" ";" _target_components ${LIBCLC_TARGET} )
"Valid targets are: ${LIBCLC_TARGETS_ALL}\n") list(GET _target_components 0 _target_arch)
if(NOT "${_target_arch}" IN_LIST LIBCLC_ARCHS_ALL)
message(FATAL_ERROR "Unknown libclc target architecture: ${_target_arch}\n"
"Target was: ${LIBCLC_TARGET}\n"
"Valid architectures are: ${LIBCLC_ARCHS_ALL}\n")
endif() endif()
if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )