conflicts resolved

This commit is contained in:
maliakal_d 2019-02-14 17:32:33 +01:00
commit 6be47d936f
31 changed files with 728 additions and 871 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ bin/
*.log
*.out
*.toc
*.o
build
docs/
RELEASE.txt

View File

@ -1,9 +1,25 @@
cmake_minimum_required(VERSION 2.8)
# cmake_minimum_required(VERSION 3.5)
project(slsDetectorPackage)
include(cmake/project_version.cmake)
# Include additional modules that are used unconditionally
include(GNUInstallDirs)
# If conda build, always set lib dir to 'lib'
if($ENV{CONDA_BUILD})
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
# Set lower / upper case project names
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
# Set targets export name (used by slsDetectorPackage and dependencies)
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
#set(namespace "${PROJECT_NAME}::")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set (CALIBRATE OFF)
# Check if project is being used directly or via add_subdirectory
@ -12,11 +28,16 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(SLS_MASTER_PROJECT ON)
endif()
option (SLS_USE_HDF5 "HDF5 File format" OFF)
option (SLS_USE_TEXTCLIENT "Text Client" OFF)
option (SLS_USE_RECEIVER "Receiver" OFF)
option (SLS_USE_GUI "GUI" OFF)
option (SLS_USE_TESTS "TESTS" ON)
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" ON)
#Testing for minimum version for compilers
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@ -31,6 +52,10 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
endif()
#set (CMAKE_CXX_STANDARD 11)
#set (CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ")
# set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread")
@ -40,68 +65,57 @@ set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-point
find_package(Qt4)
find_package(Qwt 6)
find_package(CBF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
find_package(Doxygen)
find_package(ZeroMQ 4 REQUIRED)
if (USE_TESTS)
enable_testing()
endif(USE_TESTS)
# Support library containing functionallity common to
# detector and receiver
add_subdirectory(slsSupportLib)
if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX)
endif (SLS_USE_HDF5)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
#zmq
# add_library(zmq STATIC IMPORTED GLOBAL)
# set(ZMQ_STATIC_ARCHIVE ${CMAKE_CURRENT_SOURCE_DIR}/slsSupportLib/include/libzmq.a)
# set_target_properties(zmq PROPERTIES
# IMPORTED_LOCATION ${ZMQ_STATIC_ARCHIVE}
# )
if (SLS_USE_TEXTCLIENT)
add_subdirectory(slsDetectorSoftware)
add_subdirectory(slsDetectorSoftware)
endif (SLS_USE_TEXTCLIENT)
if (SLS_USE_RECEIVER)
add_subdirectory(slsReceiverSoftware)
add_subdirectory(manual/manual-api)
if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
endif (SLS_USE_HDF5)
add_subdirectory(slsReceiverSoftware)
add_subdirectory(manual/manual-api)
endif (SLS_USE_RECEIVER)
if (SLS_USE_GUI)
if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui)
endif()
find_package(Qt4 REQUIRED)
find_package(Qwt 6 REQUIRED)
if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui)
endif()
endif (SLS_USE_GUI)
if (SLS_MASTER_PROJECT)
# Set targets export name (otherwise set by upstream project)
set(TARGETS_EXPORT_NAME "slsdetector-targets")
endif (SLS_MASTER_PROJECT)
if (SLS_USE_TESTS)
enable_testing()
endif(SLS_USE_TESTS)
add_subdirectory(integrationTests)
if (CALIBRATE)
if (DEFINED ENV{ROOTSYS})
find_package(ROOT)
if (ROOT_FOUND)
add_subdirectory(calibrationWizards)
endif()
endif()
endif(CALIBRATE)
if (SLS_USE_INTEGRATION_TESTS)
add_subdirectory(integrationTests)
endif (SLS_USE_INTEGRATION_TESTS)
# install(FILES ${ZMQ_STATIC_ARCHIVE}
# DESTINATION lib)
if(SLS_MASTER_PROJECT)
# Set install dir CMake packages
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/sls)
# Set the list of exported targets
set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared)
# Generate and install package config file and version
include(cmake/package_config.cmake)
endif()

235
Makefile
View File

@ -1,235 +0,0 @@
# do not change below this line#
# Include common definitions
include Makefile.include
INSTALLROOT ?= $(PWD)
BINDIR ?= $(INSTALLROOT)/bin
DOCDIR ?= $(INSTALLROOT)/manual/docs
LIBDIR ?= $(INSTALLROOT)/bin
INCDIR ?= $(INSTALLROOT)/include
DETAILDOC ?= $(INSTALLROOT)/docs
WD = $(shell pwd)
LIBRARYDIR = $(WD)/slsDetectorSoftware
LIBRARYRXRDIR = $(WD)/slsReceiverSoftware
CLIENTDIR = $(LIBRARYDIR)/slsDetectorClient
GUIDIR = $(WD)/slsDetectorGui
RECEIVERDIR = $(LIBRARYRXRDIR)
CALWIZDIR = $(WD)/calibrationWizards
MANDIR = $(WD)/manual
CALIBDIR = $(WD)/slsDetectorCalibration
MANAPIDIR = $(MANDIR)/manual-api
TABSPACE := "\t"
INCLUDES=-I. -I$(WD)/slsSupportLib/include -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(LIBRARYDIR)/sharedMemory -I$(ASM)
INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/include -I$(WD)/slsSupportLib/include -I$(CALIBDIR) -I$(ASM)
#LIBFLAGRXR +=
$(info )
$(info #######################################)
$(info # In slsDetectorsPackage Makefile #)
$(info #######################################)
$(info )
.PHONY: all nonstatic static lib libreceiver textclient receiver gui stextclient sreceiver
#all: lib textclient receiver gui
all: textclient receiver gui
nonstatic: lib libreceiver textclient receiver gui
static: lib libreceiver stextclient sreceiver gui
lib:
cd $(LIBRARYDIR) && $(MAKE) FLAGS='$(FLAGS)' DESTDIR='$(LIBDIR)' LIBRARYDIR='$(LIBRARYDIR)' LIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' LIBDIR='$(LIBDIR)'
libreceiver:
cd $(LIBRARYRXRDIR) && $(MAKE) FLAGS='$(FLAGS)' DESTDIR='$(LIBDIR)' LIBS='$(LDFLAGRXR)' INCLUDES='$(INCLUDESRXR)' LIBDIR='$(LIBDIR)'
stextclient: slsDetectorClient_static
slsDetectorClient: textclient
slsDetectorClient_static: #lib
cd $(CLIENTDIR) && $(MAKE) static_clients FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBRARYDIR='$(LIBRARYDIR)' LIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' LIBDIR='$(LIBDIR)'
@echo ""
@echo "#######################################"
@echo "# Back in slsDetectorPackage Makefile #"
@echo "#######################################"
@echo ""
textclient: #lib
cd $(CLIENTDIR) && $(MAKE) FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBRARYDIR='$(LIBRARYDIR)' LIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' LIBDIR='$(LIBDIR)'
@echo ""
@echo "#######################################"
@echo "# Back in slsDetectorPackage Makefile #"
@echo "#######################################"
@echo ""
slsReceiver: receiver
slsReceiver_static: receiver
receiver: #libreceiver
# cd $(RECEIVERDIR) && $(MAKE) receiver FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBS='$(LDFLAGRXR)' INCLUDES='$(INCLUDESRXR)' LIBDIR='$(LIBDIR)'
cd $(RECEIVERDIR) && $(MAKE) FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBS='$(LDFLAGRXR)' INCLUDES='$(INCLUDESRXR)' LIBDIR='$(LIBDIR)'
cd $(MANAPIDIR) && $(MAKE) slsMultiReceiver
@echo ""
@echo "#######################################"
@echo "# Back in slsDetectorPackage Makefile #"
@echo "#######################################"
@echo ""
sreceiver: #libreceiver
cd $(RECEIVERDIR) && $(MAKE) static_receiver FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBS='$(LDFLAGRXR)' INCLUDES='$(INCLUDESRXR)' LIBDIR='$(LIBDIR)'
@echo ""
@echo "#######################################"
@echo "# Back in slsDetectorPackage Makefile #"
@echo "#######################################"
@echo ""
slsDetectorGUI: #lib
cd $(GUIDIR) && $(MAKE) DESTDIR='$(BINDIR)' LIBRARYDIR='$(LIBRARYDIR)' INCLUDES='$(INCLUDES)' LDFLAGDET='$(LDFLAGDETONLY)' LIBDIR='$(LIBDIR)'
@echo ""
@echo "#######################################"
@echo "# Back in slsDetectorPackage Makefile #"
@echo "#######################################"
@echo ""
calWiz:
cd $(CALWIZDIR) && $(MAKE) DESTDIR=$(BINDIR) #FLAGS=$(FLAGS) LDFLAGDET=$(LDFLAGDET) INCLUDES=$(INCLUDES)
gui: slsDetectorGUI
doc:
$(shell test -d $(DOCDIR) || mkdir -p $(DOCDIR))
cd manual && make all DESTDIR=$(DOCDIR)
htmldoc:
make doc
$(shell test -d $(DOCDIR) || mkdir -p $(DOCDIR))
cd manual && make html DESTDIR=$(DOCDIR)
detaildoc: createdocs docspdf docshtml removedocs
createdocs: $(LIBRARYDIR)/doxy.config
doxygen $(LIBRARYDIR)/doxy.config
docspdf:
cd slsDetectorPackageDocs/latex && make
$(shell test -d $(DETAILDOC) || mkdir -p $(DETAILDOC))
$(shell test -d $(DETAILDOC)/pdf || mkdir -p $(DETAILDOC)/pdf)
mv slsDetectorPackageDocs/latex/refman.pdf $(DETAILDOC)/pdf/slsDetectorPackageDocs.pdf
docshtml:
$(shell test -d $(DETAILDOC) || mkdir -p $(DETAILDOC))
$(shell test -d $(DETAILDOC)/html || mkdir -p $(DETAILDOC)/html)
$(shell test -d $(DETAILDOC)/html/slsDetectorPackageDocs && rm -r $(DETAILDOC)/html/slsDetectorPackageDocs)
mv slsDetectorPackageDocs/html $(DETAILDOC)/html/slsDetectorPackageDocs
removedocs:
rm -rf slsDetectorPackageDocs;
clean:
cd $(BINDIR) && rm -rf sls_detector_* slsDetectorGui slsReceiver angularCalibrationWizard energyCalibrationWizard
cd $(LIBDIR) && rm -rf libSlsDetector.so libSlsDetector.a libSlsReceiver.so libSlsReceiver.a
cd $(LIBRARYDIR) && $(MAKE) clean
cd $(LIBRARYRXRDIR) && $(MAKE) clean
cd $(CLIENTDIR) && $(MAKE) clean
cd $(GUIDIR) && $(MAKE) clean
cd $(CALWIZDIR) && $(MAKE) clean
cd manual && $(MAKE) clean
cd $(DOCDIR) && rm -rf *
rm -rf slsDetectorPackageDocs;
rm -rf $(DETAILDOC)
rm -rf $(MANAPIDIR)/slsMultiReceiver
#install_lib:
# cd $(LIBRARYDIR) && $(MAKE) install DESTDIR=$(LIBDIR) INCLUDES=$(INCLUDES)
# cd $(LIBRARYDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR)
mythen_virtual:
cd $(LIBRARYDIR) && $(MAKE) mythenVirtualServer DESTDIR=$(BINDIR)
gotthard_virtual:
cd $(LIBRARYDIR) && $(MAKE) gotthardVirtualServer DESTDIR=$(BINDIR)
install_client: textclient slsReceiver
install_gui: gui
confinstall:
make conf;\
make install
install_lib:
make lib;\
make libreceiver; \
make textclient; \
make slsReceiver; \
make doc; \
make htmldoc; \
cd $(LIBRARYDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR); \
cd $(LIBRARYRXRDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR);
install:
make install_lib; \
make gui; \
make calWiz; \
cd $(LIBRARYDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR);\
cd $(LIBRARYRXRDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR);
conf:
set -e; \
. ./configure; \
@echo "INSTALLROOT is $(INSTALLROOT)"
@echo "BINDIR is $(BINDIR)"
@echo "LIBDIR is $(LIBDIR)"
@echo "INCDIR is $(INCDIR)"
@echo "DOCDIR is $(DOCDIR)"
help:
@echo "Targets:"
@echo "make all compile library, text clients, data reciever"
@echo "make lib compile library"
@echo "make libreceiver compile receiver library"
@echo "make textclient compile the slsDetectorClient dynamically linking the libraries"
@echo "make stextclient compile slsDetectorClient statically linking the libraries"
@echo "make receiver compile the slsReciever dynamically linking the libraries"
@echo "make sreceiver compile the slsReciever statically linking the libraries"
@echo "make gui compile slsDetectorGUI - requires a working Qt4 and Qwt installation"
@echo "make calWiz compile the calibration wizards - requires a working Root installation"
@echo "make doc compile pdf documentation"
@echo "make htmldoc compile html (and pdf) documentation"
@echo "make install_lib installs the libraries, the text clients, the documentation and the includes for the API"
@echo "make install installs all software, including the gui, the cal wizards and the includes for the API"
@echo "make confinstall installs all software, including the gui, the cal wizards and the includes for the API, prompting for the install paths"
@echo "make clean remove object files and executables"
@echo "make help lists possible targets"
@echo ""
@echo ""
@echo "Makefile variables"
@echo "DEBUG=1,2 set debug level to 1 (VERBOSE) or 2 (VERYVERBOSE)"
@echo ""
@echo ""
@echo "Variables - to change them run <source configure> :"
@echo "INSTALLROOT=<yourdir>: installation root di r, default $PWD"
@echo "BINDIR=<yourbin>: binary installation dir below INSTALLROOT, default bin"
@echo "LIBDIR=<yourlib>: library installation dir below INSTALLROOT, default lib"
@echo "INCDIR=<yourincludes>: header installation dir below INSTALLROOT, default include"
@echo "DOCDIR=<yourdoc>: documentation installation dir below INSTALLROOT, default doc"

View File

@ -1,58 +0,0 @@
##############################################################
# Generic
##############################################################
CC = g++
CXX = $(CC)
ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
LDFLAGDETONLY = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector
LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
FLAGS= -Wall -pthread #-DEIGER_DEBUG2
# -DVERBOSE
# Setting up the verbose flags
ifeq ($(DEBUG),1)
FLAGS = -Wall -DVERBOSE
endif
ifeq ($(DEBUG),2)
FLAGS = -Wall -DVERYVERBOSE
endif
##############################################################
# HDF5 specific. Set this to yes, if you want to compile
# HDF5 code: in this case, you need HDF5 libraries
##############################################################
HDF5 = no
HDF5_DIR = /opt/hdf5v1.10.0
ifeq ($(HDF5),yes)
LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L$(HDF5_DIR)/lib -Wl,-rpath=$(HDF5_DIR)/lib -lhdf5 -lhdf5_cpp -lsz -lz -DHDF5C -L/usr/lib64/ -pthread
INCLUDESRXR = -I$(HDF5_DIR)/include
endif
##############################################################
# ROOTSLS specific. Set this to yes, if you want to compile
# ROOTSLS code: in this case, you need also root libraries
##############################################################
ROOTSLS = no
ROOTFLAGS = $(shell root-config --cflags --glibs) -DMYROOT1 #-DALLFILE_DEBUG #-DMYROOT1
ifeq ($(ROOTSLS),yes)
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver $(ROOTFLAGS) -DROOTSLS
endif
define colorecho
@tput setaf 6
@echo $1
@tput sgr0
endef

View File

@ -0,0 +1,31 @@
# This cmake code creates the configuration that is found and used by
# find_package() of another cmake project
# get lower and upper case project name for the configuration files
# configure and install the configuration files
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_SOURCE_DIR}/cmake/project-config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER}
PATH_VARS CMAKE_INSTALL_DIR)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES)
install(
EXPORT "${TARGETS_EXPORT_NAME}"
FILE ${PROJECT_NAME_LOWER}-targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
endif ()

View File

@ -0,0 +1,24 @@
# Config file for @PROJECT_NAME_LOWER@
#
# It defines the following variables:
#
# @PROJECT_NAME_UPPER@_INCLUDE_DIRS - include directory
# @PROJECT_NAME_UPPER@_LIBRARIES - all dynamic libraries
# @PROJECT_NAME_UPPER@_STATIC_LIBRARIES - all static libraries
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
set(SLS_USE_HDF5 "@SLS_USE_HDF5@")
# Add optional dependencies here
find_dependency(Threads)
if (SLS_USE_HDF5)
find_dependency(HDF5)
endif ()
set_and_check(@PROJECT_NAME_UPPER@_CMAKE_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_DIR@")
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")

View File

@ -0,0 +1,14 @@
#include "project_version.h"
/// project version as major.minor.patch string
const char* @PROJECT_NAME@_runtime_project_version(){ return "@PROJECT_VERSION@"; }
/// package version as string, possibly with git commit: v1.2.3+4+g56789abc
const char* @PROJECT_NAME@_runtime_package_version(){ return "@PACKAGE_VERSION@"; }
/// project version as integer: major * 10000 + minor * 100 + patch
int @PROJECT_NAME@_runtime_version_int() { return @PROJECT_VERSION_INT@; }
/// project version as integer: major
int @PROJECT_NAME@_runtime_version_major(){ return @PACKAGE_VERSION_MAJOR@; }
/// project version as integer: minor
int @PROJECT_NAME@_runtime_version_minor(){ return @PACKAGE_VERSION_MINOR@; }
/// project version as integer: patch
int @PROJECT_NAME@_runtime_version_patch(){ return @PACKAGE_VERSION_PATCH@; }

154
cmake/project_version.cmake Normal file
View File

@ -0,0 +1,154 @@
#
# Sets PROJECT_VERSION and PACKAGE_VERSION
#
# Don't set PROJECT_VERSION to empty string when no VERSION is given to project() command.
#if(POLICY CMP0048)
# cmake_policy(SET CMP0048 OLD)
#endif()
# Split a version number into separate components
# version the version number to split
# major variable name to store the major version in
# minor variable name to store the minor version in
# patch variable name to store the patch version in
# extra variable name to store a version suffix in
function(version_split version major minor patch extra)
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" version_valid ${version})
if(version_valid)
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" "\\1;\\2;\\3;\\4" VERSION_MATCHES ${version})
list(GET VERSION_MATCHES 0 version_major)
set(${major} ${version_major} PARENT_SCOPE)
list(GET VERSION_MATCHES 1 version_minor)
set(${minor} ${version_minor} PARENT_SCOPE)
list(GET VERSION_MATCHES 2 version_patch)
set(${patch} ${version_patch} PARENT_SCOPE)
list(GET VERSION_MATCHES 3 version_extra)
set(${extra} ${version_extra} PARENT_SCOPE)
else(version_valid)
message(AUTHOR_WARNING "Bad version ${version}; falling back to 0 (have you made an initial release?)")
set(${major} "0" PARENT_SCOPE)
set(${minor} "0" PARENT_SCOPE)
set(${patch} "0" PARENT_SCOPE)
set(${extra} "" PARENT_SCOPE)
endif(version_valid)
endfunction(version_split)
##############################
# get PROJECT_VERSION from git
##############################
find_program(GIT_CMD git)
mark_as_advanced(GIT_CMD)
if (GIT_CMD)
execute_process(COMMAND ${GIT_CMD} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TOPLEVEL
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if (GIT_CMD AND NOT "${GIT_TOPLEVEL}" STREQUAL "")
execute_process(COMMAND ${GIT_CMD} rev-parse --short HEAD
WORKING_DIRECTORY ${GIT_TOPLEVEL}
OUTPUT_VARIABLE GIT_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE)
#message(STATUS "GIT_SHA1: " ${GIT_SHA1})
execute_process(COMMAND ${GIT_CMD} describe --match "*[0-9].[0-9]*" HEAD
WORKING_DIRECTORY ${GIT_TOPLEVEL}
OUTPUT_VARIABLE GIT_DESCRIBE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
#message(STATUS "GIT_DESCRIBE: " ${GIT_DESCRIBE})
if (GIT_DESCRIBE)
string(REGEX REPLACE "v?([0-9.]+).*" "\\1" GIT_VERSION ${GIT_DESCRIBE})
message(STATUS "GIT_VERSION: " ${GIT_VERSION})
# as package version we use the full version from git describe: 1.7.1+7+ge324c81
if (GIT_DESCRIBE MATCHES ".*-g.*")
# convert a git describe string to usable debian version, e.g. v1.7.1-7-ge324c81 to 1.7.1+7+ge324c81
string(REGEX REPLACE "v?([0-9]*.[0-9.]*).*-([0-9]*)-([a-g0-9]*)" "\\1+\\2+\\3" GIT_FULL_VERSION ${GIT_DESCRIBE})
else()
# current HEAD is git tag (i.e. releaase), directly use the version
set(GIT_FULL_VERSION ${GIT_VERSION})
endif()
else ()
# no (suitable) tag found
set(GIT_VERSION "0.0.0")
# get number of commits in repo
execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD
WORKING_DIRECTORY ${GIT_TOPLEVEL}
OUTPUT_VARIABLE GIT_COMMIT_COUNT
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(GIT_FULL_VERSION 0.0.0+${GIT_COMMIT_COUNT}+g${GIT_SHA1})
endif ()
endif ()
# get version from package.xml if it exists
if (EXISTS "${PROJECT_SOURCE_DIR}/package.xml")
file(STRINGS "${PROJECT_SOURCE_DIR}/package.xml" PACKAGE_XML_VERSION_LINE REGEX <version>[0-9.]*</version>)
string(REGEX REPLACE .*<version>\([0-9.]*\)</version>.* \\1 PACKAGE_XML_VERSION "${PACKAGE_XML_VERSION_LINE}")
MESSAGE(STATUS "PACKAGE_XML_VERSION: " ${PACKAGE_XML_VERSION})
endif ()
# set version (if not already manually specified)
# check versions from different sources and set actually used version
if (NOT PROJECT_VERSION)
# set PROJECT_VERSION to MAJOR.MINOR.PATCH
# PACKAGE_VERSION can have extra info
if (GIT_VERSION)
set(PROJECT_VERSION ${GIT_VERSION})
set(PACKAGE_VERSION ${GIT_FULL_VERSION})
elseif (PACKAGE_XML_VERSION)
set(PROJECT_VERSION ${PACKAGE_XML_VERSION})
set(PACKAGE_VERSION ${PROJECT_VERSION})
else ()
message(WARNING "PROJECT_VERSION not set. Defaulting to 0.0.0")
set(PROJECT_VERSION "0.0.0")
endif ()
endif ()
if (NOT PACKAGE_VERSION)
message(WARNING "PACKAGE_VERSION not set! Falling back to (${PROJECT_VERSION})")
set(PACKAGE_VERSION ${PROJECT_VERSION})
endif ()
# warn if versions don't match
if (GIT_VERSION AND NOT GIT_VERSION MATCHES ${PROJECT_VERSION})
message(WARNING "Version from git (${GIT_VERSION}) doesn't match PROJECT_VERSION (${PROJECT_VERSION})")
endif()
if (PACKAGE_XML_VERSION AND NOT PACKAGE_XML_VERSION MATCHES ${PROJECT_VERSION})
message(WARNING "Version from package.xml (${PACKAGE_XML_VERSION}) doesn't match PROJECT_VERSION (${PROJECT_VERSION})")
endif()
message(STATUS "PROJECT_VERSION: " ${PROJECT_VERSION})
message(STATUS "PACKAGE_VERSION: " ${PACKAGE_VERSION})
version_split(${PROJECT_VERSION} PACKAGE_VERSION_MAJOR PACKAGE_VERSION_MINOR PACKAGE_VERSION_PATCH extra)
#message(STATUS "PACKAGE_VERSION_MAJOR: " ${PACKAGE_VERSION_MAJOR})
#message(STATUS "PACKAGE_VERSION_MINOR: " ${PACKAGE_VERSION_MINOR})
#message(STATUS "PACKAGE_VERSION_PATCH: " ${PACKAGE_VERSION_PATCH})
# generate an integer version number: major * 10000 + minor * 100 + patch
math(EXPR PROJECT_VERSION_INT "${PACKAGE_VERSION_MAJOR} * 10000 + ${PACKAGE_VERSION_MINOR} * 100 + ${PACKAGE_VERSION_PATCH}")
# make PROJECT_VERSION available as define in the project source
#add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
#add_definitions(-DPROJECT_VERSION_INT=${PROJECT_VERSION_INT})
#add_definitions(-DPACKAGE_VERSION="${PACKAGE_VERSION}")
#add_definitions(-DPACKAGE_VERSION_MAJOR=${PACKAGE_VERSION_MAJOR})
#add_definitions(-DPACKAGE_VERSION_MINOR=${PACKAGE_VERSION_MINOR})
#add_definitions(-DPACKAGE_VERSION_PATCH=${PACKAGE_VERSION_PATCH})
# set ABI version to major.minor, which will be used for the SOVERSION
set(abiversion "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
# generate a version.h file in the binary output dir, don't forget to install it...
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
# These files provide compile-time and runtime version information about your project.
# To offer the version info to the users of your library, you need to
# adapt the following lines in your respective CMakeLists.txt:
# add_library(<yourlibraryname> SHARED <your code files> ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/project_version.cc)
# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/project_version.h COMPONENT dev DESTINATION include/<your-include-dir>)
# To use it within your library or tests you need to add the include directory:
# > target_include_directories(yourtarget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME})
configure_file(${CMAKE_CURRENT_LIST_DIR}/project_version.h.in ${PROJECT_NAME}/project_version.h @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/project_version.cc.in ${PROJECT_NAME}/project_version.cc @ONLY)

View File

@ -0,0 +1,34 @@
#ifndef @PROJECT_NAME_UPPER@_VERSION_H_
#define @PROJECT_NAME_UPPER@_VERSION_H_
/// project version as major.minor.patch string
#define @PROJECT_NAME_UPPER@_VERSION "@PROJECT_VERSION@"
/// project version as integer: major * 10000 + minor * 100 + patch
#define @PROJECT_NAME_UPPER@_VERSION_INT @PROJECT_VERSION_INT@
#define @PROJECT_NAME_UPPER@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@
#define @PROJECT_NAME_UPPER@_VERSION_MINOR @PACKAGE_VERSION_MINOR@
#define @PROJECT_NAME_UPPER@_VERSION_PATCH @PACKAGE_VERSION_PATCH@
/// package version as string, possibly with git commit: v1.2.3+4+g56789abc
#define @PROJECT_NAME_UPPER@_PACKAGE_VERSION "@PACKAGE_VERSION@"
///runtime versions, where the above values are linked into a lib and therefore reflect the version
///of the library itself (not the version of the header at compile time of the user code)
const char* @PROJECT_NAME@_runtime_project_version();
const char* @PROJECT_NAME@_runtime_package_version();
int @PROJECT_NAME@_runtime_version_int();
int @PROJECT_NAME@_runtime_version_major();
int @PROJECT_NAME@_runtime_version_minor();
int @PROJECT_NAME@_runtime_version_patch();
///Check consistency of runtime vs compile-time version number. I.e. the header used
///for compilation was from the same version as the linked library.
inline bool @PROJECT_NAME@_check_version_consistency(bool major_minor_only)
{
return @PROJECT_NAME@_runtime_version_major() == @PROJECT_NAME_UPPER@_VERSION_MAJOR &&
@PROJECT_NAME@_runtime_version_minor() == @PROJECT_NAME_UPPER@_VERSION_MINOR &&
(major_minor_only ||
@PROJECT_NAME@_runtime_version_patch() == @PROJECT_NAME_UPPER@_VERSION_PATCH);
}
#endif

View File

@ -8,7 +8,7 @@ include_directories(
)
if(USE_TESTS)
if(SLS_USE_TESTS)
set(TEST_SOURCES
src/test-slsDetector.cpp
src/test.cpp
@ -38,8 +38,8 @@ endif()
#option(USE_TESTS "Determines whether to build tests." OFF)
# if(USE_TESTS)
#option(SLS_USE_TESTS "Determines whether to build tests." OFF)
# if(SLS_USE_TESTS)
# # Prepare "Catch" library for other executables
# set(CATCH_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/catch)
# add_library(Catch INTERFACE)

View File

@ -377,7 +377,7 @@ Use the following as an example to compile statically and using specific hdf5
folder
\begin{verbatim}
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage
-DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON
-DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
\end{verbatim}
After compiling, the libraries and executables will be found at `bin` directory

View File

@ -6,9 +6,8 @@ mkdir $PREFIX/include/slsDetectorPackage
#Shared and static libraries
cp build/bin/libSlsDetector.so $PREFIX/lib/.
cp build/bin/libSlsDetector.a $PREFIX/lib/.
cp build/bin/libSlsReceiver.so $PREFIX/lib/.
cp build/bin/libSlsReceiver.a $PREFIX/lib/.
cp build/bin/libSlsSupport.so $PREFIX/lib/.
#Binaries
cp build/bin/sls_detector_acquire $PREFIX/bin/.

View File

@ -1,68 +0,0 @@
# LEO: Won't compile without libSlsDetector
include ../Makefile.include
$(info )
$(info ##################################)
$(info # In slsDetectorGui Makefile #)
$(info ##################################)
$(info )
DESTDIR ?= ../bin
LIBDIR ?= ../bin
PROG = $(DESTDIR)/slsDetectorGui
DOCDIR ?= docs
LIBRARYDIR ?= ../slsDetectorSoftware
LIBRARYRXRDIR ?= ../slsReceiverSoftware
INCLUDES ?= ../slsSupportLib/include -I$(LIBRARYRXRDIR)/MySocketTCP -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYRXRDIR)/includes
LDFLAGDET ?= -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector
#ifeq ( $(EIGERSLS), yes)
# LDFLAG += $(EIGERFLAGS)
#else ifeq ( $(ROOTSLS), yes)
# LDFLAG += $(ROOTFLAGS)
#endif
.PHONY: all lib clean mm doc htmldoc guiclient
all: lib Makefile.gui $(PROG) guiclient
lib:
cd $(LIBRARYDIR) && $(MAKE) DESTDIR=$(DESTDIR)
@echo ""
@echo "#######################################"
@echo "# Back in slsDetectorGui Makefile #"
@echo "#######################################"
@echo ""
clean:
if test -e Makefile.gui; then $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; rm Makefile.gui; rm $(DESTDIR)/slsDetectorGui; else $(MAKE) Makefile.gui; $(MAKE) -f Makefile.gui clean; $(MAKE) -f Makefile.gui mocclean; rm $(DESTDIR)/slsDetectorGui; fi
cd client && $(MAKE) clean
# cd manual && make clean
Makefile.gui: mm
mm:
qmake -set QT_INSTALL_PREFIX $(QTDIR) && qmake -o Makefile.gui INCLUDES='$(INCLUDES)' DESTDIR=$(DESTDIR) SLSDETLIB=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' LIBDIR='$(LIBDIR)'
doc:
cd manual && $(MAKE) DESTDIR=$(DOCDIR)
htmldoc:
cd manual && $(MAKE) html DESTDIR=$(DOCDIR)
$(PROG): Makefile $(DIR) src/*.cpp include/*.h slsDetectorPlotting/include/*.h slsDetectorPlotting/src/*.cxx # forms/include/*.h
$(MAKE) -f Makefile.gui SLSDETLIB=$(DESTDIR) DESTDIR=$(DESTDIR) SUBLIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)' LIBDIR='$(LIBDIR)'
guiclient:
# echo $(WD)
cd client && $(MAKE) DESTDIR=$(DESTDIR)

View File

@ -1,29 +0,0 @@
CC = g++
CLAGS += -DVERBOSE #VERYBOSE
LDLIBS += -lm -lstdc++ -pthread
DDIR = ../../bin
INCLUDES = -I ../../slsSupportLib/include -I ../include
SRC_CLNT = qClient.cpp
DEPSINCLUDES= qClient.h ../../slsSupportLib/include/MySocketTCP.h ../../slsSupportLib/include/sls_detector_defs.h
all: client
client: $(OBJS) $(DDIR)/gui_client
OBJS = $(SRC_CLNT:%.cpp=%.o)
$(DDIR)/gui_client : $(SRC_CLNT) $(DEPSINCLUDES) Makefile
$(CXX) -o $@ -c $< $(INCLUDES) $(FLAGS) $(LDLIBS)
clean:
rm -rf $(DDIR)/gui_client *.o

View File

@ -1,4 +0,0 @@
*.o
*~
#*#
.project

View File

@ -1,4 +0,0 @@
*.o
*~
#*#
.project

View File

@ -9,25 +9,21 @@ set(SOURCES
set(HEADERS
)
# include_directories(
# multiSlsDetector
# sharedMemory
# slsDetector
# )
add_library(slsDetectorShared SHARED
${SOURCES}
${HEADERS}
)
target_include_directories(slsDetectorShared PUBLIC
multiSlsDetector
sharedMemory
slsDetector
target_include_directories(slsDetectorShared PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/multiSlsDetector>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/sharedMemory>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/slsDetector>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(slsDetectorShared
target_link_libraries(slsDetectorShared PUBLIC
slsSupportLib
${ZeroMQ_LIBRARIES}
zmq
)
set(PUBLICHEADERS
@ -57,7 +53,8 @@ endif()
install(TARGETS slsDetectorShared
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include
ARCHIVE DESTINATION lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

View File

@ -1,76 +0,0 @@
include ../Makefile.include
DESTDIR ?= ../bin
LIBDIR ?= $(DESTDIR)
CFLAGS= -g -DC_ONLY -fPIC
#FLAGS+= #-DVERBOSE -DVERYVERBOSE
DFLAGS= -g -DDACS_INT
INCLUDES?= -I../slsSupportLib/include -IslsDetector -ImultiSlsDetector -I../slsSupportLib/include -IsharedMemory I$(ASM)
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom
LIBZMQDIR = ../slsSupportLib/include
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp ../slsSupportLib/include/ReceiverInterface.cpp slsDetector/slsDetectorUsers.cpp sharedMemory/SharedMemory.cpp ../slsSupportLib/include/utilities.cpp
DEPSINCLUDES = ../slsSupportLib/include/ansi.h ../slsSupportLib/include/sls_detector_defs.h ../slsSupportLib/include/sls_detector_funcs.h ../slsSupportLib/include/error_defs.h slsDetector/detectorData.h sharedMemory/SharedMemory.h ../slsSupportLib/include/sls_detector_exceptions.h ../slsSupportLib/include/versionAPI.h ../slsSupportLib/include/utilities.h ../slsSupportLib/include/container_utils.h
$(info )
$(info #######################################)
$(info # In slsDetectorSoftware Makefile #)
$(info #######################################)
$(info )
OBJS = $(SRC_CLNT:%.cpp=%.o)
.PHONY: all package clean
all: package $(SRC_CLNT)
%.o : %.cpp %.h $(DEPSINCLUDES) Makefile
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -pthread -lrt $(LIBZMQ) $(FLAGS)
package: versioning $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
versioning:
$(call colorecho,`./updateGitVersion.sh`)
$(DESTDIR)/libSlsDetector.so: $(OBJS)
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling slsDetector Library #")
$(call colorecho,"#######################################")
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread -lrt $(LIBZMQ)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
mv libSlsDetector.so $(DESTDIR)
$(DESTDIR)/libSlsDetector.a: $(OBJS)
ar rcs libSlsDetector.a $(OBJS)
mv libSlsDetector.a $(DESTDIR)
clean:
rm -rf $(DESTDIR)/libSlsDetector.a $(DESTDIR)/libSlsDetector.so core $(OBJS)
cd
#-------------------------------------------------------------------------------
install: package
install_inc:
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
cp -P slsDetector/slsDetectorUsers.h slsDetector/detectorData.h $(DESTDIR)

View File

@ -1956,6 +1956,27 @@ std::string multiSlsDetector::getAdditionalJsonParameter(const std::string& key,
return sls::concatenateIfDifferent(r);
}
int multiSlsDetector::setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setAdditionalJsonSpecificParameter(mode, value);
}
// multi
auto r = parallelCall(&slsDetector::setAdditionalJsonSpecificParameter, mode, value);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getAdditionalJsonSpecificParameter(mode);
}
// multi
auto r = serialCall(&slsDetector::getAdditionalJsonSpecificParameter, mode);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize, int detPos) {
// single

View File

@ -1087,6 +1087,23 @@ class multiSlsDetector : public virtual slsDetectorDefs,
*/
std::string getAdditionalJsonParameter(const std::string& key, int detPos = -1);
/**
* Sets the value for a specific additional json header parameter
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
* @param value to set the parameter to, json_readout_mode and json_detector_mode can have only have values from jsonReadoutModeType or jsonDetectorModeType
* @param detPos -1 for all detectors in list or specific detector position
* @returns the specific additional json header parameter value or enum
*/
int setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value, int detPos = -1);
/**
* Returns the specific additional json header parameter value
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
* @param detPos -1 for all detectors in list or specific detector position
* @returns the specific additional json header parameter value or enum
*/
int getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int detPos = -1);
/**
* Sets the receiver UDP socket buffer size
* @param udpsockbufsize additional json header

View File

@ -2729,6 +2729,84 @@ std::string slsDetector::getAdditionalJsonParameter(const std::string& key) {
return std::string("");
}
int slsDetector::validateSpecificJsonParameterValue(jsonHeaderParameterType mode, int value) {
switch (mode) {
case JSON_EMIN:
case JSON_EMAX:
return OK;
case JSON_FRAME_MODE:
switch (value) {
case JSON_PEDESTAL:
case JSON_N_PEDESTAL:
case JSON_FLATFIELD:
case JSON_N_FLATFIELD:
case JSON_FRAME:
return OK;
default:
return FAIL;
}
case JSON_DETECTOR_MODE:
switch (value) {
case JSON_ANALOG:
case JSON_COUNTING:
case JSON_INTERPOLATING:
return OK;
default:
return FAIL;
}
default:
FILE_LOG(logERROR) << "Unkown Json Parameter Type " << mode;
return FAIL;
}
}
int slsDetector::setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value) {
if (validateSpecificJsonParameterValue(mode, value) == FAIL) {
FILE_LOG(logERROR) << "Unknown mode " << value << " to set detector mode for json header";
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
return getAdditionalJsonSpecificParameter(mode);
}
std::string smode = getJsonHeaderParameterTypeAsString(mode);
std::string sval;
if (mode == JSON_EMIN || mode == JSON_EMAX)
sval = std::to_string(value);
else
sval = getJsonHeaderParameterValueAsString((jsonHeaderParameterValuesType)value);
setAdditionalJsonParameter(smode, sval);
return getAdditionalJsonSpecificParameter(mode);
}
int slsDetector::getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode) {
std::string smode = getJsonHeaderParameterTypeAsString(mode);
std::string sval = getAdditionalJsonParameter(smode);
int val = 0;
if (mode == JSON_EMIN || mode == JSON_EMAX) {
try{
val = stoi(sval);
} catch(...) {
FILE_LOG(logERROR) << "json emin or emax set to a string. Fix additional json header";
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
return -1;
}
} else
val = getJsonHeaderParameterValuesAsEnum(sval);
if (validateSpecificJsonParameterValue(mode, val) == FAIL) {
FILE_LOG(logERROR) << "Unknown mode " << val << "(" <<sval << ") retrieved from detector mode for json header";
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
return -1;
}
return val;
}
int slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
int fnum = F_RECEIVER_UDP_SOCK_BUF_SIZE;
int ret = FAIL;

View File

@ -994,6 +994,28 @@ public:
*/
std::string getAdditionalJsonParameter(const std::string& key);
/**
* Validates the value parsed for the corresponding parameter type
* @param mode specific parameter type
* @value value enum of the value
*/
int validateSpecificJsonParameterValue(jsonHeaderParameterType mode, int value);
/**
* Sets the value for a specific additional json header parameter
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
* @param value to set the parameter to, json_readout_mode and json_detector_mode can have only have values from jsonReadoutModeType or jsonDetectorModeType
* @returns the specific additional json header parameter value or enum
*/
int setAdditionalJsonSpecificParameter(jsonHeaderParameterType mode, int value);
/**
* Returns the specific additional json header parameter value
* @param mode specific json header parameter (JSON_EMIN, JSON_EMAX, JSON_READOUT_MODE, JSON_DETECTOR_MODE)
* @returns the specific additional json header parameter value or enum
*/
int getAdditionalJsonSpecificParameter(jsonHeaderParameterType mode);
/**
* Sets the receiver UDP socket buffer size
* @param udpsockbufsize additional json header

View File

@ -63,7 +63,7 @@ The commands are sudivided into different pages depending on their functionaliti
- \ref output "Output": commands to define output file destination and format
- \ref network "Network": commands to setup the network between client, detector and receiver
- \ref receiver "Receiver": commands to configure the receiver
- \ref ctb "Chiptest board": commands specific for the new chiptest board as pattern generator
- \ref prototype "Prototype (Chip Test Board / Moench)": commands specific for the chiptest board or moench
- \ref test "Developer": commands to be used only for software debugging. Avoid using them!
*/
@ -1633,20 +1633,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
i++;
/*! \page network
- <b>rx_jsonaddheader [t]</b> sets/gets additional json header to be streamed out with the zmq from receiver. Default is empty. \c t must be in the format "\"label1\":\"value1\",\"label2\":\"value2\"" etc. Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_jsonaddheader"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
i++;
/*! \page network
- <b>rx_jsonpara [k] [v]</b> sets/gets value v for additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_jsonpara"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
i++;
/*! \page network
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
*/
@ -1793,146 +1779,190 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
++i;
/*! \page receiver
- <b>rx_jsonaddheader [t]</b> sets/gets additional json header to be streamed out with the zmq from receiver. Default is empty. \c t must be in the format "\"label1\":\"value1\",\"label2\":\"value2\"" etc. Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_jsonaddheader"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
i++;
/*! \page receiver
- <b>rx_jsonpara [k] [v]</b> sets/gets value v for additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found Use only if it needs to be processed by an intermediate process. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "rx_jsonpara"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
i++;
/* pattern generator */
/*! \page ctb Chiptest board
Commands specific for the new chiptest board as pattern generator
/*! \page prototype Protoype (Chip Test Board / Moench)
Commands specific for the chiptest board or moench
*/
/*! \page ctb
/*! \page prototype
- <b>adcinvert [mask]</b> Sets/gets ADC inversion mask (8 digits hex format)
*/
descrToFuncMap[i].m_pFuncName = "adcinvert"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>adcdisable [mask]</b> Sets/gets ADC disable mask (8 digits hex format)
*/
descrToFuncMap[i].m_pFuncName = "adcdisable"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>json_emin [i] </b> Sets/gets detector minimum energy threshold for the Moench (soft setting). It is only set in the json header for the processor. \c Returns string
*/
descrToFuncMap[i].m_pFuncName = "json_emin"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
++i;
/*! \page prototype
- <b>json_emax [i] </b> Sets/gets detector maximum energy threshold for the Moench (soft setting). It is only set in the json header for the processor. \c Returns string
*/
descrToFuncMap[i].m_pFuncName = "json_emax"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
++i;
/*! \page prototype
- <b>json_framemode [i] </b> Sets/gets readoutmode for the Moench (soft setting). It is only set in the json header for the processor. Options: pedestal, newpedestal, flatfield, newflatfield, frame. \c Returns string
*/
descrToFuncMap[i].m_pFuncName = "json_framemode"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
++i;
/*! \page prototype
- <b>json_detectormode [i] </b> Sets/gets detector mode for the Moench (soft setting). It is only set in the json header for the processor.Options: analog, counting, interpolating. \c Returns string
*/
descrToFuncMap[i].m_pFuncName = "json_detectormode"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
++i;
/*! \page prototype
- <b>pattern fn</b> loads binary pattern file fn
*/
descrToFuncMap[i].m_pFuncName = "pattern"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patword addr [word]</b> sets/gets 64 bit word at address addr of pattern memory. Both address and word in hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patword"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patioctrl [word]</b> sets/gets 64 bit mask defining input (0) and output (1) signals. hex format.
*/
descrToFuncMap[i].m_pFuncName = "patioctrl"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patclkctrl [word]</b> sets/gets 64 bit mask defining if output signal is a clock and runs. hex format. Unused at the moment.
*/
descrToFuncMap[i].m_pFuncName = "patclkctrl"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patlimits [addr1 addr2]</b> sets/gets the start and stop limits of the pattern to be executed. hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patlimits"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patloop0 [addr1 addr2]</b> sets/gets the start and stop limits of the level 0 loop. hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patloop0"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patnloop0 [n]</b> sets/gets the number of cyclesof the level 0 loop (int).
*/
descrToFuncMap[i].m_pFuncName = "patnloop0"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patwait0 [addr]</b> sets/gets the address of the level 0 wait point. hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patwait0"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patwaittime0 [n]</b> sets/gets the duration of the witing of the 0 waiting point in clock cycles (int).
*/
descrToFuncMap[i].m_pFuncName = "patwaittime0"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patloop1 [addr1 addr2]</b> sets/gets the start and stop limits of the level 1 loop. hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patloop1"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patnloop1 [n]</b> sets/gets the number of cyclesof the level 1 loop (int).
*/
descrToFuncMap[i].m_pFuncName = "patnloop1"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patwait1 [addr]</b> sets/gets the address of the level 1 wait point. hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patwait1"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patwaittime1 [n]</b> sets/gets the duration of the witing of the 1 waiting point in clock cycles (int).
*/
descrToFuncMap[i].m_pFuncName = "patwaittime1"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patloop2 [addr1 addr2]</b> sets/gets the start and stop limits of the level 2 loop. hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patloop2"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patnloop2 [n]</b> sets/gets the number of cyclesof the level 2 loop (int).
*/
descrToFuncMap[i].m_pFuncName = "patnloop2"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patwait2 [addr]</b> sets/gets the address of the level 2 wait point. hex format. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "patwait2"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>patwaittime2 [n]</b> sets/gets the duration of the waiting of the 2 waiting point in clock cycles (int).
*/
descrToFuncMap[i].m_pFuncName = "patwaittime2"; //
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
++i;
/*! \page ctb
/*! \page prototype
- <b>dut_clk [i]</b> sets/gets the signal to be used as a clock for the digital data coming from the device under test. Advanced!
*/
descrToFuncMap[i].m_pFuncName = "dut_clk"; //
@ -2846,16 +2876,6 @@ std::string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int
myDet->setReceiverDataStreamingOutIP(args[1], detPos);
}
return myDet->getReceiverStreamingIP(detPos);
} else if (cmd == "rx_jsonaddheader") {
if (action == PUT_ACTION) {
myDet->setAdditionalJsonHeader(args[1], detPos);
}
return myDet->getAdditionalJsonHeader(detPos);
} else if (cmd == "rx_jsonpara") {
if (action == PUT_ACTION) {
myDet->setAdditionalJsonParameter(args[1], args[2], detPos);
}
return myDet->getAdditionalJsonParameter(args[1]);
}
return ("unknown network parameter") + cmd;
@ -2892,11 +2912,6 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
"Default is ip of rx_hostname and works for GUI. This is usually used to stream out to an external process for further processing."
"restarts streaming in receiver with new port"
<< std::endl;
os << "rx_jsonaddheader [t]\n sets additional json header to be streamed "
"out with the zmq from receiver. Default is empty. t must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
"Use only if it needs to be processed by an intermediate process."
<< std::endl;
os << "rx_jsonpara [k v]\n sets value to v for additional json header parameter k to be streamed out with the zmq from receiver. Use only if it needs to be processed by an intermediate process." << std::endl;
os << "rx_udpsocksize [t]\n sets the UDP socket buffer size. Different defaults for Jungfrau. "
"Does not remember in client shared memory, "
"so must be initialized each time after setting receiver "
@ -2918,10 +2933,6 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
os << "rx_zmqport \n gets the 0MQ (TCP) port of the receiver from where data is streamed from" << std::endl;
os << "zmqip \n gets the 0MQ (TCP) ip of the client to where final data is streamed to.If no custom ip, empty until first time connect to receiver" << std::endl;
os << "rx_zmqip \n gets/gets the 0MQ (TCP) ip of the receiver from where data is streamed from. If no custom ip, empty until first time connect to receiver" << std::endl;
os << "rx_jsonaddheader \n gets additional json header to be streamed "
"out with the zmq from receiver."
<< std::endl;
os << "rx_jsonpara [k] \n gets value of additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found. Use only if it needs to be processed by an intermediate process." << std::endl;
os << "rx_udpsocksize \n gets the UDP socket buffer size." << std::endl;
os << "rx_realudpsocksize \n gets the actual UDP socket buffer size. Usually double the set udp socket buffer size due to kernel bookkeeping." << std::endl;
}
@ -4863,6 +4874,20 @@ std::string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action,
return std::string(answer);
}
else if (cmd == "rx_jsonaddheader") {
if (action == PUT_ACTION) {
myDet->setAdditionalJsonHeader(args[1], detPos);
}
return myDet->getAdditionalJsonHeader(detPos);
}
else if (cmd == "rx_jsonpara") {
if (action == PUT_ACTION) {
myDet->setAdditionalJsonParameter(args[1], args[2], detPos);
}
return myDet->getAdditionalJsonParameter(args[1], detPos);
}
return std::string("could not decode command");
}
@ -4879,6 +4904,11 @@ std::string slsDetectorCommand::helpReceiver(int action) {
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
os << "rx_jsonaddheader [t]\n sets additional json header to be streamed "
"out with the zmq from receiver. Default is empty. t must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
"Use only if it needs to be processed by an intermediate process." << std::endl;
os << "rx_jsonpara [k] [v]\n sets value to v for additional json header parameter k to be streamed out with the zmq from receiver." << std::endl;
}
if (action == GET_ACTION || action == HELP_ACTION) {
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
@ -4891,6 +4921,10 @@ std::string slsDetectorCommand::helpReceiver(int action) {
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
os << "rx_jsonaddheader \n gets additional json header to be streamed "
"out with the zmq from receiver." << std::endl;
os << "rx_jsonpara [k] \n gets value of additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found." << std::endl;
}
return os.str();
}
@ -5427,3 +5461,60 @@ std::string slsDetectorCommand::cmdPulse(int narg, char *args[], int action, int
else
return std::string(" unsuccessful");
}
std::string slsDetectorCommand::helpProcessor(int action) {
std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION) {
os << "json_emin [t]\n sets value to t for minimum threshold (emin) in additional json header to be streamed out with the zmq from receiver. For Moench." << std::endl;
os << "json_emax [t]\n sets value to t for maximum threshold (emax) in additional json header to be streamed out with the zmq from receiver. For Moench." << std::endl;
os << "json_framemode [s]\n sets readoutmode for the Moench (soft setting). It is only set in the json header for the processor. Options: pedestal, newpedestal, flatfield, newflatfield, frame. " << std::endl;
os << "json_detectormode [s]\n sets detector mode for the Moench (soft setting). It is only set in the json header for the processor.Options: analog, counting, interpolating. " << std::endl;
}
if (action == GET_ACTION || action == HELP_ACTION) {
os << "json_emin \n gets value of minimum threshold (emin) in additional json header to be streamed out with the zmq from receiver. If no parameter found, it returns empty string. For Moench." << std::endl;
os << "json_emin \n gets value of maximum threshold (emax) in additional json header to be streamed out with the zmq from receiver. If no parameter found, it returns empty string. For Moench." << std::endl;
os << "json_framemode [s]\n gets readoutmode for the Moench (soft setting). It is only set in the json header for the processor. Options: pedestal, newpedestal, flatfield, newflatfield, frame. " << std::endl;
os << "json_detectormode [s]\n gets detector mode for the Moench (soft setting). It is only set in the json header for the processor.Options: analog, counting, interpolating. " << std::endl;
}
return os.str();
}
std::string slsDetectorCommand::cmdProcessor(int narg, char *args[], int action, int detPos) {
if (action == HELP_ACTION)
return helpProcessor(action);
myDet->setOnline(ONLINE_FLAG, detPos);
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
int imode = getJsonHeaderParameterTypeAsEnum(cmd);
jsonHeaderParameterType mode = JSON_EMIN;
if (imode != -1)
mode = (jsonHeaderParameterType)imode;
int ival = -1;
if (cmd == "json_emin" || cmd == "json_emax") {
if (action == PUT_ACTION) {
if (!sscanf(args[1],"%d", &ival))
return std::string("cannot scan value ") + std::string(args[1]) + std::string(" for command ") + cmd;
myDet->setAdditionalJsonSpecificParameter(mode, ival);
}
return std::to_string(myDet->getAdditionalJsonSpecificParameter(mode));
}
else if (cmd == "json_framemode" || cmd == "json_detectormode") {
if (action == PUT_ACTION) {
ival = getJsonHeaderParameterValuesAsEnum(args[1]);
if (ival == -1)
return std::string("cannot scan value ") + std::string(args[1]) + std::string(" for command ") + cmd;
myDet->setAdditionalJsonSpecificParameter(mode, ival);
}
int retval = myDet->getAdditionalJsonSpecificParameter(mode);
if (retval == -1)
return std::string("unknown");
return getJsonHeaderParameterValueAsString((jsonHeaderParameterValuesType)retval);
}
return std::string("could not decode command");
}

View File

@ -79,6 +79,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
static std::string helpReceiver(int action);
static std::string helpPattern(int action);
static std::string helpPulse(int action);
static std::string helpProcessor(int action);
@ -141,7 +142,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
std::string cmdReceiver(int narg, char *args[], int action, int detPos = -1);
std::string cmdPattern(int narg, char *args[], int action, int detPos = -1);
std::string cmdPulse(int narg, char *args[], int action, int detPos = -1);
std::string cmdProcessor(int narg, char *args[], int action, int detPos = -1);
int numberOfCommands;
std::string cmd;

View File

@ -2,18 +2,12 @@ set(SOURCES
sls_detector_client.cpp
)
include_directories(
../../slsSupportLib/include
../multiSlsDetector
../slsDetector
../slsReceiverInterface
)
add_executable(sls_detector_get
${SOURCES}
)
target_link_libraries(sls_detector_get
slsDetectorShared
slsSupportLib
pthread
${ZeroMQ_LIBRARIES}
rt

View File

@ -1,111 +0,0 @@
include ../../Makefile.include
CFLAGS= -DC_ONLY
#FLAGS=-DVERBOSE
#ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
INCLUDES?= -I../../slsSupportLib/include -I../slsDetector -I../multiSlsDetector -I../slsReceiverInterface -I$(shell echo "/lib/modules/`uname -r`/build/include")
DESTDIR ?= ../../bin
BIN=$(DESTDIR)
LIBS?= -L$(DESTDIR) -lSlsDetector
LIBRARYDIR?=../
LDFLAG= -L/usr/lib64/ -pthread
DOCDIR ?= $(PWD)/docs
SRC_CLNT=sls_detector_client.cpp
$(info )
$(info #######################################)
$(info # In slsDetectorclient Makefile #)
$(info #######################################)
$(info )
all: clients
nonstatic: clients
clients: builddir lib $(DESTDIR)/sls_detector_put $(DESTDIR)/sls_detector_get $(DESTDIR)/sls_detector_acquire $(DESTDIR)/sls_detector_help
static_clients: builddir lib $(DESTDIR)/ssls_detector_put $(DESTDIR)/ssls_detector_get $(DESTDIR)/ssls_detector_acquire $(DESTDIR)/ssls_detector_help
builddir:
# echo $(LIBS)
# echo $(LDFLAG)
mkdir -p $(BIN)
lib:
# echo $(LIBDIR)
cd $(LIBRARYDIR) && $(MAKE) DESTDIR=$(DESTDIR) TABSPACE='$(TABSPACE)'
@echo ""
@echo "#######################################"
@echo "# Back in slsDetectorClient Makefile #"
@echo "#######################################"
@echo ""
$(DESTDIR)/ssls_detector_put: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling ssls_detector_put #")
$(call colorecho,"#######################################")
$(CXX) -static -o $(BIN)/ssls_detector_put $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DPUT $(LIBS) $(LDFLAG)
$(DESTDIR)/ssls_detector_get: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling ssls_detector_get #")
$(call colorecho,"#######################################")
$(CXX) -static -o $(BIN)/ssls_detector_get $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DGET $(LIBS) $(LDFLAG)
$(DESTDIR)/ssls_detector_acquire: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling ssls_detector_acquire #")
$(call colorecho,"#######################################")
$(CXX) -static -o $(BIN)/ssls_detector_acquire $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG)
$(DESTDIR)/ssls_detector_help: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling ssls_detector_help #")
$(call colorecho,"#######################################")
$(CXX) -static -o $(BIN)/ssls_detector_help $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DHELP $(LIBS) $(LDFLAG)
$(DESTDIR)/sls_detector_put: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling sls_detector_put #")
$(call colorecho,"#######################################")
$(CXX) -o $(BIN)/sls_detector_put $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DPUT $(LIBS) $(LDFLAG)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
$(DESTDIR)/sls_detector_get: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling sls_detector_get #")
$(call colorecho,"#######################################")
$(CXX) -o $(BIN)/sls_detector_get $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DGET $(LIBS) $(LDFLAG)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
$(DESTDIR)/sls_detector_acquire: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling sls_detector_acquire #")
$(call colorecho,"#######################################")
$(CXX) -o $(BIN)/sls_detector_acquire $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
$(DESTDIR)/sls_detector_help: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling sls_detector_help #")
$(call colorecho,"#######################################")
$(CXX) -o $(BIN)/sls_detector_help $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DHELP $(LIBS) $(LDFLAG)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
doc:
cd manual && make DESTDIR=$(DOCDIR)
htmldoc:
cd manual && make html DESTDIR=$(DOCDIR)
clean:
# cd manual && make clean
rm -rf $(BIN)/sls_detector_put $(BIN)/sls_detector_get $(BIN)/sls_detector_acquire $(BIN)/sls_detector_help $(BIN)/gui_client
install: clients

View File

@ -1,9 +0,0 @@
*~
*.o
build/*
GPATH
GRTAGS
GSYMS
GTAGS
.project
.cproject

View File

@ -38,8 +38,13 @@ add_library(slsReceiverShared SHARED
${HEADERS}
)
target_link_libraries(slsReceiverShared slsSupportLib)
target_include_directories(slsReceiverShared PUBLIC include)
target_link_libraries(slsReceiverShared PUBLIC
slsSupportLib
)
target_include_directories(slsReceiverShared PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
#What is included in slsReceiverLib?
set(PUBLICHEADERS
@ -60,7 +65,7 @@ set_target_properties(slsReceiver PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(slsReceiver
target_link_libraries(slsReceiver PUBLIC
slsSupportLib
slsReceiverShared
pthread
@ -69,17 +74,17 @@ target_link_libraries(slsReceiver
)
if (HDF5_FOUND)
target_link_libraries(slsReceiver ${HDF5_LIBRARIES})
target_link_libraries(slsReceiver PUBLIC ${HDF5_LIBRARIES})
endif ()
install(TARGETS slsReceiverShared slsReceiver
install(TARGETS slsReceiverShared
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include
)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${ZMQ_STATIC_ARCHIVE}
DESTINATION lib)

View File

@ -1,127 +0,0 @@
include ../Makefile.include
DESTDIR ?= ../bin
LIBDIR ?= ../bin
DOCDIR ?= docs
SRCDIR = src
INCDIR = include
COMMONDIR = ../slsSupportLib/include
TESTDIR = test
BUILDDIR = build
PROGS = $(DESTDIR)/slsReceiver
CFLAGS= -g -DC_ONLY -fPIC
#FLAGS+= #-DVERBOSE -DVERYVERBOSE
DFLAGS= -g -DDACS_INT -DSLS_RECEIVER_UDP_FUNCTIONS #-DVERBOSE
INCLUDES?= $(INCLUDESRXR) -I $(INCDIR) -I $(COMMONDIR)
##############################################################
# ZMQ specific: in this case, you need ZMQ libraries already included in this package
###########################################################
LIBZMQDIR = ../slsSupportLib/include
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
SRC_CLNT = ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp slsReceiverImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp
DEPSINCLUDES = $(COMMONDIR)/ansi.h $(COMMONDIR)/sls_detector_defs.h $(COMMONDIR)/sls_detector_funcs.h $(COMMONDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(COMMONDIR)/genericSocket.h $(COMMONDIR)/logger.h $(INCDIR)/receiver_defs.h $(COMMONDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(COMMONDIR)/sls_detector_exceptions.h
ifeq ($(HDF5),yes)
SRC_CLNT += HDF5File.cpp
endif
MAIN_SRC = main.cpp
OBJS=$(SRC_CLNT:%.cpp=$(BUILDDIR)/%.o)
$(info )
$(info #######################################)
$(info # In slsReceiverSoftware Makefile #)
$(info #######################################)
$(info )
.PHONY: all intdoc package eigerReceiver clean
all: builddir lib receiver
dummy: $(DESTDIR)/dummyReceiver
intdoc: $(SRC_H) $(SRC_CLNT)
doxygen doxy.config
$(BUILDDIR)/%.o : $(SRCDIR)/%.cpp $(INCDIR)/%.h $(COMMONDIR)/%.h $(DEPSINCLUDES) Makefile
ifeq ($(ROOTSLS),yes)
$(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -L/usr/lib64/ $(FLAGS)
else
# $(call colorecho,`./updateGitVersion.sh`)
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -pthread $(FLAGS) $(LIBZMQ) -lrt
endif
versioning:
$(call colorecho,`./updateGitVersion.sh`)
lib: versioning $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
receiver: $(DESTDIR)/slsReceiver
$(DESTDIR)/libSlsReceiver.so: $(OBJS)
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling slsReceiver Library #")
$(call colorecho,"#######################################")
$(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread $(LIBZMQ) -lrt
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
mv libSlsReceiver.so $(DESTDIR)
$(DESTDIR)/libSlsReceiver.a: $(OBJS)
ar rcs libSlsReceiver.a $(OBJS)
mv libSlsReceiver.a $(DESTDIR)
$(DESTDIR)/slsReceiver: $(SRCDIR)/$(MAIN_SRC) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling slsReceiver #")
$(call colorecho,"#######################################")
$(CXX) -o $@ $(SRCDIR)/$(MAIN_SRC) $(FLAGS) $(INCLUDES) $(CFLAGS) $(LIBS) $(LDFLAGRXR) -fPIC $(LIBZMQ) -lrt
#$(EIGERFLAGS)
$(DESTDIR)/dummyReceiver: $(SRCDIR)/$(DUMMY_MAIN_SRC) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling Dummy slsReceiver #")
$(call colorecho,"#######################################")
$(CXX) -o $@ $(SRCDIR)/$(DUMMY_MAIN_SRC) $(FLAGS) $(INCLUDES) $(CFLAGS) $(LIBS) $(LDFLAGRXR) -fPIC $(LIBZMQ) -lrt
#$(EIGERFLAGS)
clean: buildclean
make testclean
if test -e $(DESTDIR)/libSlsReceiver.a; then rm $(DESTDIR)/libSlsReceiver.a;fi
if test -e $(DESTDIR)/libSlsReceiver.so; then rm $(DESTDIR)/libSlsReceiver.so;fi
if test -e $(PROGS); then rm $(PROGS);fi
builddir:
mkdir -p $(BUILDDIR)
# if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi
buildclean:
rm -rf $(OBJS)
testclean:
if [ -f $(TESTDIR)/rec ]; then \
cd $(TESTDIR) && rm *.o rec send; \
fi
#-------------------------------------------------------------------------------
install: package
install_inc:
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
cp -P slsReceiver/slsReceiverUsers.h $(DESTDIR)

View File

@ -38,9 +38,10 @@ add_library(slsSupportLib SHARED
)
target_include_directories(slsSupportLib PUBLIC
include
${ZeroMQ_INCLUDE_DIRS}
)
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
set_target_properties(slsSupportLib PROPERTIES
LIBRARY_OUTPUT_NAME SlsSupport
@ -48,12 +49,14 @@ set_target_properties(slsSupportLib PROPERTIES
PUBLIC_HEADER "${PUBLICHEADERS}"
)
if (USE_TESTS)
if (SLS_USE_TESTS)
add_subdirectory(tests)
endif(USE_TESTS)
endif(SLS_USE_TESTS)
# Install the library
install(TARGETS slsSupportLib
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include
ARCHIVE DESTINATION lib
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

View File

@ -556,6 +556,23 @@ public:
GAIN_IMAGE /**< gain image */
};
enum jsonHeaderParameterType {
JSON_EMIN, /**< minimum energy threshold for the processor */
JSON_EMAX, /**< maximum energy threshold for the processor*/
JSON_FRAME_MODE, /**< frame mode for the processor*/
JSON_DETECTOR_MODE /**< detector mode for the processor*/
};
enum jsonHeaderParameterValuesType {
JSON_PEDESTAL, /**< pedestal mode for the processor */
JSON_N_PEDESTAL, /**< new pedestal mode for the processor */
JSON_FLATFIELD, /**< flatfield mode for the processor */
JSON_N_FLATFIELD, /**< new flatfield mode for the processor */
JSON_FRAME, /**< frame for the processor */
JSON_ANALOG, /**< analog mode for the processor */
JSON_COUNTING, /**< counting mode for the processor */
JSON_INTERPOLATING /**< interpolating mode for the processor */
};
#ifdef __cplusplus
@ -876,6 +893,67 @@ public:
}}; \
/** returns std::string from jsonHeaderParameterType
* @param h can be JSON_EMIN, JSON_EMAX, JSON_FRAME_MODE, JSON_DETECTOR_MODE
* @returns json_emin, json_emax, json_framemode, json_detectormode, unknown
*/
static std::string getJsonHeaderParameterTypeAsString(jsonHeaderParameterType h) { \
switch(h) { \
case JSON_EMIN: return std::string("json_emin"); \
case JSON_EMAX: return std::string("json_emax"); \
case JSON_FRAME_MODE: return std::string("json_framemode"); \
case JSON_DETECTOR_MODE: return std::string("json_detectormode"); \
default: return std::string("unknown"); \
} \
}; \
/** returns std::string from jsonHeaderParameterType
* @param h can be json_emin, json_emax, json_framemode, json_detectormode
* @returns JSON_EMIN, JSON_EMAX, JSON_FRAME_MODE, JSON_DETECTOR_MODE, -1
*/
static int getJsonHeaderParameterTypeAsEnum(std::string h) { \
if (h == "json_emin") return JSON_EMIN; \
if (h == "json_emax") return JSON_EMAX; \
if (h == "json_framemode") return JSON_FRAME_MODE; \
if (h == "json_detectormode") return JSON_DETECTOR_MODE; \
return -1; \
}; \
/** returns std::string from jsonHeaderParameterTyp
* @param h can be JSON_PEDESTAL, JSON_N_PEDESTAL, JSON_FLATFIELD, JSON_N_FLATFIELD, JSON_FRAME, JSON_ANALOG, JSON_COUNTING, JSON_INTERPOLATING
* @returns json_pedestal, json_newpedestal, json_flatfield, json_newflatfield, json_frame, json_analog, json_counting, json_interpolating, unknown
*/
static std::string getJsonHeaderParameterValueAsString(jsonHeaderParameterValuesType h) { \
switch(h) { \
case JSON_PEDESTAL: return std::string("json_pedestal"); \
case JSON_N_PEDESTAL: return std::string("json_newpedestal"); \
case JSON_FLATFIELD: return std::string("json_flatfield"); \
case JSON_N_FLATFIELD: return std::string("json_newflatfield"); \
case JSON_FRAME: return std::string("json_frame"); \
case JSON_ANALOG: return std::string("json_analog"); \
case JSON_COUNTING: return std::string("json_counting"); \
case JSON_INTERPOLATING: return std::string("json_interpolating"); \
default: return std::string("unknown"); \
} \
}; \
/** returns std::string from jsonHeaderParameterTyp
* @param h can be json_emin, json_emax, json_framemode, json_detectormode
* @returns JSON_EMIN, JSON_EMAX, JSON_FRAME_MODE, JSON_DETECTOR_MODE, -1
*/
static int getJsonHeaderParameterValuesAsEnum(std::string h) { \
if (h == "json_pedestal") return JSON_PEDESTAL; \
if (h == "json_newpedestal") return JSON_N_PEDESTAL; \
if (h == "json_flatfield") return JSON_FLATFIELD; \
if (h == "json_newflatfield") return JSON_N_FLATFIELD; \
if (h == "json_frame") return JSON_FRAME; \
if (h == "json_analog") return JSON_ANALOG; \
if (h == "json_counting") return JSON_COUNTING; \
if (h == "json_interpolating") return JSON_INTERPOLATING; \
return -1; \
}; \
#endif
#ifdef __cplusplus