[mlir][python] Add install target for MLIR Python sources.
authorJack Wolfard <jack@rivosinc.com>
Sat, 15 Jul 2023 09:44:42 +0000 (02:44 -0700)
committerStella Laurenzo <stellaraccident@gmail.com>
Tue, 18 Jul 2023 18:05:39 +0000 (11:05 -0700)
Differential Revision: https://reviews.llvm.org/D155362

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

index 382f7c0..5349bb8 100644 (file)
@@ -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()
index 29152b5..22a55db 100644 (file)
@@ -518,6 +518,19 @@ add_mlir_python_common_capi_library(MLIRPythonCAPI
 )
 
 ################################################################################
+# 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.
 ################################################################################