diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake --- a/mlir/cmake/modules/AddMLIRPython.cmake +++ b/mlir/cmake/modules/AddMLIRPython.cmake @@ -174,12 +174,13 @@ install( FILES "${source_root_dir}/${source_relative_path}" DESTINATION "${destination}/${dest_relative_dir}" - COMPONENT "${name}" + COMPONENT mlir-python-sources ) endforeach() - get_target_export_arg(${name} MLIR export_to_mlirtargets UMBRELLA mlir-libraries) + get_target_export_arg(${name} MLIR export_to_mlirtargets + UMBRELLA mlir-python-sources) install(TARGETS ${name} - COMPONENT ${name} + COMPONENT mlir-python-sources ${export_to_mlirtargets} ) endfunction() diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt --- a/mlir/python/CMakeLists.txt +++ b/mlir/python/CMakeLists.txt @@ -517,6 +517,19 @@ ${_ADDL_TEST_SOURCES} ) +################################################################################ +# Custom targets. +################################################################################ + +_flatten_mlir_python_targets(mlir_python_sources_deps MLIRPythonSources) +add_custom_target("mlir-python-sources" DEPENDS ${mlir_python_sources_deps}) +if(NOT LLVM_ENABLE_IDE) + add_llvm_install_targets(install-mlir-python-sources + DEPENDS mlir-python-sources + COMPONENT mlir-python-sources + ) +endif() + ################################################################################ # The fully assembled package of modules. # This must come last.