diff --git a/pyproject.toml b/pyproject.toml index dfe4e31cc..f38c2ed7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,12 @@ dependencies = [ "numpy", ] +[project.scripts] +sls_detector_get = "slsdet.cli:get" +sls_detector_put = "slsdet.cli:put" +sls_detector_acquire = "slsdet.cli:acquire" +slsReceiver = "slsdet.cli:receiver" + [tool.cibuildwheel] before-all = "uname -a" build = "cp{311,312,313,314}-manylinux_x86_64" @@ -22,16 +28,20 @@ build = "cp{311,312,313,314}-manylinux_x86_64" [tool.scikit-build.build] verbose = true + [tool.scikit-build.cmake] build-type = "Release" [tool.scikit-build.install] -components = [ "python",] +components = [ "python","cli", "receiver"] [tool.scikit-build.cmake.define] -SLS_USE_RECEIVER = "OFF" -SLS_USE_RECEIVER_BINARIES = "OFF" -SLS_USE_TEXTCLIENT = "OFF" +SLS_USE_RECEIVER = "ON" +SLS_USE_RECEIVER_BINARIES = "ON" +SLS_USE_TEXTCLIENT = "ON" SLS_BUILD_SHARED_LIBRARIES = "OFF" SLS_USE_PYTHON = "ON" SLS_INSTALL_PYTHONEXT = "ON" +CMAKE_INSTALL_BINDIR = "slsdet/data/bin" + + diff --git a/python/slsdet/cli.py b/python/slsdet/cli.py new file mode 100644 index 000000000..b0ed9e1f0 --- /dev/null +++ b/python/slsdet/cli.py @@ -0,0 +1,28 @@ +import os +import subprocess +import sys +from importlib.resources import files + + + +def _program_exit(exe_name: str) -> int: + exe = files("slsdet").joinpath("data", "bin", exe_name) + + #Replace the current process with the executable, passing the command line arguments + os.execl(str(exe), str(exe), *sys.argv[1:]) + +def get() -> int: + exe_name = "sls_detector_get" + return _program_exit(exe_name) + +def put() -> int: + exe_name = "sls_detector_put" + return _program_exit(exe_name) + +def acquire() -> int: + exe_name = "sls_detector_acquire" + return _program_exit(exe_name) + +def receiver() -> int: + exe_name = "slsReceiver" + return _program_exit(exe_name) \ No newline at end of file diff --git a/slsDetectorSoftware/CMakeLists.txt b/slsDetectorSoftware/CMakeLists.txt index 472205230..c761cd3a9 100755 --- a/slsDetectorSoftware/CMakeLists.txt +++ b/slsDetectorSoftware/CMakeLists.txt @@ -112,13 +112,13 @@ if(SLS_USE_TEXTCLIENT) # Mainly for RPMs to enable side by side installations of different versions if(SLS_INSTALL_VERSIONED_BINARIES) install(PROGRAMS "$" - DESTINATION bin + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME "$-${PROJECT_VERSION}" COMPONENT cli ) else() install(TARGETS ${val1} - DESTINATION bin + DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cli ) endif()