Enable python extensions when building out of tree (#363)

pull/389/head snapshot-20211028.49
stephenneuendorffer 2021-10-27 17:04:12 -07:00 committed by GitHub
parent 30df2ec71b
commit 614b889dc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View File

@ -53,12 +53,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include(AddMLIR)
include(HandleLLVMOptions)
include(AddMLIRPython)
declare_mlir_python_sources(MLIRPythonSources)
# Don't try to compile the python extensions at the moment. We need
# to import lots of dependencies from AddMLIRPython to make this work.
set(MLIR_ENABLE_BINDINGS_PYTHON 0)
set(MLIR_ENABLE_BINDINGS_PYTHON 1)
option(TORCH_MLIR_ENABLE_JIT_IR_IMPORTER "Enables JIT IR Importer" ON)
set(TORCH-MLIR_BUILT_STANDALONE 1)
set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")

View File

@ -6,6 +6,7 @@ add_mlir_public_c_api_library(TorchMLIRCAPI
ADDITIONAL_HEADER_DIRS
${PROJECT_SOURCE_DIR}/include/torch-mlir-c/
ENABLE_AGGREGATION
LINK_COMPONENTS
Core

View File

@ -41,7 +41,7 @@ declare_mlir_python_extension(TorchMLIRPythonExtensions.Main
MODULE_NAME _torchMlir
ADD_TO_PARENT TorchMLIRPythonExtensions
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/TorchMLIRModule.cpp
TorchMLIRModule.cpp
EMBED_CAPI_LINK_LIBS
TorchMLIRCAPI
PRIVATE_LINK_LIBS