| cmake_minimum_required(VERSION 4.4) | |
| set(CMAKE_EXPERIMENTAL_SYCL "c0d1fb10-2ece-420e-9d29-7d7f2b300f25") | |
| project(SeparateCompilationObjects LANGUAGES SYCL) | |
| include(../utils/Test.cmake) | |
| # Remove gate when IntelLLVM -fsycl-link bug is fixed | |
| if(CMAKE_SYCL_COMPILER_ID STREQUAL "IntelLLVM") | |
| sycl_not_supported("IntelLLVM -fsycl-link cannot produce a single device-link output") | |
| return() | |
| endif() | |
| if(NOT CMAKE_SYCL_COMPILE_OPTIONS_SEPARABLE_COMPILATION_ON) | |
| sycl_not_supported("${CMAKE_SYCL_COMPILER_ID} has no explicit SYCL separable compilation") | |
| return() | |
| endif() | |
| add_library(foo OBJECT foo.sycl) | |
| set_property(TARGET foo PROPERTY SYCL_SEPARABLE_COMPILATION ON) | |
| add_library(bar OBJECT bar.sycl) | |
| set_property(TARGET bar PROPERTY SYCL_SEPARABLE_COMPILATION ON) | |
| add_executable(SyclOnlySeparateCompilationTargetObjects main.sycl) | |
| set_property(TARGET SyclOnlySeparateCompilationTargetObjects PROPERTY SYCL_SEPARABLE_COMPILATION ON) | |
| target_link_libraries(SyclOnlySeparateCompilationTargetObjects PRIVATE $<TARGET_OBJECTS:foo> bar) | |
| sycl_add_runtime_test(SeparateCompilationTargetObjects SyclOnlySeparateCompilationTargetObjects) |