Skip to content

Commit 593af45

Browse files
Provide DPCTL_ENABLE_GLOG cmake option to turn on logging
1 parent 9bc62ab commit 593af45

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

libsyclinterface/CMakeLists.txt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ option(DPCTL_BUILD_CAPI_TESTS
3838
"Build dpctl C API google tests"
3939
OFF
4040
)
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+
)
4146

4247
# Minimum version requirement only when oneAPI dpcpp is used.
4348
if(DPCTL_DPCPP_FROM_ONEAPI)
@@ -166,12 +171,25 @@ target_include_directories(DPCTLSyclInterface
166171
${CMAKE_CURRENT_SOURCE_DIR}/helper/include/
167172
${IntelSycl_SYCL_INCLUDE_DIR}
168173
)
169-
170174
target_link_libraries(DPCTLSyclInterface
171-
PRIVATE ${IntelSycl_SYCL_LIBRARY}
172-
PRIVATE ${IntelSycl_OPENCL_LIBRARY}
175+
PRIVATE ${IntelSycl_SYCL_LIBRARY}
176+
PRIVATE ${IntelSycl_OPENCL_LIBRARY}
173177
)
174178

179+
if(DPCTL_ENABLE_GLOG)
180+
find_package(glog REQUIRED)
181+
182+
target_include_directories(DPCTLSyclInterface
183+
PRIVATE
184+
glog::glog
185+
)
186+
target_compile_definitions(DPCTLSyclInterface PRIVATE ENABLE_GLOG)
187+
target_link_libraries(DPCTLSyclInterface
188+
PRIVATE glog::glog
189+
)
190+
endif()
191+
192+
175193
include(GetProjectVersion)
176194
# the get_version function is defined in the GetProjectVersion module and
177195
# defines: VERSION, SEMVER, MAJOR, MINOR, PATCH. These variables are populated

0 commit comments

Comments
 (0)