@@ -6,57 +6,8 @@ add_executable(SYCL_Example
66target_link_libraries (SYCL_Example PRIVATE layers_lib AdaptiveCpp::acpp-rt )
77
88if (WIN32 )
9- target_compile_definitions (SYCL_Example PRIVATE _USE_MATH_DEFINES )
10-
11- set (SYCL_EXAMPLE_KERNEL_OBJECT "${CMAKE_CURRENT_BINARY_DIR } /sycl_kernel.cpp.obj" )
12- set (_sycl_cpu_cxx "${ACPP_CPU_CXX} " )
13- if (NOT _sycl_cpu_cxx)
14- get_filename_component (_sycl_compiler_dir "${CMAKE_CXX_COMPILER } " DIRECTORY )
15- if (EXISTS "${_sycl_compiler_dir} /clang++.exe" )
16- set (_sycl_cpu_cxx "${_sycl_compiler_dir} /clang++.exe" )
17- endif ()
18- endif ()
19- if (NOT _sycl_cpu_cxx)
20- message (FATAL_ERROR "ACPP_CPU_CXX must point to the Visual Studio LLVM clang++.exe when building SYCL on Windows" )
21- endif ()
22-
23- set (_sycl_kernel_command python "${ACPP_COMPILER} " )
24- if (ACPP_TARGETS)
25- list (APPEND _sycl_kernel_command "--acpp-targets=${ACPP_TARGETS} " )
26- endif ()
27- list (APPEND _sycl_kernel_command
28- "--acpp-cpu-cxx=${_sycl_cpu_cxx} "
29- -std=c++20
30- -fms-runtime-lib=dll
31- -DITLABAI_HAS_SYCL
32- -D_USE_MATH_DEFINES
33- -I "${CMAKE_SOURCE_DIR } /include"
34- )
35- get_target_property (_acpp_include_dirs AdaptiveCpp::acpp-rt INTERFACE_INCLUDE_DIRECTORIES )
36- foreach (_acpp_include_dir IN LISTS _acpp_include_dirs)
37- list (APPEND _sycl_kernel_command -isystem "${_acpp_include_dir} " )
38- endforeach ()
39- list (APPEND _sycl_kernel_command
40- -c "${CMAKE_CURRENT_SOURCE_DIR } /sycl_kernel.cpp"
41- -o "${SYCL_EXAMPLE_KERNEL_OBJECT} "
42- )
43- if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
44- list (APPEND _sycl_kernel_command -g)
45- else ()
46- list (APPEND _sycl_kernel_command -O2)
47- endif ()
48-
49- add_custom_command (
50- OUTPUT "${SYCL_EXAMPLE_KERNEL_OBJECT} "
51- COMMAND ${_sycl_kernel_command}
52- DEPENDS "${CMAKE_CURRENT_SOURCE_DIR } /sycl_kernel.cpp"
53- VERBATIM
54- )
55- set_source_files_properties ("${SYCL_EXAMPLE_KERNEL_OBJECT} " PROPERTIES
56- EXTERNAL_OBJECT TRUE
57- GENERATED TRUE
58- )
59- target_sources (SYCL_Example PRIVATE "${SYCL_EXAMPLE_KERNEL_OBJECT} " )
9+ target_sources (SYCL_Example PRIVATE sycl_kernel.cpp )
10+ target_compile_definitions (SYCL_Example PRIVATE _USE_MATH_DEFINES ITLABAI_HAS_SYCL )
6011else ()
6112 add_library (SYCL_Example_kernel OBJECT sycl_kernel.cpp )
6213 target_compile_definitions (SYCL_Example_kernel PRIVATE ITLABAI_HAS_SYCL )
0 commit comments