Skip to content

[SYCL] The build system doesn't use the OpenCL_LIBRARY passed in everywhere #6

Closed
@kpet

Description

@kpet

There are a number of places where the build system uses a hard-coded reference to OpenCL instead of using the passed in OpenCL_LIBRARY. This prevents the build from succeeding in environments where the OpenCL implementation doesn't reside in a library called OpenCL. The following patch seems to have done the trick for me:

--- a/sycl/CMakeLists.txt
+++ b/sycl/CMakeLists.txt
@@ -32,7 +32,7 @@ set ( LLVM_INST_INC_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/i
 find_package(OpenCL REQUIRED)

 include_directories(${OpenCL_INCLUDE_DIRS})
-link_libraries(OpenCL)
+link_libraries(${OpenCL_LIBRARY})

 # Copy SYCL headers
 set(sycl_inc_dir ${CMAKE_CURRENT_SOURCE_DIR}/include/CL)
@@ -96,7 +96,7 @@ add_library("${SYCLLibrary}" SHARED

 include_directories("${SYCLLibrary}" "${includeRootPath}")

-target_link_libraries("${SYCLLibrary}" "${OpenCL_LIBRARIES}")
+target_link_libraries("${SYCLLibrary}" "${OpenCL_LIBRARY}")
 set_target_properties("${SYCLLibrary}" PROPERTIES LINKER_LANGUAGE CXX)

 # Workaround for bug in GCC version 5.
@@ -7,7 +7,7 @@ find_package(OpenCL REQUIRED)
 # All projects need this include directory
 include_directories(${OpenCL_INCLUDE_DIRS})

-link_libraries(OpenCL)
+link_libraries(${OpenCL_LIBRARY})

 add_executable(get_device_count_by_type get_device_count_by_type.cpp)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions