@@ -38,6 +38,11 @@ option(DPCTL_BUILD_CAPI_TESTS
38
38
"Build dpctl C API google tests"
39
39
OFF
40
40
)
41
+ # Option to turn on logging support for dpctl C API
42
+ option (DPCTL_ENABLE_GLOG
43
+ "Enable the Google logging module"
44
+ OFF
45
+ )
41
46
42
47
# Minimum version requirement only when oneAPI dpcpp is used.
43
48
if (DPCTL_DPCPP_FROM_ONEAPI )
@@ -156,17 +161,49 @@ add_library(DPCTLSyclInterface
156
161
${helper_sources}
157
162
)
158
163
159
- target_include_directories (DPCTLSyclInterface
160
- PRIVATE
161
- ${CMAKE_CURRENT_SOURCE_DIR} /include/
162
- ${CMAKE_CURRENT_SOURCE_DIR} /helper/include/
163
- ${IntelSycl_SYCL_INCLUDE_DIR}
164
- )
164
+ if (DPCTL_ENABLE_GLOG )
165
+ find_path (GLOG_INCLUDE_DIR NAMES glog/logging.h )
166
+ find_library (GLOG_LIBRARY NAMES glog )
167
+ if (GLOG_INCLUDE_DIR AND GLOG_LIBRARY )
168
+ message (STATUS "Found GLog:" )
169
+ message (STATUS " Headers: ${GLOG_INCLUDE_DIR} " )
170
+ message (STATUS " Library: ${GLOG_LIBRARY} " )
171
+ else ()
172
+ message (FATAL_ERROR "GLog not found" )
173
+ endif ()
174
+
175
+ find_package (glog REQUIRED )
176
+
177
+ target_include_directories (DPCTLSyclInterface
178
+ PRIVATE
179
+ ${CMAKE_CURRENT_SOURCE_DIR} /include/
180
+ ${CMAKE_CURRENT_SOURCE_DIR} /helper/include/
181
+ ${IntelSycl_SYCL_INCLUDE_DIR}
182
+ ${GLOG_INCLUDE_DIR}
183
+ )
184
+
185
+ target_compile_definitions (DPCTLSyclInterface PUBLIC ENABLE_GLOG )
186
+
187
+ target_link_libraries (DPCTLSyclInterface
188
+ PRIVATE ${IntelSycl_SYCL_LIBRARY}
189
+ PRIVATE ${IntelSycl_OPENCL_LIBRARY}
190
+ ${GLOG_LIBRARY}
191
+ )
192
+
193
+ else ()
194
+ target_include_directories (DPCTLSyclInterface
195
+ PRIVATE
196
+ ${CMAKE_CURRENT_SOURCE_DIR} /include/
197
+ ${CMAKE_CURRENT_SOURCE_DIR} /helper/include/
198
+ ${IntelSycl_SYCL_INCLUDE_DIR}
199
+ )
200
+ target_link_libraries (DPCTLSyclInterface
201
+ PRIVATE ${IntelSycl_SYCL_LIBRARY}
202
+ PRIVATE ${IntelSycl_OPENCL_LIBRARY}
203
+ )
204
+
205
+ endif ()
165
206
166
- target_link_libraries (DPCTLSyclInterface
167
- PRIVATE ${IntelSycl_SYCL_LIBRARY}
168
- PRIVATE ${IntelSycl_OPENCL_LIBRARY}
169
- )
170
207
171
208
include (GetProjectVersion )
172
209
# the get_version function is defined in the GetProjectVersion module and
0 commit comments