mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
[MLIR][Python] fix standalone example/test (#156197)
Fix some things in `standalone` in order to unblock https://github.com/llvm/llvm-project/pull/155741.
This commit is contained in:
@@ -52,6 +52,10 @@ add_subdirectory(include)
|
||||
add_subdirectory(lib)
|
||||
if(MLIR_ENABLE_BINDINGS_PYTHON)
|
||||
message(STATUS "Enabling Python API")
|
||||
include(MLIRDetectPythonEnv)
|
||||
mlir_configure_python_dev_packages()
|
||||
set(MLIR_PYTHON_PACKAGE_PREFIX "mlir_standalone" CACHE STRING "" FORCE)
|
||||
set(MLIR_BINDINGS_PYTHON_INSTALL_PREFIX "python_packages/standalone/mlir_standalone" CACHE STRING "" FORCE)
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
add_subdirectory(test)
|
||||
|
||||
@@ -2,8 +2,7 @@ include(AddMLIRPython)
|
||||
|
||||
# Specifies that all MLIR packages are co-located under the `mlir_standalone`
|
||||
# top level package (the API has been embedded in a relocatable way).
|
||||
# TODO: Add an upstream cmake param for this vs having a global here.
|
||||
add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=mlir_standalone.")
|
||||
add_compile_definitions("MLIR_PYTHON_PACKAGE_PREFIX=${MLIR_PYTHON_PACKAGE_PREFIX}.")
|
||||
|
||||
|
||||
################################################################################
|
||||
@@ -49,8 +48,8 @@ declare_mlir_python_extension(StandalonePythonSources.NanobindExtension
|
||||
|
||||
add_mlir_python_common_capi_library(StandalonePythonCAPI
|
||||
INSTALL_COMPONENT StandalonePythonModules
|
||||
INSTALL_DESTINATION python_packages/standalone/mlir_standalone/_mlir_libs
|
||||
OUTPUT_DIRECTORY "${MLIR_BINARY_DIR}/python_packages/standalone/mlir_standalone/_mlir_libs"
|
||||
INSTALL_DESTINATION "${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}/_mlir_libs"
|
||||
OUTPUT_DIRECTORY "${MLIR_BINARY_DIR}/${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}/_mlir_libs"
|
||||
RELATIVE_INSTALL_ROOT "../../../.."
|
||||
DECLARED_SOURCES
|
||||
StandalonePythonSources
|
||||
@@ -58,6 +57,7 @@ add_mlir_python_common_capi_library(StandalonePythonCAPI
|
||||
# available.
|
||||
MLIRPythonExtension.RegisterEverything
|
||||
MLIRPythonSources.Core
|
||||
MLIRPythonSources.Dialects.builtin
|
||||
)
|
||||
|
||||
################################################################################
|
||||
@@ -65,14 +65,15 @@ add_mlir_python_common_capi_library(StandalonePythonCAPI
|
||||
################################################################################
|
||||
|
||||
add_mlir_python_modules(StandalonePythonModules
|
||||
ROOT_PREFIX "${MLIR_BINARY_DIR}/python_packages/standalone/mlir_standalone"
|
||||
INSTALL_PREFIX "python_packages/standalone/mlir_standalone"
|
||||
ROOT_PREFIX "${MLIR_BINARY_DIR}/${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}"
|
||||
INSTALL_PREFIX "${MLIR_BINDINGS_PYTHON_INSTALL_PREFIX}"
|
||||
DECLARED_SOURCES
|
||||
StandalonePythonSources
|
||||
# TODO: Remove this in favor of showing fine grained registration once
|
||||
# available.
|
||||
MLIRPythonExtension.RegisterEverything
|
||||
MLIRPythonSources
|
||||
MLIRPythonSources.Core
|
||||
MLIRPythonSources.Dialects.builtin
|
||||
COMMON_CAPI_LINK_LIBS
|
||||
StandalonePythonCAPI
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user