File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,11 +5,37 @@ add_executable(SYCL_Example
55)
66target_link_libraries (SYCL_Example PRIVATE layers_lib AdaptiveCpp::acpp-rt )
77
8- add_library (SYCL_Example_kernel OBJECT sycl_kernel.cpp )
9- add_sycl_to_target (TARGET SYCL_Example_kernel SOURCES
10- sycl_kernel.cpp
11- )
12- target_sources (SYCL_Example PRIVATE $<TARGET_OBJECTS :SYCL_Example_kernel >)
8+ if (WIN32 )
9+ set (SYCL_EXAMPLE_KERNEL_OBJECT "${CMAKE_CURRENT_BINARY_DIR } /sycl_kernel.cpp.obj" )
10+ set (_sycl_kernel_command python "${ACPP_COMPILER} " )
11+ if (ACPP_TARGETS)
12+ list (APPEND _sycl_kernel_command "--acpp-targets=${ACPP_TARGETS} " )
13+ endif ()
14+ list (APPEND _sycl_kernel_command
15+ -std=c++20
16+ -c "${CMAKE_CURRENT_SOURCE_DIR } /sycl_kernel.cpp"
17+ -o "${SYCL_EXAMPLE_KERNEL_OBJECT} "
18+ )
19+ if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
20+ list (APPEND _sycl_kernel_command -g)
21+ else ()
22+ list (APPEND _sycl_kernel_command -O2)
23+ endif ()
24+
25+ add_custom_command (
26+ OUTPUT "${SYCL_EXAMPLE_KERNEL_OBJECT} "
27+ COMMAND ${_sycl_kernel_command}
28+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR } /sycl_kernel.cpp"
29+ VERBATIM
30+ )
31+ target_sources (SYCL_Example PRIVATE "${SYCL_EXAMPLE_KERNEL_OBJECT} " )
32+ else ()
33+ add_library (SYCL_Example_kernel OBJECT sycl_kernel.cpp )
34+ add_sycl_to_target (TARGET SYCL_Example_kernel SOURCES
35+ sycl_kernel.cpp
36+ )
37+ target_sources (SYCL_Example PRIVATE $<TARGET_OBJECTS :SYCL_Example_kernel >)
38+ endif ()
1339
1440add_test (NAME SYCL.Example COMMAND SYCL_Example )
1541set_tests_properties (SYCL.Example PROPERTIES
You can’t perform that action at this time.
0 commit comments