[Mlir-commits] [mlir] 9494bd8 - [mlir][python] Add install target for MLIR Python sources.

Stella Laurenzo llvmlistbot at llvm.org
Tue Jul 18 11:05:54 PDT 2023


Author: Jack Wolfard
Date: 2023-07-18T11:05:39-07:00
New Revision: 9494bd84df3c5b496fc087285af9ff40d7859b6a

URL: https://github.com/llvm/llvm-project/commit/9494bd84df3c5b496fc087285af9ff40d7859b6a
DIFF: https://github.com/llvm/llvm-project/commit/9494bd84df3c5b496fc087285af9ff40d7859b6a.diff

LOG: [mlir][python] Add install target for MLIR Python sources.

Differential Revision: https://reviews.llvm.org/D155362

Added: 
    

Modified: 
    mlir/cmake/modules/AddMLIRPython.cmake
    mlir/python/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index 382f7c0624e796..5349bb8302ab94 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -174,12 +174,13 @@ function(_mlir_python_install_sources name source_root_dir destination)
     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
index 29152b5c5c7d65..22a55dbb66aa9b 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -517,6 +517,19 @@ add_mlir_python_common_capi_library(MLIRPythonCAPI
     ${_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.


        


More information about the Mlir-commits mailing list