Skip to content

Commit 9494bd8

Browse files
JackWolfardstellaraccident
authored andcommitted
[mlir][python] Add install target for MLIR Python sources.
Differential Revision: https://reviews.llvm.org/D155362
1 parent 347f45e commit 9494bd8

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

mlir/cmake/modules/AddMLIRPython.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,13 @@ function(_mlir_python_install_sources name source_root_dir destination)
174174
install(
175175
FILES "${source_root_dir}/${source_relative_path}"
176176
DESTINATION "${destination}/${dest_relative_dir}"
177-
COMPONENT "${name}"
177+
COMPONENT mlir-python-sources
178178
)
179179
endforeach()
180-
get_target_export_arg(${name} MLIR export_to_mlirtargets UMBRELLA mlir-libraries)
180+
get_target_export_arg(${name} MLIR export_to_mlirtargets
181+
UMBRELLA mlir-python-sources)
181182
install(TARGETS ${name}
182-
COMPONENT ${name}
183+
COMPONENT mlir-python-sources
183184
${export_to_mlirtargets}
184185
)
185186
endfunction()

mlir/python/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,19 @@ add_mlir_python_common_capi_library(MLIRPythonCAPI
517517
${_ADDL_TEST_SOURCES}
518518
)
519519

520+
################################################################################
521+
# Custom targets.
522+
################################################################################
523+
524+
_flatten_mlir_python_targets(mlir_python_sources_deps MLIRPythonSources)
525+
add_custom_target("mlir-python-sources" DEPENDS ${mlir_python_sources_deps})
526+
if(NOT LLVM_ENABLE_IDE)
527+
add_llvm_install_targets(install-mlir-python-sources
528+
DEPENDS mlir-python-sources
529+
COMPONENT mlir-python-sources
530+
)
531+
endif()
532+
520533
################################################################################
521534
# The fully assembled package of modules.
522535
# This must come last.

0 commit comments

Comments
 (0)