Option to install slsdet python extension in the install tree (#553)

* added option to install python ext
This commit is contained in:
Erik Fröjdh 2022-09-09 13:47:27 +02:00 committed by GitHub
parent c0c8c8e21a
commit fdfdfd9f43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 26 deletions

View File

@ -48,6 +48,7 @@ option(SLS_USE_TESTS "TESTS" OFF)
option(SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF) option(SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF) option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
option(SLS_USE_PYTHON "Python bindings" 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_USE_CTBGUI "ctb GUI" OFF)
option(SLS_BUILD_DOCS "docs" OFF) option(SLS_BUILD_DOCS "docs" OFF)
option(SLS_BUILD_EXAMPLES "examples" OFF) option(SLS_BUILD_EXAMPLES "examples" OFF)

View File

@ -18,41 +18,40 @@ target_link_libraries(_slsdet PUBLIC
) )
set_target_properties(_slsdet PROPERTIES set_target_properties(_slsdet PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
) )
#Copy Python code #Copy Python code
set( PYTHON_FILES set( PYTHON_FILES
__init__.py slsdet/__init__.py
adcs.py slsdet/adcs.py
dacs.py slsdet/dacs.py
decorators.py slsdet/decorators.py
detector_property.py slsdet/detector_property.py
detector.py slsdet/detector.py
defines.py slsdet/defines.py
eiger.py slsdet/eiger.py
enums.py slsdet/enums.py
errors.py slsdet/errors.py
gotthard.py slsdet/gotthard.py
pattern.py slsdet/pattern.py
gotthard2.py slsdet/gotthard2.py
moench.py slsdet/moench.py
proxy.py slsdet/proxy.py
ctb.py slsdet/ctb.py
jungfrau.py slsdet/jungfrau.py
mythen3.py slsdet/mythen3.py
registers.py slsdet/registers.py
temperature.py slsdet/temperature.py
lookup.py slsdet/lookup.py
utils.py slsdet/utils.py
) )
foreach(FILE ${PYTHON_FILES}) foreach(FILE ${PYTHON_FILES})
configure_file( slsdet/${FILE} configure_file( ${FILE}
${CMAKE_BINARY_DIR}/bin/slsdet/${FILE} ) ${CMAKE_BINARY_DIR}/bin/${FILE} )
endforeach(FILE ${PYTHON_FILES}) endforeach(FILE ${PYTHON_FILES})
@ -63,3 +62,13 @@ configure_file( scripts/basic.py
configure_file( scripts/test_virtual.py configure_file( scripts/test_virtual.py
${CMAKE_BINARY_DIR}/test_virtual.py ${CMAKE_BINARY_DIR}/test_virtual.py
) )
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()