Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e900e5

Browse files
committed
Enabling clang project when targeting LLVM-CPU and CUDA.
This can be used to build microkernels from source across all platforms.
1 parent e1daf1f commit 3e900e5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎build_tools/cmake/iree_llvm.cmake‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ macro(iree_llvm_configure_installed)
7878
list(APPEND CMAKE_MODULE_PATH "${LLD_CMAKE_DIR}")
7979
include_directories(${LLD_INCLUDE_DIRS})
8080

81+
find_package(Clang REQUIRED)
82+
list(APPEND CMAKE_MODULE_PATH "${CLANG_CMAKE_DIR}")
83+
8184
# Lit never gets installed with LLVM. So we have to reach into our copy
8285
# of the monorepo to get it. I'm sorry. If this doesn't work for you,
8386
# feel free to -DLLVM_EXTERNAL_LIT to provide your own.
@@ -118,7 +121,9 @@ macro(iree_llvm_set_bundled_cmake_options)
118121
set(MLIR_ENABLE_BINDINGS_PYTHON OFF CACHE BOOL "")
119122
set(MHLO_ENABLE_BINDINGS_PYTHON OFF CACHE BOOL "")
120123

121-
# If we are building LLD, this will be the target. Otherwise, empty.
124+
# If we are building clang/lld/etc, these will be the targets.
125+
# Otherwise, empty so scripts can detect unavailability.
126+
set(IREE_CLANG_TARGET)
122127
set(IREE_LLD_TARGET)
123128

124129
# Unconditionally enable mlir.
@@ -129,15 +134,18 @@ macro(iree_llvm_set_bundled_cmake_options)
129134
if(IREE_TARGET_BACKEND_CUDA)
130135
message(STATUS " - cuda")
131136
list(APPEND LLVM_TARGETS_TO_BUILD NVPTX)
137+
set(IREE_CLANG_TARGET clang)
132138
endif()
133139
if(IREE_TARGET_BACKEND_LLVM_CPU)
134140
message(STATUS " - llvm-cpu")
135141
list(APPEND LLVM_TARGETS_TO_BUILD "${IREE_DEFAULT_CPU_LLVM_TARGETS}")
142+
set(IREE_CLANG_TARGET clang)
136143
set(IREE_LLD_TARGET lld)
137144
endif()
138145
if(IREE_TARGET_BACKEND_LLVM_CPU_WASM)
139146
message(STATUS " - llvm-cpu (wasm)")
140147
list(APPEND LLVM_TARGETS_TO_BUILD WebAssembly)
148+
set(IREE_CLANG_TARGET clang)
141149
set(IREE_LLD_TARGET lld)
142150
endif()
143151
if(IREE_TARGET_BACKEND_METAL_SPIRV)
@@ -157,6 +165,9 @@ macro(iree_llvm_set_bundled_cmake_options)
157165
message(STATUS " - webgpu")
158166
endif()
159167

168+
if(IREE_CLANG_TARGET)
169+
list(APPEND LLVM_ENABLE_PROJECTS clang)
170+
endif()
160171
if(IREE_LLD_TARGET)
161172
list(APPEND LLVM_ENABLE_PROJECTS lld)
162173
endif()

0 commit comments

Comments
 (0)