The add_sycl_to_target
function invokes the compiler we distribute (compute++
) on the source files in the target you specify. You can instead tell CMake to use compute++
as the host compiler, then add that flag to every file with a kernel in it. You can do this with something like
find_project(ComputeCpp REQUIRED)
set(CMAKE_CXX_COMPILER ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE})
add_executable(foo foo.cc)
set_properties(TARGET foo APPEND COMPILE_FLAGS -sycl-driver)
target_link_libraries(foo PRIVATE ComputeCpp::ComputeCpp)
Something like that. I’m afraid that’s totally untested but might be closer to what you’re looking for. If you check the integration guide on our website (which should also be distributed with the package) there’s some information on what the compilation model is and how you can choose to integrate with it.