blob: 7ad261e0aa6c18159714d9e1c949a482916c493f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
From 12c99343388eba6e6275856b25e0fa8978585dfb Mon Sep 17 00:00:00 2001
From: Marcin Naczk <marcin.naczk@intel.com>
Date: Mon, 13 Jun 2022 08:28:24 +0000
Subject: [PATCH] Find OpenCl-c.h when clang is take from system.
Find OpenCl-c.h when clang is take from system.
---
IGC/cmake/igc_find_opencl_clang.cmake | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/IGC/cmake/igc_find_opencl_clang.cmake b/IGC/cmake/igc_find_opencl_clang.cmake
index dc8924fb7ee..0a54ac68249 100644
--- a/IGC/cmake/igc_find_opencl_clang.cmake
+++ b/IGC/cmake/igc_find_opencl_clang.cmake
@@ -94,19 +94,25 @@ if(CCLANG_FROM_SYSTEM)
else()
set_property(TARGET opencl-clang-lib PROPERTY "IMPORTED_LOCATION" "${SYSTEM_COMMON_CLANG}")
endif()
- find_program(CLANG_GE7 clang-${LLVM_VERSION_MAJOR})
- if(CLANG_GE7)
- message(STATUS "[IGC] Found clang-${LLVM_VERSION_MAJOR} executable: ${CLANG_GE7}")
+ find_program(CLANG_EXE clang-${LLVM_VERSION_MAJOR})
+ if(CLANG_EXE)
+ message(STATUS "[IGC] Found clang-${LLVM_VERSION_MAJOR} executable: ${CLANG_EXE}")
add_executable(clang-tool IMPORTED GLOBAL)
- set_property(TARGET clang-tool PROPERTY "IMPORTED_LOCATION" "${CLANG_GE7}")
+ set_property(TARGET clang-tool PROPERTY "IMPORTED_LOCATION" "${CLANG_EXE}")
set(CL_OPTIONS "-finclude-default-header")
- if(LLVM_VERSION_MAJOR VERSION_EQUAL 7)
- message(WARNING "[IGC] : clang-7 should be patched with VME patch (https://reviews.llvm.org/D51484). Assuming that it is. If not, please add -DVME_TYPES_DEFINED=FALSE.")
- endif()
- else(CLANG_GE7)
+
+ # Get parent dir of the location of CLANG_EXE
+ get_filename_component(CLANG_EXE_PARENT_DIR ${CLANG_EXE} DIRECTORY)
+ file(GLOB_RECURSE opencl-header ${CLANG_EXE_PARENT_DIR}/../*opencl-c.h)
+ if(opencl-header)
+ message(STATUS "[IGC] Found opencl-c.h: ${opencl-header}")
+ else(opencl-header)
+ message(FATAL_ERROR "[IGC] : Couldn't find opencl-c.h, please provide it.")
+ endif(opencl-header)
+ else(CLANG_EXE)
message(FATAL_ERROR "[IGC] : Couldn't find clang-${LLVM_VERSION_MAJOR} executable, please install it.")
- endif(CLANG_GE7)
+ endif(CLANG_EXE)
###
#2. CCLANG_BUILD_PREBUILDS - use prebuilt opencl-clang toolchain
elseif(${CCLANG_BUILD_PREBUILDS})
|