Skip to content

Commit

Permalink
Fix MLIR Python bindings build in byo_llvm (#14411)
Browse files Browse the repository at this point in the history
Depends on https://reviews.llvm.org/D155362. This commit points to my
LLVM fork for demonstration. Will need to pull in this commit once
merged into LLVM.
  • Loading branch information
JackWolfard authored Aug 1, 2023
1 parent 24e9133 commit 93863d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 1 addition & 5 deletions build_tools/llvm/byo_llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,8 @@ do_build_mlir() {
echo "CMake Options: ${cmake_options}"
cmake -GNinja -S "${LLVM_SOURCE_DIR}/mlir" -B "${mlir_build_dir}" \
$cmake_options
# TODO: We should be able to just do install-mlirdevelopment-distribution to
# tightly control distribution, but this presently leaves out the Python
# sources needed to build downstream Python bindings. Once this is fixed,
# we should use the more fine grained install target.
cmake --build "${mlir_build_dir}" \
--target install
--target install-mlirdevelopment-distribution
}

print_iree_config() {
Expand Down
10 changes: 6 additions & 4 deletions build_tools/llvm/mlir_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
# -DCMAKE_C_COMPILER=clang \
# -DCMAKE_CXX_COMPILER=clang++ \
# -DCMAKE_LINKER=lld
# TODO: For some reason Python sources aren't selectable as part of a
# distribution and targets don't show up properly.
# ninja -C $MLIR_BUILD_DIR install-mlirdevelopment-distribution
# The full install target seems to get everything...
# ninja -C $MLIR_BUILD_DIR install

if(NOT EXISTS ${LLVM_DIR})
message(FATAL_ERROR "LLVM_DIR (${LLVM_DIR}) does not exist")
Expand Down Expand Up @@ -49,10 +45,16 @@ set(LLVM_MLIR_TOOLS
mlir-translate
CACHE STRING "")

set(LLVM_MLIR_Python_COMPONENTS
MLIRPythonModules
mlir-python-sources
CACHE STRING "")

set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS
mlir-cmake-exports
mlir-headers
mlir-libraries
MLIRPythonModules
${LLVM_MLIR_TOOLS}
${LLVM_MLIR_Python_COMPONENTS}
CACHE STRING "")

0 comments on commit 93863d3

Please sign in to comment.