Skip to content

CMake failure when multiple OpenCL headers found #336

Open
@pvelesko

Description

@pvelesko

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}")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      CMake failure when multiple OpenCL headers found · Issue #336 · intel/intel-graphics-compiler