Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake failure when multiple OpenCL headers found #336

Open
pvelesko opened this issue Jul 31, 2024 · 0 comments
Open

CMake failure when multiple OpenCL headers found #336

pvelesko opened this issue Jul 31, 2024 · 0 comments

Comments

@pvelesko
Copy link

Multiple opencl-c.h exist in LLVM that was built specifically for compiling intel compute runtime:

╭─pvelesko@cupcake /space/pvelesko/intel-compute-runtime-build ‹main●› 
╰─$ find  ~/space/install/llvm/14.0-neo -name "opencl-c.h"                                                                                                                                                                                                                                                        130 ↵
/home/pvelesko/space/install/llvm/14.0-neo/include/cclang/opencl-c.h
/home/pvelesko/space/install/llvm/14.0-neo/lib/clang/14.0.6/include/opencl-c.h

Cmake fails in this case because opencl-header is a list.
The following patch fixes the issue by picking the first header found

diff --git a/IGC/BiFModule/CMakeLists.txt b/IGC/BiFModule/CMakeLists.txt
index 445818747..1fb6b50fe 100644
--- a/IGC/BiFModule/CMakeLists.txt
+++ b/IGC/BiFModule/CMakeLists.txt
@@ -45,6 +45,10 @@ if(UNIX)
     install(FILES $<TARGET_SONAME_FILE:opencl-clang-lib> DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} COMPONENT igc-opencl)
 
     # Get header opencl-c.h directory
+    list(LENGTH opencl-header len)
+    if(len GREATER 1)
+	      list(GET opencl-header 0 opencl-header)
+      endif()
     get_filename_component(opencl-headers-dir ${opencl-header} DIRECTORY)
 
     set(opencl-headers "${opencl-header}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant