From f64bb181edf0cc5e7d2d5bae634445d2ef465b1a Mon Sep 17 00:00:00 2001 From: "Jae Hoon (Antonio) Kim" <17433012+antoniojkim@users.noreply.github.com> Date: Wed, 27 Jul 2022 09:34:01 -0400 Subject: [PATCH] Export LTC Headers (#1108) --- .../csrc/base_lazy_backend/CMakeLists.txt | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt b/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt index 996aa60ecb1a..4b0df62337a0 100644 --- a/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt +++ b/python/torch_mlir/csrc/base_lazy_backend/CMakeLists.txt @@ -82,11 +82,30 @@ target_link_libraries(torch_mlir_ltc_backend message(STATUS "TORCH_CXXFLAGS=${TORCH_CXXFLAGS} -Wno-pedantic") set_target_properties(torch_mlir_ltc_backend PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/" - OUTPUT_NAME lib_mlir_ltc + LIBRARY_OUTPUT_DIRECTORY "${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend" + OUTPUT_NAME lib_torch_mlir_ltc PREFIX "" SUFFIX ".so" CXX_VISIBILITY_PRESET "hidden" COMPILE_FLAGS "${TORCH_CXXFLAGS} -Wno-pedantic" LINK_FLAGS "-rdynamic" ) + +# Copy header files into python package + +add_custom_command( + TARGET torch_mlir_ltc_backend POST_BUILD + COMMAND mkdir -p + ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/generated/) + +add_custom_command( + TARGET torch_mlir_ltc_backend POST_BUILD + COMMAND cp + ${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/*.h + ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/) + +add_custom_command( + TARGET torch_mlir_ltc_backend POST_BUILD + COMMAND cp + ${PROJECT_SOURCE_DIR}/python/torch_mlir/csrc/base_lazy_backend/generated/*.h + ${TORCH_MLIR_PYTHON_PACKAGES_DIR}/torch_mlir/torch_mlir/base_lazy_backend/generated/)