From fdfdfd9f437e3d1252f7e372267aec22795c79d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Fri, 9 Sep 2022 13:47:27 +0200 Subject: [PATCH] Option to install slsdet python extension in the install tree (#553) * added option to install python ext --- CMakeLists.txt | 1 + python/CMakeLists.txt | 61 +++++++++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5e691fa5..a1b572227 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ option(SLS_USE_TESTS "TESTS" OFF) option(SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF) option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF) option(SLS_USE_PYTHON "Python bindings" OFF) +option(SLS_INSTALL_PYTHONEXT "Install the python extension in the install tree under CMAKE_INSTALL_PREFIX/python/" OFF) option(SLS_USE_CTBGUI "ctb GUI" OFF) option(SLS_BUILD_DOCS "docs" OFF) option(SLS_BUILD_EXAMPLES "examples" OFF) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 873f938f8..51bb92de7 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -18,41 +18,40 @@ target_link_libraries(_slsdet PUBLIC ) - set_target_properties(_slsdet PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) #Copy Python code set( PYTHON_FILES - __init__.py - adcs.py - dacs.py - decorators.py - detector_property.py - detector.py - defines.py - eiger.py - enums.py - errors.py - gotthard.py - pattern.py - gotthard2.py - moench.py - proxy.py - ctb.py - jungfrau.py - mythen3.py - registers.py - temperature.py - lookup.py - utils.py + slsdet/__init__.py + slsdet/adcs.py + slsdet/dacs.py + slsdet/decorators.py + slsdet/detector_property.py + slsdet/detector.py + slsdet/defines.py + slsdet/eiger.py + slsdet/enums.py + slsdet/errors.py + slsdet/gotthard.py + slsdet/pattern.py + slsdet/gotthard2.py + slsdet/moench.py + slsdet/proxy.py + slsdet/ctb.py + slsdet/jungfrau.py + slsdet/mythen3.py + slsdet/registers.py + slsdet/temperature.py + slsdet/lookup.py + slsdet/utils.py ) foreach(FILE ${PYTHON_FILES}) - configure_file( slsdet/${FILE} - ${CMAKE_BINARY_DIR}/bin/slsdet/${FILE} ) + configure_file( ${FILE} + ${CMAKE_BINARY_DIR}/bin/${FILE} ) endforeach(FILE ${PYTHON_FILES}) @@ -62,4 +61,14 @@ configure_file( scripts/basic.py ) configure_file( scripts/test_virtual.py ${CMAKE_BINARY_DIR}/test_virtual.py -) \ No newline at end of file +) + + +if(SLS_INSTALL_PYTHONEXT) + install(TARGETS _slsdet + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/python + ) + + install(FILES ${PYTHON_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/python/slsdet) +endif() \ No newline at end of file