| set(CMAKE_EXPERIMENTAL_SYCL "c0d1fb10-2ece-420e-9d29-7d7f2b300f25") | |
| enable_language(SYCL) | |
| if(CMAKE_SYCL_COMPILER_ID STREQUAL "Clang") | |
| set(CMAKE_SYCL_DEVICE_TARGETS spirv64-unknown-unknown) | |
| elseif(CMAKE_SYCL_COMPILER_ID MATCHES "^(DPClang|IntelLLVM)$") | |
| set(CMAKE_SYCL_DEVICE_TARGETS spir64) | |
| elseif(CMAKE_SYCL_COMPILER_ID STREQUAL "AdaptiveCpp") | |
| set(CMAKE_SYCL_DEVICE_TARGETS omp.accelerated) | |
| endif() | |
| set(CMAKE_TRY_COMPILE_CONFIGURATION Release) | |
| try_compile(works SOURCE_FROM_CONTENT check.sycl | |
| "int main() { return 0; }" | |
| OUTPUT_VARIABLE output) | |
| if(NOT works) | |
| message(FATAL_ERROR "SYCL device targets try_compile failed:\n${output}") | |
| endif() | |
| if(NOT output MATCHES "(acpp-targets|fsycl-targets|offload-targets)=") | |
| message(FATAL_ERROR "Device targets not propagated to try_compile:\n${output}") | |
| endif() |