diff --git a/mlir/lib/Bindings/Python/CMakeLists.txt b/mlir/lib/Bindings/Python/CMakeLists.txt --- a/mlir/lib/Bindings/Python/CMakeLists.txt +++ b/mlir/lib/Bindings/Python/CMakeLists.txt @@ -71,4 +71,23 @@ COMPONENT MLIRBindingsPythonSources) endif() +# Dialect sources are generated. Install separately. +# Note that __pycache__ directories may have been left by tests and other +# executions. And __init__.py is handled as a regular source file. +install( + DIRECTORY ${PROJECT_BINARY_DIR}/python/mlir/dialects + DESTINATION python/mlir + COMPONENT MLIRBindingsPythonDialects + FILES_MATCHING PATTERN "*.py" + PATTERN "__pycache__" EXCLUDE + PATTERN "__init__.py" EXCLUDE +) + +if (NOT LLVM_ENABLE_IDE) + add_llvm_install_targets( + install-MLIRBindingsPythonDialects + DEPENDS MLIRBindingsPythonSources + COMPONENT MLIRBindingsPythonDialects) +endif() + add_subdirectory(Transforms)