added rpms

This commit is contained in:
Erik Frojdh committed 2026-09-08 12:16:25 +02:00
1 parent c10bc5e530
commit 0010a1fb80
17 files changed
+158 -44

No files matched your search

+43 -1
View File
@@ -21,6 +21,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.24")
endif()
include(cmake/project_version.cmake)
include(cmake/SlsAddFlag.cmake)
include(cmake/SlsInstallExecutable.cmake)
@@ -136,6 +137,7 @@ option(SLS_TUNE_LOCAL "tune to local machine" OFF)
option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
option(SLS_USE_JUNGFRAU "compile post processing for Jungfrau" OFF)
option(SLS_INSTALL_VERSIONED_BINARIES "Add version number to installed executables and RPM package names" OFF)
#Convenience option to switch off defaults when building Moench binaries only
option(SLS_BUILD_ONLY_MOENCH "compile only Moench" OFF)
@@ -386,4 +388,44 @@ if(SLS_MASTER_PROJECT)
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared)
include(cmake/package_config.cmake)
endif()
endif()
#Packaging
# Generic CPack metadata
set(CPACK_PACKAGE_NAME "slsDetectorPackage")
set(CPACK_PACKAGE_VENDOR "Paul Scherrer Institut")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DAQ software for PSI developed detectors")
# RPM-specific settings
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME)
if(SLS_INSTALL_VERSIONED_BINARIES)
string(APPEND CPACK_RPM_PACKAGE_NAME "-${PROJECT_VERSION}")
endif()
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_FILE_NAME
"${PROJECT_NAME_LOWER}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm")
set(CPACK_RPM_PACKAGE_LICENSE "LGPL-3.0")
set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
set(CPACK_RPM_PACKAGE_RELEASE 1)
# Adds %{?dist} to the RPM Release field
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_GUI_PACKAGE_REQUIRES
"qt5-qtbase, qt5-qtbase-gui"
)
#control which RPMs are generated
set(CPACK_COMPONENTS_ALL cli receiver zmq gui)
# Keep the project version only once in filenames; RPM expands its metadata.
foreach(component IN LISTS CPACK_COMPONENTS_ALL)
string(TOUPPER "${component}" component_upper)
set(CPACK_RPM_${component_upper}_FILE_NAME
"${PROJECT_NAME_LOWER}-${component}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm")
endforeach()
include(CPack)
+10
View File
@@ -1,3 +1,13 @@
Unreleased changes
==================
* Added CPack RPM packaging for CLI, receiver, Moench tools and GUI.
SLS_INSTALL_VERSIONED_BINARIES=ON adds the project version to RPM
package names and all installed executable names, including the GUI,
Jungfrau tools and virtual detector servers, for side-by-side use.
RPM filenames include the project version only once.
SLS Detector Package Minor Release 9.2.0 released on 02.06.2025
==================================================================
+30
View File
@@ -0,0 +1,30 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2026 Contributors to the SLS Detector Package
function(sls_install_executable target)
cmake_parse_arguments(ARG "" "DESTINATION;COMPONENT;EXPORT" "" ${ARGN})
if(NOT ARG_DESTINATION)
set(ARG_DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
set(install_args DESTINATION "${ARG_DESTINATION}")
if(ARG_COMPONENT)
list(APPEND install_args COMPONENT "${ARG_COMPONENT}")
endif()
if(SLS_INSTALL_VERSIONED_BINARIES)
install(PROGRAMS "$<TARGET_FILE:${target}>"
${install_args}
RENAME "$<TARGET_FILE_BASE_NAME:${target}>-${PROJECT_VERSION}${CMAKE_EXECUTABLE_SUFFIX}"
)
else()
set(export_args)
if(ARG_EXPORT)
list(APPEND export_args EXPORT "${ARG_EXPORT}")
endif()
install(TARGETS ${target}
${export_args}
RUNTIME ${install_args}
)
endif()
endfunction()
+46
View File
@@ -217,6 +217,52 @@ Example cmake options Comment
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmk script option to hint library location. <zeromq for different slsDetectorPackage versions>`
3.2.3. Build RPM packages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CPack builds separate RPMs for the command line tools (``cli``), receiver
executables (``receiver``), Moench processing tools (``zmq``), and GUI (``gui``).
Install ``rpm-build`` and the dependencies for the selected features, and build
on the target distribution or a matching container.
For example, to package the command line tools, receiver and GUI:
.. code-block:: bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr -DSLS_USE_GUI=ON \
-DSLS_INSTALL_VERSIONED_BINARIES=ON
cmake --build build -j4
cpack --config build/CPackConfig.cmake -G RPM \
-D 'CPACK_COMPONENTS_ALL=cli;receiver;gui' -B build
Select only components enabled in the build. Add ``-DSLS_USE_MOENCH=ON`` and
the ``zmq`` component to package the Moench tools.
``SLS_INSTALL_VERSIONED_BINARIES=ON`` includes the project version in the RPM
package names, for example ``slsdetectorpackage-9.2.0-cli`` and
``slsdetectorpackage-9.2.0-gui``. Installed executables also receive a version
suffix, such as ``sls_detector_get-9.2.0`` and ``slsDetectorGui-9.2.0``. This
allows RPMs for different project versions to be installed side by side.
RPM revisions of the same project version retain the same package names and
can be upgraded normally.
RPM filenames include the version once, for example
``slsdetectorpackage-cli-9.2.0-1.fc44.x86_64.rpm``. The package's internal name
remains ``slsdetectorpackage-9.2.0-cli`` and its RPM version remains ``9.2.0``.
The option also applies to Jungfrau processing tools and virtual detector
servers installed with ``cmake --install``. These are outside the current RPM
component selection. Executables in the build directory keep their original
names. With the option set to ``OFF`` (the default), installed executables and
RPM package names omit the project version.
The RPM components contain executables; Python bindings, libraries and headers
are not included. A full ``cmake --install`` still installs libraries and
headers at their usual paths, so use separate prefixes for full installations
of different versions.
3.3. Build on old distributions using conda
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -95,7 +95,5 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
set_property(TARGET ${exe} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
sls_install_executable(${exe} DESTINATION bin)
endforeach(exe ${JUNGFRAU_EXECUTABLES})
install(TARGETS ${JUNGFRAU_EXECUTABLES} DESTINATION bin)
@@ -84,7 +84,6 @@ foreach(exe ${MOENCH_EXECUTABLES})
set_property(TARGET ${exe} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
sls_install_executable(${exe} DESTINATION bin COMPONENT zmq)
endforeach(exe ${MOENCH_EXECUTABLES})
install(TARGETS ${MOENCH_EXECUTABLES} DESTINATION bin)
+1 -8
View File
@@ -119,11 +119,4 @@ if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
set_property(TARGET slsDetectorGui PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
install(TARGETS slsDetectorGui
# EXPORT "${TARGETS_EXPORT_NAME}" #do not export gui
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
sls_install_executable(slsDetectorGui COMPONENT gui)
@@ -44,6 +44,4 @@ set_target_properties(ctbDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS ctbDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(ctbDetectorServer_virtual)
@@ -37,9 +37,7 @@ set_target_properties(eigerDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS eigerDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(eigerDetectorServer_virtual)
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)
@@ -38,9 +38,7 @@ set_target_properties(gotthard2DetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS gotthard2DetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(gotthard2DetectorServer_virtual)
configure_file(config_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard2.txt COPYONLY)
configure_file(detid_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/detid_gotthard2.txt COPYONLY)
@@ -38,8 +38,6 @@ set_target_properties(gotthardDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS gotthardDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(gotthardDetectorServer_virtual)
configure_file(config_gotthard.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard.txt COPYONLY)
configure_file(config_gotthard.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard.txt COPYONLY)
@@ -36,9 +36,8 @@ set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS jungfrauDetectorServer_virtual
sls_install_executable(jungfrauDetectorServer_virtual
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(config_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/config_jungfrau.txt COPYONLY)
@@ -36,9 +36,8 @@ set_target_properties(moenchDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS moenchDetectorServer_virtual
sls_install_executable(moenchDetectorServer_virtual
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(detid_moench.txt ${CMAKE_BINARY_DIR}/bin/detid_moench.txt COPYONLY)
@@ -40,9 +40,7 @@ set_target_properties(mythen3DetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS mythen3DetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(mythen3DetectorServer_virtual)
configure_file(DefaultPattern_mythen3.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_mythen3.txt COPYONLY)
configure_file(detid_mythen3.txt ${CMAKE_BINARY_DIR}/bin/detid_mythen3.txt COPYONLY)
@@ -37,6 +37,4 @@ set_target_properties(xilinx_ctbDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS xilinx_ctbDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
sls_install_executable(xilinx_ctbDetectorServer_virtual)
+3 -1
View File
@@ -111,8 +111,10 @@ if(SLS_USE_TEXTCLIENT)
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
set_property(TARGET ${val1} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
sls_install_executable(${val1} DESTINATION bin COMPONENT cli)
endforeach()
install(TARGETS ${det_bin_names} DESTINATION bin)
endif(SLS_USE_TEXTCLIENT)
+14 -6
View File
@@ -159,13 +159,21 @@ if (SLS_USE_RECEIVER_BINARIES)
"$<BUILD_INTERFACE:libzmq-static>"
)
install(TARGETS slsReceiver slsMultiReceiver slsFrameSynchronizer
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sls
# Receiver binaries
set(SLS_RECEIVER_BINARIES
slsReceiver
slsMultiReceiver
slsFrameSynchronizer
)
foreach(target IN LISTS SLS_RECEIVER_BINARIES)
sls_install_executable(${target}
EXPORT "${TARGETS_EXPORT_NAME}"
COMPONENT receiver
)
endforeach()
endif(SLS_USE_RECEIVER_BINARIES)