[Mlir-commits] [mlir] a9ccdfb - NFC: Glob all python sources in the MLIR Python bindings.
Stella Laurenzo
llvmlistbot at llvm.org
Fri Mar 5 10:22:02 PST 2021
Author: Stella Laurenzo
Date: 2021-03-05T10:21:02-08:00
New Revision: a9ccdfbc7d73d0abd2506c77efcab1153a82eb35
URL: https://github.com/llvm/llvm-project/commit/a9ccdfbc7d73d0abd2506c77efcab1153a82eb35
DIFF: https://github.com/llvm/llvm-project/commit/a9ccdfbc7d73d0abd2506c77efcab1153a82eb35.diff
LOG: NFC: Glob all python sources in the MLIR Python bindings.
* Also switches to use symlinks vs copy as that enables edit-and-continue python development.
* Broken out of https://reviews.llvm.org/D97995 per request from reviewer.
Differential Revision: https://reviews.llvm.org/D98005
Added:
Modified:
mlir/lib/Bindings/Python/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/lib/Bindings/Python/CMakeLists.txt b/mlir/lib/Bindings/Python/CMakeLists.txt
index 199b30df8afe..c444ddcc4fc1 100644
--- a/mlir/lib/Bindings/Python/CMakeLists.txt
+++ b/mlir/lib/Bindings/Python/CMakeLists.txt
@@ -5,18 +5,9 @@ add_custom_target(MLIRBindingsPythonExtension)
# Copy python source tree.
################################################################################
-set(PY_SRC_FILES
- mlir/__init__.py
- mlir/_dlloader.py
- mlir/conversions/__init__.py
- mlir/dialects/__init__.py
- mlir/dialects/_linalg.py
- mlir/dialects/_builtin.py
- mlir/ir.py
- mlir/execution_engine.py
- mlir/passmanager.py
- mlir/transforms/__init__.py
-)
+file(GLOB_RECURSE PY_SRC_FILES
+ RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/mlir/*.py")
add_custom_target(MLIRBindingsPythonSources ALL
DEPENDS ${PY_SRC_FILES}
@@ -25,11 +16,13 @@ add_dependencies(MLIRBindingsPythonExtension MLIRBindingsPythonSources)
foreach(PY_SRC_FILE ${PY_SRC_FILES})
set(PY_DEST_FILE "${PROJECT_BINARY_DIR}/python/${PY_SRC_FILE}")
+ get_filename_component(PY_DEST_DIR "${PY_DEST_FILE}" DIRECTORY)
+ file(MAKE_DIRECTORY "${PY_DEST_DIR}")
add_custom_command(
TARGET MLIRBindingsPythonSources PRE_BUILD
COMMENT "Copying python source ${PY_SRC_FILE} -> ${PY_DEST_FILE}"
DEPENDS "${PY_SRC_FILE}"
- COMMAND "${CMAKE_COMMAND}" -E copy_if_
diff erent
+ COMMAND "${CMAKE_COMMAND}" -E create_symlink
"${CMAKE_CURRENT_SOURCE_DIR}/${PY_SRC_FILE}" "${PY_DEST_FILE}"
)
endforeach()
More information about the Mlir-commits
mailing list