82
82
add_custom_target (ocl-icd DEPENDS ${OpenCL_LIBRARIES} COMMENT "Copying OpenCL ICD Loader ..." )
83
83
endif ()
84
84
85
- set (SYCL_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR} /include/" )
86
85
set (OPENCL_INCLUDE "${OpenCL_INCLUDE_DIRS} " )
87
86
88
87
# Configure SYCL version macro
@@ -96,89 +95,19 @@ add_custom_target(sycl-headers ALL
96
95
COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir} /CL ${dst_dir} /CL
97
96
COMMENT "Copying SYCL headers ..." )
98
97
99
- # Main library
98
+ # Configure SYCL headers
99
+ install (DIRECTORY "${sycl_inc_dir} /." DESTINATION "${LLVM_INST_INC_DIRECTORY} " COMPONENT sycl-headers )
100
100
101
- set (sourceRootPath "${CMAKE_CURRENT_SOURCE_DIR} /source" )
102
- set (includeRootPath "${CMAKE_CURRENT_SOURCE_DIR} /include" )
103
-
104
- include_directories (AFTER "${includeRootPath} " "${OpenCL_INCLUDE_DIRS} " )
101
+ # Configure OpenCL header and ICD loader
102
+ include_directories (AFTER "${sycl_inc_dir} " "${OpenCL_INCLUDE_DIRS} " )
105
103
link_libraries (${OpenCL_LIBRARIES} )
106
104
107
- set (SYCLLibrary sycl )
108
-
109
- #To-Do:
110
- #1. Figure out why CMP0057 has to be set. Should have been taken care of earlier in the build
111
- #2. Use AddLLVM to modify the build and access config options
112
- #cmake_policy(SET CMP0057 NEW)
113
- #include(AddLLVM)
114
- set (LLVM_BUILD_LIBRARY_DIRS "${LLVM_BINARY_DIR} /lib/" )
115
-
116
- set (SYCL_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )
117
- set (SYCL_TESTS_BINARY_DIR ${SYCL_BINARY_DIR} /test )
118
-
119
- set (CLANG_IN_BUILD "${LLVM_BINARY_DIR} /bin/clang" )
120
-
121
- set (LLVM_TOOLS_DIR "${LLVM_BINARY_DIR} /bin/" )
122
-
123
- add_library ("${SYCLLibrary} " SHARED
124
- "${includeRootPath} /CL/sycl.hpp"
125
- "${sourceRootPath} /detail/builtins_common.cpp"
126
- "${sourceRootPath} /detail/builtins_geometric.cpp"
127
- "${sourceRootPath} /detail/builtins_integer.cpp"
128
- "${sourceRootPath} /detail/builtins_math.cpp"
129
- "${sourceRootPath} /detail/builtins_relational.cpp"
130
- "${sourceRootPath} /detail/pi.cpp"
131
- "${sourceRootPath} /detail/pi_opencl.cpp"
132
- "${sourceRootPath} /detail/common.cpp"
133
- "${sourceRootPath} /detail/context_impl.cpp"
134
- "${sourceRootPath} /detail/device_impl.cpp"
135
- "${sourceRootPath} /detail/device_info.cpp"
136
- "${sourceRootPath} /detail/event_impl.cpp"
137
- "${sourceRootPath} /detail/force_device.cpp"
138
- "${sourceRootPath} /detail/helpers.cpp"
139
- "${sourceRootPath} /detail/image_impl.cpp"
140
- "${sourceRootPath} /detail/kernel_impl.cpp"
141
- "${sourceRootPath} /detail/kernel_info.cpp"
142
- "${sourceRootPath} /detail/memory_manager.cpp"
143
- "${sourceRootPath} /detail/platform_impl.cpp"
144
- "${sourceRootPath} /detail/platform_info.cpp"
145
- "${sourceRootPath} /detail/program_impl.cpp"
146
- "${sourceRootPath} /detail/program_manager/program_manager.cpp"
147
- "${sourceRootPath} /detail/queue_impl.cpp"
148
- "${sourceRootPath} /detail/os_util.cpp"
149
- "${sourceRootPath} /detail/platform_util.cpp"
150
- "${sourceRootPath} /detail/sampler_impl.cpp"
151
- "${sourceRootPath} /detail/stream_impl.cpp"
152
- "${sourceRootPath} /detail/scheduler/commands.cpp"
153
- "${sourceRootPath} /detail/scheduler/scheduler.cpp"
154
- "${sourceRootPath} /detail/scheduler/graph_processor.cpp"
155
- "${sourceRootPath} /detail/scheduler/graph_builder.cpp"
156
- "${sourceRootPath} /detail/usm/clusm.cpp"
157
- "${sourceRootPath} /detail/usm/opencl_shim.cpp"
158
- "${sourceRootPath} /detail/usm/usm_impl.cpp"
159
- "${sourceRootPath} /detail/util.cpp"
160
- "${sourceRootPath} /context.cpp"
161
- "${sourceRootPath} /device.cpp"
162
- "${sourceRootPath} /device_selector.cpp"
163
- "${sourceRootPath} /event.cpp"
164
- "${sourceRootPath} /exception.cpp"
165
- "${sourceRootPath} /half_type.cpp"
166
- "${sourceRootPath} /kernel.cpp"
167
- "${sourceRootPath} /platform.cpp"
168
- "${sourceRootPath} /queue.cpp"
169
- "${sourceRootPath} /sampler.cpp"
170
- "${sourceRootPath} /stream.cpp"
171
- "${sourceRootPath} /spirv_ops.cpp"
172
- )
173
-
174
- add_dependencies ("${SYCLLibrary} "
175
- ocl-icd
176
- ocl-headers
177
- sycl-headers
178
- )
105
+ # SYCL runtime library
106
+ add_subdirectory (source )
179
107
108
+ # SYCL toolchain builds all components: compiler, libraries, headers, etc.
180
109
add_custom_target ( sycl-toolchain
181
- DEPENDS " ${SYCLLibrary} "
110
+ DEPENDS sycl
182
111
clang
183
112
clang-offload-wrapper
184
113
clang-offload-bundler
@@ -191,17 +120,5 @@ add_custom_target( sycl-toolchain
191
120
COMMENT "Building SYCL compiler toolchain..."
192
121
)
193
122
194
- set_target_properties ("${SYCLLibrary} " PROPERTIES LINKER_LANGUAGE CXX )
195
-
196
- # Workaround for bug in GCC version 5 and higher.
197
- # More information https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899
198
- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
199
- CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0 )
200
- target_link_libraries ("${SYCLLibrary} " gcc_s gcc )
201
- endif ()
202
-
203
- install (TARGETS "${SYCLLibrary} " DESTINATION "lib" COMPONENT ${SYCLLibrary} )
204
- install (DIRECTORY "${includeRootPath} /." DESTINATION "${LLVM_INST_INC_DIRECTORY} " COMPONENT sycl-headers )
205
-
206
123
add_subdirectory ( test )
207
124
add_subdirectory ( tools )
0 commit comments