From 20542e3aebe9a013bab15316714a7e6d52b157d1 Mon Sep 17 00:00:00 2001 From: Mark Glines Date: Tue, 16 Jun 2020 10:32:23 -0400 Subject: [PATCH] Teach cmake how to install python bindings --- .gitignore | 2 -- python_bindings/CMakeLists.txt | 10 +++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 35e2841e5..16389f34e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ build/ bin/ lib/ -python_bindings/libs/ -python_bindings/pytaco/core/ *__pycache__* *.swp *.swo diff --git a/python_bindings/CMakeLists.txt b/python_bindings/CMakeLists.txt index 2a787ada5..4bb0aa838 100644 --- a/python_bindings/CMakeLists.txt +++ b/python_bindings/CMakeLists.txt @@ -12,9 +12,17 @@ foreach(dir ${PY_SRC_DIRS}) file(GLOB PY_SOURCES ${PY_SOURCES} ${dir}/*.cpp) endforeach() +file(GLOB PYTACO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pytaco/*.py) +file(GLOB PYTENSOR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pytaco/pytensor/*.py) + set(PY_SOURCES ${PY_SOURCES}) pybind11_add_module(core_modules ${PY_SOURCES} ${TACO_SOURCES}) -set_target_properties(core_modules PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${TACO_PROJECT_DIR}/python_bindings/pytaco/core) +set_target_properties(core_modules PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pytaco/core) target_link_libraries(core_modules LINK_PRIVATE taco) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/pytaco DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +set(PY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/pytaco) +install(FILES ${PYTACO_FILES} DESTINATION ${PY_INSTALL_PATH}) +install(FILES ${PYTENSOR_FILES} DESTINATION ${PY_INSTALL_PATH}/pytensor) +install(TARGETS core_modules DESTINATION ${PY_INSTALL_PATH}/core)