merging refactor (replacing)
@ -2,5 +2,5 @@ BasedOnStyle: LLVM
|
|||||||
IndentWidth: 4
|
IndentWidth: 4
|
||||||
|
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
ColumnLimit: 0
|
ColumnLimit: 80
|
||||||
AlignConsecutiveAssignments: false
|
AlignConsecutiveAssignments: false
|
20
.clang-tidy
@ -1,5 +1,23 @@
|
|||||||
---
|
---
|
||||||
Checks: '*, -google-runtime-references, -hicpp-no-array-decay, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -fuchsia*,-readability-else-after-return,-readability-avoid-const-params-in-decls,-hicpp-signed-bitwise,-cppcoreguidelines-pro-bounds-constant-array-index,-llvm-header-guard,-readability-static-accessed-through-instance,-google-readability-todo'
|
Checks: '*,
|
||||||
|
-android-cloexec-fopen,
|
||||||
|
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||||
|
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||||
|
-fuchsia*,
|
||||||
|
-readability-else-after-return,
|
||||||
|
-readability-avoid-const-params-in-decls,
|
||||||
|
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||||
|
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||||
|
-llvm-header-guard,
|
||||||
|
-readability-static-accessed-through-instance,
|
||||||
|
-readability-braces-around-statements,
|
||||||
|
-hicpp-signed-bitwise,
|
||||||
|
-hicpp-no-array-decay,
|
||||||
|
-hicpp-braces-around-statements,
|
||||||
|
-google-runtime-references,
|
||||||
|
-google-readability-todo,
|
||||||
|
-google-readability-braces-around-statements'
|
||||||
|
|
||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
HeaderFilterRegex: '.*'
|
HeaderFilterRegex: '.*'
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
|
7
.gitignore
vendored
@ -6,6 +6,13 @@ bin/
|
|||||||
*.log
|
*.log
|
||||||
*.out
|
*.out
|
||||||
*.toc
|
*.toc
|
||||||
|
*.o
|
||||||
|
.*
|
||||||
build
|
build
|
||||||
docs/
|
docs/
|
||||||
RELEASE.txt
|
RELEASE.txt
|
||||||
|
|
||||||
|
|
||||||
|
*.pyc
|
||||||
|
*/__pycache__/*
|
||||||
|
|
||||||
|
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "python/pybind11"]
|
||||||
|
path = python/pybind11
|
||||||
|
url = https://github.com/pybind/pybind11.git
|
16
.travis.yml
@ -2,10 +2,13 @@ sudo: false
|
|||||||
|
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
matrix:
|
os: linux
|
||||||
include:
|
|
||||||
- os: linux
|
env:
|
||||||
env: CONDA_PY=3.6
|
matrix:
|
||||||
|
- CONDA_PY=3.6
|
||||||
|
- CONDA_PY=3.7
|
||||||
|
|
||||||
|
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
@ -23,6 +26,7 @@ install:
|
|||||||
- conda update conda
|
- conda update conda
|
||||||
- conda update --all
|
- conda update --all
|
||||||
- conda install conda-build anaconda-client
|
- conda install conda-build anaconda-client
|
||||||
|
- conda install conda-verify
|
||||||
|
|
||||||
# Useful for debugging any issues with conda
|
# Useful for debugging any issues with conda
|
||||||
- conda info -a
|
- conda info -a
|
||||||
@ -34,12 +38,12 @@ install:
|
|||||||
- conda-build .
|
- conda-build .
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- echo "No test scripts to be run!"
|
- CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: script
|
provider: script
|
||||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||||
on:
|
on:
|
||||||
branch: developer
|
branch: refactor
|
||||||
|
|
||||||
|
188
CMakeLists.txt
Normal file → Executable file
@ -1,76 +1,174 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
|
project(slsDetectorPackage)
|
||||||
|
set(PROJECT_VERSION 5.0.0)
|
||||||
|
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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(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
|
# Check if project is being used directly or via add_subdirectory
|
||||||
set(SLS_MASTER_PROJECT OFF)
|
set(SLS_MASTER_PROJECT OFF)
|
||||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||||
set(SLS_MASTER_PROJECT ON)
|
set(SLS_MASTER_PROJECT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option (SLS_USE_HDF5 "HDF5 File format" OFF)
|
option (SLS_USE_HDF5 "HDF5 File format" OFF)
|
||||||
option (SLS_USE_TEXTCLIENT "Text Client" OFF)
|
option (SLS_USE_TEXTCLIENT "Text Client" OFF)
|
||||||
option (SLS_USE_RECEIVER "Receiver" OFF)
|
option (SLS_USE_RECEIVER "Receiver" OFF)
|
||||||
option (SLS_USE_GUI "GUI" OFF)
|
option (SLS_USE_GUI "GUI" OFF)
|
||||||
|
option (SLS_USE_TESTS "TESTS" ON)
|
||||||
|
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" ON)
|
||||||
|
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
||||||
|
option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
#Flags to always be used
|
message(STATUS "No build type selected, default to Release")
|
||||||
# -Wno-unused-parameter should eventually be removes
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
|
||||||
# -Wno-overloaded-virtual TODO! remove warnings in refactor
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-overloaded-virtual -Wno-unused-parameter -std=c++98")
|
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
||||||
# clang does not support -Wno-misleading-indentation
|
|
||||||
# add any special clang flags
|
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
|
|
||||||
endif ()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
find_package(Qt4)
|
#Add two fake libraries to manage options
|
||||||
find_package(Qwt 6)
|
add_library(slsProjectOptions INTERFACE)
|
||||||
find_package(CBF)
|
add_library(slsProjectWarnings INTERFACE)
|
||||||
find_package(Doxygen)
|
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||||
# find_package(PNG REQUIRED)
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wno-unused-parameter #Needs to be slowly mitigated
|
||||||
|
# -Wold-style-cast
|
||||||
|
-Wnon-virtual-dtor
|
||||||
|
-Woverloaded-virtual
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Wformat=2
|
||||||
|
-Wredundant-decls
|
||||||
|
# -Wconversion
|
||||||
|
-Wdouble-promotion
|
||||||
|
|
||||||
if (SLS_USE_HDF5)
|
)
|
||||||
find_package(HDF5 1.10 COMPONENTS CXX)
|
|
||||||
endif (SLS_USE_HDF5)
|
|
||||||
|
#Testing for minimum version for compilers
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
|
||||||
|
message(FATAL_ERROR "Clang version must be at least 3.2!")
|
||||||
|
endif()
|
||||||
|
target_compile_options(slsProjectWarnings INTERFACE -Wshadow) #Clag does not warn on constructor
|
||||||
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||||
|
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
||||||
|
endif()
|
||||||
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
|
|
||||||
|
)
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||||
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
|
-Wno-misleading-indentation # mostly in rapidjson remove using clang format
|
||||||
|
-Wduplicated-cond
|
||||||
|
-Wnull-dereference )
|
||||||
|
|
||||||
|
endif()
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
||||||
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
|
-Wno-class-memaccess )
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(SLS_USE_SANITIZER)
|
||||||
|
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||||
|
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Install fake the library
|
||||||
|
install(TARGETS slsProjectOptions slsProjectWarnings
|
||||||
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
find_package(Doxygen)
|
||||||
|
find_package(ZeroMQ 4 REQUIRED)
|
||||||
|
|
||||||
|
if (SLS_USE_TESTS)
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif(SLS_USE_TESTS)
|
||||||
|
|
||||||
|
# Support library containing functionallity common to
|
||||||
|
# detector and receiver
|
||||||
|
add_subdirectory(slsSupportLib)
|
||||||
|
|
||||||
if (SLS_USE_TEXTCLIENT)
|
if (SLS_USE_TEXTCLIENT)
|
||||||
add_subdirectory(slsDetectorSoftware)
|
add_subdirectory(slsDetectorSoftware)
|
||||||
endif (SLS_USE_TEXTCLIENT)
|
endif (SLS_USE_TEXTCLIENT)
|
||||||
|
|
||||||
if (SLS_USE_RECEIVER)
|
if (SLS_USE_RECEIVER)
|
||||||
add_subdirectory(slsReceiverSoftware)
|
if (SLS_USE_HDF5)
|
||||||
add_subdirectory(manual/manual-api)
|
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
|
||||||
|
endif (SLS_USE_HDF5)
|
||||||
|
add_subdirectory(slsReceiverSoftware)
|
||||||
|
add_subdirectory(manual/manual-api)
|
||||||
endif (SLS_USE_RECEIVER)
|
endif (SLS_USE_RECEIVER)
|
||||||
|
|
||||||
|
|
||||||
if (SLS_USE_GUI)
|
if (SLS_USE_GUI)
|
||||||
if (QT4_FOUND AND QWT_FOUND)
|
find_package(Qt4 REQUIRED)
|
||||||
add_subdirectory(slsDetectorGui)
|
find_package(Qwt 6 REQUIRED)
|
||||||
endif()
|
if (QT4_FOUND AND QWT_FOUND)
|
||||||
|
add_subdirectory(slsDetectorGui)
|
||||||
|
endif()
|
||||||
endif (SLS_USE_GUI)
|
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 (CALIBRATE)
|
|
||||||
if (DEFINED ENV{ROOTSYS})
|
if (SLS_USE_INTEGRATION_TESTS)
|
||||||
find_package(ROOT)
|
add_subdirectory(integrationTests)
|
||||||
if (ROOT_FOUND)
|
endif (SLS_USE_INTEGRATION_TESTS)
|
||||||
add_subdirectory(calibrationWizards)
|
|
||||||
endif()
|
if (SLS_USE_PYTHON)
|
||||||
endif()
|
add_subdirectory(python)
|
||||||
endif(CALIBRATE)
|
endif(SLS_USE_PYTHON)
|
||||||
|
|
||||||
|
configure_file( .clang-tidy
|
||||||
|
${CMAKE_BINARY_DIR}/.clang-tidy )
|
||||||
|
|
||||||
|
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
@ -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$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(LIBRARYDIR)/sharedMemory -I$(ASM)
|
|
||||||
|
|
||||||
INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/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"
|
|
@ -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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
205
RELEASE.txt
Normal file → Executable file
@ -1,205 +0,0 @@
|
|||||||
SLS Detector Package 4.0.1 released on 08.02.2018 (Bug Fix Release)
|
|
||||||
===================================================================
|
|
||||||
|
|
||||||
|
|
||||||
This document describes the differences between 4.0.1 and 4.0.0 releases.
|
|
||||||
|
|
||||||
CONTENTS
|
|
||||||
--------
|
|
||||||
1. Topics Concerning
|
|
||||||
2. Resolved Issues
|
|
||||||
3. Known Issues
|
|
||||||
4. Firmware Requirements
|
|
||||||
5. Download, Documentation & Support
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1. Topics Concerning
|
|
||||||
====================
|
|
||||||
|
|
||||||
- Jungfrau server (new firmware mapped)
|
|
||||||
- Eiger server (measuredPeriod, reg)
|
|
||||||
- Gotthard server(ADC channel shift, ROI, 25um slave packets)
|
|
||||||
- Receiver (padding, releasing resources segfault, gappixels)
|
|
||||||
- Users class (detectorSize, ROI, versions, status)
|
|
||||||
- API (config error, ROI)
|
|
||||||
- Compile (Options prefix, static libraries, Makefile for API)
|
|
||||||
- Gui (multi module)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2. Resolved Issues
|
|
||||||
==================
|
|
||||||
|
|
||||||
Detector Server
|
|
||||||
---------------
|
|
||||||
|
|
||||||
1. (Jungfrau): Latest Jungfrau firmware release mapped.
|
|
||||||
|
|
||||||
2. (Eiger): Measured subperiod initially wrapped around 4.29s. Now, upto 42.9s.
|
|
||||||
|
|
||||||
Advanced command "reg" was writing only to right FPGA.
|
|
||||||
|
|
||||||
3. (Gotthard 25/50um): Since Gotthard only sends packet numbers, one had to
|
|
||||||
remember to take even number of images in ROI mode, if they wanted to
|
|
||||||
switch back to non ROI mode.
|
|
||||||
This is fixed now, but temporary fix involves sending an image during
|
|
||||||
configuration, which will not be captured by the receiver. Hence, it takes
|
|
||||||
longer to configure. Permanent fix will require a firmware update.
|
|
||||||
|
|
||||||
The detector output is shifted by 1 for every 32 channels. This is fixed now.
|
|
||||||
|
|
||||||
|
|
||||||
Receiver
|
|
||||||
--------
|
|
||||||
|
|
||||||
1. Receiver padding was enabled only if deactivated padding was also enabled.
|
|
||||||
Receiver padding enable and receiver deactivated padding enable are independent now.
|
|
||||||
|
|
||||||
2. Starting and stopping receiver without listening resulted in seg faults.
|
|
||||||
|
|
||||||
3. Gappixels in receiver bug fix.
|
|
||||||
|
|
||||||
|
|
||||||
Client
|
|
||||||
------
|
|
||||||
|
|
||||||
1. (Users class): DetectorSize modified to set/get ROI if ROI is only 1 in number.
|
|
||||||
|
|
||||||
Allowed setting/getting ROI at single detector level via API.
|
|
||||||
(ROI for Gotthard only). Added them to the users class as setROI and getROI.
|
|
||||||
|
|
||||||
Retrieving versions at module level is possible now.
|
|
||||||
|
|
||||||
Added "stopped" as status in getRunStatus list.
|
|
||||||
|
|
||||||
2. (API): Incorrect mac address in config file will set error flag in API and not just
|
|
||||||
print the error.
|
|
||||||
|
|
||||||
ROI possible at module level.
|
|
||||||
|
|
||||||
|
|
||||||
Compile
|
|
||||||
-------
|
|
||||||
|
|
||||||
1. CMake options now have a prefix 'SLS_'.
|
|
||||||
|
|
||||||
2. Static libraries removed.
|
|
||||||
|
|
||||||
2. slsDetectorPackage/manual/manual-api/Makefile modified to use libraries
|
|
||||||
from slsDetectorPackage/bin as the main Makefile copies the libraries there.
|
|
||||||
No effect when using CMakeFiles.
|
|
||||||
|
|
||||||
|
|
||||||
Gui
|
|
||||||
---
|
|
||||||
|
|
||||||
1. Adding multiple detectors in x and y direction incremented number of detectors
|
|
||||||
in y direction incorrectly. Effect seen only in GUI (segfault) if
|
|
||||||
detsizechan has multi detectors in both direction. Fixed.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
3. Known Issues
|
|
||||||
===============
|
|
||||||
|
|
||||||
Detector Specific
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
1. (Gotthard 25 um): Slave misses or captures an extra frame. Occurs irregularly.
|
|
||||||
|
|
||||||
2. (Gotthard 25/50um): Using ROI (2 chips, 256 channels) missses last pixel
|
|
||||||
of that ADC.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
4. Firmware Requirements
|
|
||||||
========================
|
|
||||||
|
|
||||||
Gotthard
|
|
||||||
========
|
|
||||||
Minimum compatible version : 11.01.2013
|
|
||||||
Latest compatible version : 08.02.2018 (50um and 25um Master)
|
|
||||||
09.02.2018 (25 um Slave)
|
|
||||||
Eiger
|
|
||||||
=====
|
|
||||||
Minimum compatible version : 22
|
|
||||||
Latest compatible version : 22
|
|
||||||
|
|
||||||
Jungfrau
|
|
||||||
========
|
|
||||||
Minimum compatible version : 26.02.2018
|
|
||||||
Latest compatible version : 06.12.2018
|
|
||||||
|
|
||||||
|
|
||||||
Detector Upgrade
|
|
||||||
================
|
|
||||||
Gotthard Cannot be upgraded remotely. Requires programming via USB blaster
|
|
||||||
Eiger Can be upgraded remotely via bit files
|
|
||||||
Jungfrau Can be upgraded remotely using sls_detector_put programfpga <pof>
|
|
||||||
|
|
||||||
Instructions available at
|
|
||||||
https://www.psi.ch/detectors/installation-instructions
|
|
||||||
under Detector Upgrade -> [Detector Type] -> Firmware.
|
|
||||||
|
|
||||||
|
|
||||||
Please refer to the link below for more details on the firmware versions.
|
|
||||||
https://www.psi.ch/detectors/firmware.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
5. Download, Documentation & Support
|
|
||||||
====================================
|
|
||||||
|
|
||||||
Download
|
|
||||||
--------
|
|
||||||
|
|
||||||
The Source Code (Default C++ API):
|
|
||||||
https://github.com/slsdetectorgroup/slsDetectorPackage
|
|
||||||
|
|
||||||
The Conda Lib Package:
|
|
||||||
https://github.com/slsdetectorgroup/sls_detector_lib
|
|
||||||
|
|
||||||
The Conda GUI Package:
|
|
||||||
https://github.com/slsdetectorgroup/sls_detector_gui
|
|
||||||
|
|
||||||
The Python Interface (including the package):
|
|
||||||
https://github.com/slsdetectorgroup/sls_detector
|
|
||||||
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Manual (HTML & PDF):
|
|
||||||
https://www.psi.ch/detectors/documentation
|
|
||||||
slsDetectorPackage/manual/docs/
|
|
||||||
|
|
||||||
Command Line Documentation:
|
|
||||||
manual/docs/html/slsDetectorClientDocs/index.html
|
|
||||||
manual/docs/pdf/slsDetectorClientDocs.pdf
|
|
||||||
|
|
||||||
C++ API Documentation:
|
|
||||||
manual/docs/html/slsDetectorUsersDocs/index.html
|
|
||||||
manual/docs/pdf/slsDetectorUsersDocs.pdf
|
|
||||||
|
|
||||||
C++ API Example:
|
|
||||||
manual/manual-api/mainClient.cpp
|
|
||||||
manual/manual-api/mainReceiver.cpp
|
|
||||||
|
|
||||||
Python API Documentation:
|
|
||||||
https://slsdetectorgroup.github.io/sls_detector/
|
|
||||||
|
|
||||||
Further Documentation:
|
|
||||||
https://www.psi.ch/detectors/users-support
|
|
||||||
|
|
||||||
|
|
||||||
Support
|
|
||||||
-------
|
|
||||||
|
|
||||||
General Software related:
|
|
||||||
dhanya.thattil@psi.ch
|
|
||||||
anna.bergamaschi@psi.ch
|
|
||||||
|
|
||||||
Python related:
|
|
||||||
erik.frojdh@psi.ch
|
|
||||||
|
|
14934
catch/catch.hpp
Executable file
@ -1 +0,0 @@
|
|||||||
rm /dev/shm/slsDetectorPackage*;
|
|
175
cmake/Catch.cmake
Executable file
@ -0,0 +1,175 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
Catch
|
||||||
|
-----
|
||||||
|
|
||||||
|
This module defines a function to help use the Catch test framework.
|
||||||
|
|
||||||
|
The :command:`catch_discover_tests` discovers tests by asking the compiled test
|
||||||
|
executable to enumerate its tests. This does not require CMake to be re-run
|
||||||
|
when tests change. However, it may not work in a cross-compiling environment,
|
||||||
|
and setting test properties is less convenient.
|
||||||
|
|
||||||
|
This command is intended to replace use of :command:`add_test` to register
|
||||||
|
tests, and will create a separate CTest test for each Catch test case. Note
|
||||||
|
that this is in some cases less efficient, as common set-up and tear-down logic
|
||||||
|
cannot be shared by multiple test cases executing in the same instance.
|
||||||
|
However, it provides more fine-grained pass/fail information to CTest, which is
|
||||||
|
usually considered as more beneficial. By default, the CTest test name is the
|
||||||
|
same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||||
|
|
||||||
|
.. command:: catch_discover_tests
|
||||||
|
|
||||||
|
Automatically add tests with CTest by querying the compiled test executable
|
||||||
|
for available tests::
|
||||||
|
|
||||||
|
catch_discover_tests(target
|
||||||
|
[TEST_SPEC arg1...]
|
||||||
|
[EXTRA_ARGS arg1...]
|
||||||
|
[WORKING_DIRECTORY dir]
|
||||||
|
[TEST_PREFIX prefix]
|
||||||
|
[TEST_SUFFIX suffix]
|
||||||
|
[PROPERTIES name1 value1...]
|
||||||
|
[TEST_LIST var]
|
||||||
|
)
|
||||||
|
|
||||||
|
``catch_discover_tests`` sets up a post-build command on the test executable
|
||||||
|
that generates the list of tests by parsing the output from running the test
|
||||||
|
with the ``--list-test-names-only`` argument. This ensures that the full
|
||||||
|
list of tests is obtained. Since test discovery occurs at build time, it is
|
||||||
|
not necessary to re-run CMake when the list of tests changes.
|
||||||
|
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
||||||
|
in order to function in a cross-compiling environment.
|
||||||
|
|
||||||
|
Additionally, setting properties on tests is somewhat less convenient, since
|
||||||
|
the tests are not available at CMake time. Additional test properties may be
|
||||||
|
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
||||||
|
more fine-grained test control is needed, custom content may be provided
|
||||||
|
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
||||||
|
directory property. The set of discovered tests is made accessible to such a
|
||||||
|
script via the ``<target>_TESTS`` variable.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``target``
|
||||||
|
Specifies the Catch executable, which must be a known CMake executable
|
||||||
|
target. CMake will substitute the location of the built executable when
|
||||||
|
running the test.
|
||||||
|
|
||||||
|
``TEST_SPEC arg1...``
|
||||||
|
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||||
|
pass to the Catch executable with the ``--list-test-names-only`` argument.
|
||||||
|
|
||||||
|
``EXTRA_ARGS arg1...``
|
||||||
|
Any extra arguments to pass on the command line to each test case.
|
||||||
|
|
||||||
|
``WORKING_DIRECTORY dir``
|
||||||
|
Specifies the directory in which to run the discovered test cases. If this
|
||||||
|
option is not provided, the current binary directory is used.
|
||||||
|
|
||||||
|
``TEST_PREFIX prefix``
|
||||||
|
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
||||||
|
case. This can be useful when the same test executable is being used in
|
||||||
|
multiple calls to ``catch_discover_tests()`` but with different
|
||||||
|
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
||||||
|
|
||||||
|
``TEST_SUFFIX suffix``
|
||||||
|
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
||||||
|
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
||||||
|
be specified.
|
||||||
|
|
||||||
|
``PROPERTIES name1 value1...``
|
||||||
|
Specifies additional properties to be set on all tests discovered by this
|
||||||
|
invocation of ``catch_discover_tests``.
|
||||||
|
|
||||||
|
``TEST_LIST var``
|
||||||
|
Make the list of tests available in the variable ``var``, rather than the
|
||||||
|
default ``<target>_TESTS``. This can be useful when the same test
|
||||||
|
executable is being used in multiple calls to ``catch_discover_tests()``.
|
||||||
|
Note that this variable is only available in CTest.
|
||||||
|
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
function(catch_discover_tests TARGET)
|
||||||
|
cmake_parse_arguments(
|
||||||
|
""
|
||||||
|
""
|
||||||
|
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
|
||||||
|
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _WORKING_DIRECTORY)
|
||||||
|
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endif()
|
||||||
|
if(NOT _TEST_LIST)
|
||||||
|
set(_TEST_LIST ${TARGET}_TESTS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## Generate a unique name based on the extra arguments
|
||||||
|
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
|
||||||
|
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||||
|
|
||||||
|
# Define rule to generate test list for aforementioned test executable
|
||||||
|
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
||||||
|
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
||||||
|
get_property(crosscompiling_emulator
|
||||||
|
TARGET ${TARGET}
|
||||||
|
PROPERTY CROSSCOMPILING_EMULATOR
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET} POST_BUILD
|
||||||
|
BYPRODUCTS "${ctest_tests_file}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-D "TEST_TARGET=${TARGET}"
|
||||||
|
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
||||||
|
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
||||||
|
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
||||||
|
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||||
|
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||||
|
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||||
|
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||||
|
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||||
|
-D "TEST_LIST=${_TEST_LIST}"
|
||||||
|
-D "CTEST_FILE=${ctest_tests_file}"
|
||||||
|
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
file(WRITE "${ctest_include_file}"
|
||||||
|
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||||
|
" include(\"${ctest_tests_file}\")\n"
|
||||||
|
"else()\n"
|
||||||
|
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
||||||
|
"endif()\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||||
|
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||||
|
set_property(DIRECTORY
|
||||||
|
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||||
|
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||||
|
if (NOT ${test_include_file_set})
|
||||||
|
set_property(DIRECTORY
|
||||||
|
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Cannot set more than one TEST_INCLUDE_FILE"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
set(_CATCH_DISCOVER_TESTS_SCRIPT
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
|
||||||
|
)
|
78
cmake/CatchAddTests.cmake
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
set(prefix "${TEST_PREFIX}")
|
||||||
|
set(suffix "${TEST_SUFFIX}")
|
||||||
|
set(spec ${TEST_SPEC})
|
||||||
|
set(extra_args ${TEST_EXTRA_ARGS})
|
||||||
|
set(properties ${TEST_PROPERTIES})
|
||||||
|
set(script)
|
||||||
|
set(suite)
|
||||||
|
set(tests)
|
||||||
|
|
||||||
|
function(add_command NAME)
|
||||||
|
set(_args "")
|
||||||
|
foreach(_arg ${ARGN})
|
||||||
|
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||||
|
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||||
|
else()
|
||||||
|
set(_args "${_args} ${_arg}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Run test executable to get list of available tests
|
||||||
|
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
|
||||||
|
OUTPUT_VARIABLE output
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
||||||
|
if(${result} EQUAL 0)
|
||||||
|
message(WARNING
|
||||||
|
"Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
|
||||||
|
)
|
||||||
|
elseif(${result} LESS 0)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||||
|
" Result: ${result}\n"
|
||||||
|
" Output: ${output}\n"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "\n" ";" output "${output}")
|
||||||
|
|
||||||
|
# Parse output
|
||||||
|
foreach(line ${output})
|
||||||
|
set(test ${line})
|
||||||
|
# use escape commas to handle properly test cases with commans inside the name
|
||||||
|
string(REPLACE "," "\\," test_name ${test})
|
||||||
|
# ...and add to script
|
||||||
|
add_command(add_test
|
||||||
|
"${prefix}${test}${suffix}"
|
||||||
|
${TEST_EXECUTOR}
|
||||||
|
"${TEST_EXECUTABLE}"
|
||||||
|
"${test_name}"
|
||||||
|
${extra_args}
|
||||||
|
)
|
||||||
|
add_command(set_tests_properties
|
||||||
|
"${prefix}${test}${suffix}"
|
||||||
|
PROPERTIES
|
||||||
|
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||||
|
${properties}
|
||||||
|
)
|
||||||
|
list(APPEND tests "${prefix}${test}${suffix}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Create a list of all discovered tests, which users may use to e.g. set
|
||||||
|
# properties on the tests
|
||||||
|
add_command(set ${TEST_LIST} ${tests})
|
||||||
|
|
||||||
|
# Write CTest script
|
||||||
|
file(WRITE "${CTEST_FILE}" "${script}")
|
0
cmake/FindCBF.cmake
Normal file → Executable file
0
cmake/FindQwt.cmake
Normal file → Executable file
0
cmake/FindROOT.cmake
Normal file → Executable file
112
cmake/FindZeroMQ.cmake
Executable file
@ -0,0 +1,112 @@
|
|||||||
|
|
||||||
|
# This file is originally from https://github.com/zeromq/azmq and distributed
|
||||||
|
# under Boost Software Lincese 1.0
|
||||||
|
# Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
# obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
# this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
# execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
# Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
# do so, all subject to the following:
|
||||||
|
|
||||||
|
# The copyright notices in the Software and this entire statement, including
|
||||||
|
# the above license grant, this restriction and the following disclaimer,
|
||||||
|
# must be included in all copies of the Software, in whole or in part, and
|
||||||
|
# all derivative works of the Software, unless such copies or derivative
|
||||||
|
# works are solely in the form of machine-executable object code generated by
|
||||||
|
# a source language processor.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
# DEALINGS IN THE SOFTWARE.
|
||||||
|
# --------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Find ZeroMQ Headers/Libs
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
# ZMQ_ROOT - set this to a location where ZeroMQ may be found
|
||||||
|
#
|
||||||
|
# ZeroMQ_FOUND - True of ZeroMQ found
|
||||||
|
# ZeroMQ_INCLUDE_DIRS - Location of ZeroMQ includes
|
||||||
|
# ZeroMQ_LIBRARIES - ZeroMQ libraries
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
if (NOT ZMQ_ROOT)
|
||||||
|
set(ZMQ_ROOT "$ENV{ZMQ_ROOT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT ZMQ_ROOT)
|
||||||
|
find_path(_ZeroMQ_ROOT NAMES include/zmq.h)
|
||||||
|
else()
|
||||||
|
set(_ZeroMQ_ROOT "${ZMQ_ROOT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(ZeroMQ_INCLUDE_DIRS NAMES zmq.h HINTS ${_ZeroMQ_ROOT}/include)
|
||||||
|
|
||||||
|
if (ZeroMQ_INCLUDE_DIRS)
|
||||||
|
set(_ZeroMQ_H ${ZeroMQ_INCLUDE_DIRS}/zmq.h)
|
||||||
|
|
||||||
|
function(_zmqver_EXTRACT _ZeroMQ_VER_COMPONENT _ZeroMQ_VER_OUTPUT)
|
||||||
|
set(CMAKE_MATCH_1 "0")
|
||||||
|
set(_ZeroMQ_expr "^[ \\t]*#define[ \\t]+${_ZeroMQ_VER_COMPONENT}[ \\t]+([0-9]+)$")
|
||||||
|
file(STRINGS "${_ZeroMQ_H}" _ZeroMQ_ver REGEX "${_ZeroMQ_expr}")
|
||||||
|
string(REGEX MATCH "${_ZeroMQ_expr}" ZeroMQ_ver "${_ZeroMQ_ver}")
|
||||||
|
set(${_ZeroMQ_VER_OUTPUT} "${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
_zmqver_EXTRACT("ZMQ_VERSION_MAJOR" ZeroMQ_VERSION_MAJOR)
|
||||||
|
_zmqver_EXTRACT("ZMQ_VERSION_MINOR" ZeroMQ_VERSION_MINOR)
|
||||||
|
_zmqver_EXTRACT("ZMQ_VERSION_PATCH" ZeroMQ_VERSION_PATCH)
|
||||||
|
|
||||||
|
message(STATUS "ZeroMQ version: ${ZeroMQ_VERSION_MAJOR}.${ZeroMQ_VERSION_MINOR}.${ZeroMQ_VERSION_PATCH}")
|
||||||
|
|
||||||
|
# We should provide version to find_package_handle_standard_args in the same format as it was requested,
|
||||||
|
# otherwise it can't check whether version matches exactly.
|
||||||
|
if (ZeroMQ_FIND_VERSION_COUNT GREATER 2)
|
||||||
|
set(ZeroMQ_VERSION "${ZeroMQ_VERSION_MAJOR}.${ZeroMQ_VERSION_MINOR}.${ZeroMQ_VERSION_PATCH}")
|
||||||
|
else()
|
||||||
|
# User has requested ZeroMQ version without patch part => user is not interested in specific patch =>
|
||||||
|
# any patch should be an exact match.
|
||||||
|
set(ZeroMQ_VERSION "${ZeroMQ_VERSION_MAJOR}.${ZeroMQ_VERSION_MINOR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT ${CMAKE_CXX_PLATFORM_ID} STREQUAL "Windows")
|
||||||
|
find_library(ZeroMQ_LIBRARIES NAMES zmq HINTS ${_ZeroMQ_ROOT}/lib)
|
||||||
|
else()
|
||||||
|
find_library(
|
||||||
|
ZeroMQ_LIBRARY_RELEASE
|
||||||
|
NAMES
|
||||||
|
libzmq
|
||||||
|
"libzmq-${CMAKE_VS_PLATFORM_TOOLSET}-mt-${ZeroMQ_VERSION_MAJOR}_${ZeroMQ_VERSION_MINOR}_${ZeroMQ_VERSION_PATCH}"
|
||||||
|
HINTS
|
||||||
|
${_ZeroMQ_ROOT}/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
ZeroMQ_LIBRARY_DEBUG
|
||||||
|
NAMES
|
||||||
|
libzmq_d
|
||||||
|
"libzmq-${CMAKE_VS_PLATFORM_TOOLSET}-mt-gd-${ZeroMQ_VERSION_MAJOR}_${ZeroMQ_VERSION_MINOR}_${ZeroMQ_VERSION_PATCH}"
|
||||||
|
HINTS
|
||||||
|
${_ZeroMQ_ROOT}/lib)
|
||||||
|
|
||||||
|
# On Windows we have to use corresponding version (i.e. Release or Debug) of ZeroMQ because of `errno` CRT global variable
|
||||||
|
# See more at http://www.drdobbs.com/avoiding-the-visual-c-runtime-library/184416623
|
||||||
|
set(ZeroMQ_LIBRARIES optimized "${ZeroMQ_LIBRARY_RELEASE}" debug "${ZeroMQ_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package_handle_standard_args(ZeroMQ FOUND_VAR ZeroMQ_FOUND
|
||||||
|
REQUIRED_VARS ZeroMQ_INCLUDE_DIRS ZeroMQ_LIBRARIES
|
||||||
|
VERSION_VAR ZeroMQ_VERSION)
|
||||||
|
|
||||||
|
if (ZeroMQ_FOUND)
|
||||||
|
mark_as_advanced(ZeroMQ_INCLUDE_DIRS ZeroMQ_LIBRARIES ZeroMQ_VERSION
|
||||||
|
ZeroMQ_VERSION_MAJOR ZeroMQ_VERSION_MINOR ZeroMQ_VERSION_PATCH)
|
||||||
|
endif()
|
203
cmake/ParseAndAddCatchTests.cmake
Executable file
@ -0,0 +1,203 @@
|
|||||||
|
#==================================================================================================#
|
||||||
|
# supported macros #
|
||||||
|
# - TEST_CASE, #
|
||||||
|
# - SCENARIO, #
|
||||||
|
# - TEST_CASE_METHOD, #
|
||||||
|
# - CATCH_TEST_CASE, #
|
||||||
|
# - CATCH_SCENARIO, #
|
||||||
|
# - CATCH_TEST_CASE_METHOD. #
|
||||||
|
# #
|
||||||
|
# Usage #
|
||||||
|
# 1. make sure this module is in the path or add this otherwise: #
|
||||||
|
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||||
|
# 2. make sure that you've enabled testing option for the project by the call: #
|
||||||
|
# enable_testing() #
|
||||||
|
# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
|
||||||
|
# project(testing_target) #
|
||||||
|
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||||
|
# enable_testing() #
|
||||||
|
# #
|
||||||
|
# find_path(CATCH_INCLUDE_DIR "catch.hpp") #
|
||||||
|
# include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR}) #
|
||||||
|
# #
|
||||||
|
# file(GLOB SOURCE_FILES "*.cpp") #
|
||||||
|
# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
|
||||||
|
# #
|
||||||
|
# include(ParseAndAddCatchTests) #
|
||||||
|
# ParseAndAddCatchTests(${PROJECT_NAME}) #
|
||||||
|
# #
|
||||||
|
# The following variables affect the behavior of the script: #
|
||||||
|
# #
|
||||||
|
# PARSE_CATCH_TESTS_VERBOSE (Default OFF) #
|
||||||
|
# -- enables debug messages #
|
||||||
|
# PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF) #
|
||||||
|
# -- excludes tests marked with [!hide], [.] or [.foo] tags #
|
||||||
|
# PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON) #
|
||||||
|
# -- adds fixture class name to the test name #
|
||||||
|
# PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON) #
|
||||||
|
# -- adds cmake target name to the test name #
|
||||||
|
# PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF) #
|
||||||
|
# -- causes CMake to rerun when file with tests changes so that new tests will be discovered #
|
||||||
|
# #
|
||||||
|
# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way #
|
||||||
|
# a test should be run. For instance to use test MPI, one can write #
|
||||||
|
# set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) #
|
||||||
|
# just before calling this ParseAndAddCatchTests function #
|
||||||
|
# #
|
||||||
|
#==================================================================================================#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.8.8)
|
||||||
|
|
||||||
|
option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
|
||||||
|
option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
|
||||||
|
option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
|
||||||
|
option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
|
||||||
|
option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
|
||||||
|
|
||||||
|
function(PrintDebugMessage)
|
||||||
|
if(PARSE_CATCH_TESTS_VERBOSE)
|
||||||
|
message(STATUS "ParseAndAddCatchTests: ${ARGV}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# This removes the contents between
|
||||||
|
# - block comments (i.e. /* ... */)
|
||||||
|
# - full line comments (i.e. // ... )
|
||||||
|
# contents have been read into '${CppCode}'.
|
||||||
|
# !keep partial line comments
|
||||||
|
function(RemoveComments CppCode)
|
||||||
|
string(ASCII 2 CMakeBeginBlockComment)
|
||||||
|
string(ASCII 3 CMakeEndBlockComment)
|
||||||
|
string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
|
||||||
|
string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
|
||||||
|
string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
|
||||||
|
string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
|
||||||
|
|
||||||
|
set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Worker function
|
||||||
|
function(ParseFile SourceFile TestTarget)
|
||||||
|
# According to CMake docs EXISTS behavior is well-defined only for full paths.
|
||||||
|
get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
|
||||||
|
if(NOT EXISTS ${SourceFile})
|
||||||
|
message(WARNING "Cannot find source file: ${SourceFile}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
PrintDebugMessage("parsing ${SourceFile}")
|
||||||
|
file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
|
||||||
|
|
||||||
|
# Remove block and fullline comments
|
||||||
|
RemoveComments(Contents)
|
||||||
|
|
||||||
|
# Find definition of test names
|
||||||
|
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^\)]+\\)+[ \t\n]*{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
|
||||||
|
|
||||||
|
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
|
||||||
|
PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
||||||
|
set_property(
|
||||||
|
DIRECTORY
|
||||||
|
APPEND
|
||||||
|
PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(TestName ${Tests})
|
||||||
|
# Strip newlines
|
||||||
|
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
||||||
|
|
||||||
|
# Get test type and fixture if applicable
|
||||||
|
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
||||||
|
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
|
||||||
|
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
||||||
|
|
||||||
|
# Get string parts of test definition
|
||||||
|
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
|
||||||
|
|
||||||
|
# Strip wrapping quotation marks
|
||||||
|
string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
|
||||||
|
string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
|
||||||
|
|
||||||
|
# Validate that a test name and tags have been provided
|
||||||
|
list(LENGTH TestStrings TestStringsLength)
|
||||||
|
if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
|
||||||
|
message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Assign name and tags
|
||||||
|
list(GET TestStrings 0 Name)
|
||||||
|
if("${TestType}" STREQUAL "SCENARIO")
|
||||||
|
set(Name "Scenario: ${Name}")
|
||||||
|
endif()
|
||||||
|
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture)
|
||||||
|
set(CTestName "${TestFixture}:${Name}")
|
||||||
|
else()
|
||||||
|
set(CTestName "${Name}")
|
||||||
|
endif()
|
||||||
|
if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
|
||||||
|
set(CTestName "${TestTarget}:${CTestName}")
|
||||||
|
endif()
|
||||||
|
# add target to labels to enable running all tests added from this target
|
||||||
|
set(Labels ${TestTarget})
|
||||||
|
if(TestStringsLength EQUAL 2)
|
||||||
|
list(GET TestStrings 1 Tags)
|
||||||
|
string(TOLOWER "${Tags}" Tags)
|
||||||
|
# remove target from labels if the test is hidden
|
||||||
|
if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
|
||||||
|
list(REMOVE_ITEM Labels ${TestTarget})
|
||||||
|
endif()
|
||||||
|
string(REPLACE "]" ";" Tags "${Tags}")
|
||||||
|
string(REPLACE "[" "" Tags "${Tags}")
|
||||||
|
else()
|
||||||
|
# unset tags variable from previous loop
|
||||||
|
unset(Tags)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND Labels ${Tags})
|
||||||
|
|
||||||
|
list(FIND Labels "!hide" IndexOfHideLabel)
|
||||||
|
set(HiddenTagFound OFF)
|
||||||
|
foreach(label ${Labels})
|
||||||
|
string(REGEX MATCH "^!hide|^\\." result ${label})
|
||||||
|
if(result)
|
||||||
|
set(HiddenTagFound ON)
|
||||||
|
break()
|
||||||
|
endif(result)
|
||||||
|
endforeach(label)
|
||||||
|
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
|
||||||
|
PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
|
||||||
|
else()
|
||||||
|
PrintDebugMessage("Adding test \"${CTestName}\"")
|
||||||
|
if(Labels)
|
||||||
|
PrintDebugMessage("Setting labels to ${Labels}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Escape commas in the test spec
|
||||||
|
string(REPLACE "," "\\," Name ${Name})
|
||||||
|
|
||||||
|
# Add the test and set its properties
|
||||||
|
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} ${TestTarget} ${Name} ${AdditionalCatchParameters})
|
||||||
|
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
|
||||||
|
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
||||||
|
PrintDebugMessage("Setting DISABLED test property")
|
||||||
|
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
|
||||||
|
else()
|
||||||
|
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||||
|
LABELS "${Labels}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# entry point
|
||||||
|
function(ParseAndAddCatchTests TestTarget)
|
||||||
|
PrintDebugMessage("Started parsing ${TestTarget}")
|
||||||
|
get_target_property(SourceFiles ${TestTarget} SOURCES)
|
||||||
|
PrintDebugMessage("Found the following sources: ${SourceFiles}")
|
||||||
|
foreach(SourceFile ${SourceFiles})
|
||||||
|
ParseFile(${SourceFile} ${TestTarget})
|
||||||
|
endforeach()
|
||||||
|
PrintDebugMessage("Finished parsing ${TestTarget}")
|
||||||
|
endfunction()
|
31
cmake/package_config.cmake
Executable 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 ()
|
24
cmake/project-config.cmake.in
Executable 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@")
|
14
cmake/project_version.cc.in
Executable 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
Executable 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)
|
34
cmake/project_version.h.in
Executable 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
|
5
cmk.sh
@ -116,7 +116,8 @@ done
|
|||||||
|
|
||||||
|
|
||||||
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
|
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
|
||||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
|
#CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
|
||||||
|
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=OFF "
|
||||||
echo "Compile Option: TextClient, Receiver and GUI"
|
echo "Compile Option: TextClient, Receiver and GUI"
|
||||||
else
|
else
|
||||||
if [ $TEXTCLIENT -eq 1 ]; then
|
if [ $TEXTCLIENT -eq 1 ]; then
|
||||||
@ -177,7 +178,7 @@ echo "in "$PWD
|
|||||||
#cmake
|
#cmake
|
||||||
if [ $REBUILD -eq 1 ]; then
|
if [ $REBUILD -eq 1 ]; then
|
||||||
rm -f CMakeCache.txt
|
rm -f CMakeCache.txt
|
||||||
BUILDCOMMAND="$CMAKE_PRE cmake $CMAKE_POST .."
|
BUILDCOMMAND="$CMAKE_PRE cmake3 $CMAKE_POST .."
|
||||||
echo $BUILDCOMMAND
|
echo $BUILDCOMMAND
|
||||||
eval $BUILDCOMMAND
|
eval $BUILDCOMMAND
|
||||||
fi
|
fi
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
sh updateSvnVersion.sh
|
|
||||||
|
|
||||||
cd slsDetectorGui
|
|
||||||
git commit -a -m "updating versions"
|
|
||||||
git push origin developer:developer
|
|
||||||
|
|
||||||
cd ../slsDetectorSoftware
|
|
||||||
git commit -a -m "updating versions"
|
|
||||||
git push origin developer:developer
|
|
||||||
|
|
||||||
cd ../slsReceiverSoftware
|
|
||||||
git commit -a -m "updating versions"
|
|
||||||
git push origin developer:developer
|
|
||||||
|
|
||||||
cd ..
|
|
8
recipe/build.sh → conda-recepie/build.sh
Normal file → Executable file
@ -6,10 +6,14 @@ cmake .. \
|
|||||||
-DCMAKE_INSTALL_PREFIX=install \
|
-DCMAKE_INSTALL_PREFIX=install \
|
||||||
-DSLS_USE_TEXTCLIENT=ON \
|
-DSLS_USE_TEXTCLIENT=ON \
|
||||||
-DSLS_USE_RECEIVER=ON \
|
-DSLS_USE_RECEIVER=ON \
|
||||||
-DSLS_USE_GUI=ON \
|
-DSLS_USE_GUI=OFF \
|
||||||
|
-DSLS_USE_TESTS=ON \
|
||||||
|
-DSLS_USE_PYTHON=OFF \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DSLS_USE_HDF5=OFF\
|
-DSLS_USE_HDF5=OFF\
|
||||||
|
|
||||||
|
|
||||||
cmake --build . -- -j10
|
cmake --build . -- -j10
|
||||||
cmake --build . --target install
|
cmake --build . --target install
|
||||||
|
|
||||||
|
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
14
conda-recepie/build_pylib.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
# mkdir $PREFIX/lib
|
||||||
|
# mkdir $PREFIX/include
|
||||||
|
|
||||||
|
|
||||||
|
# #Shared and static libraries
|
||||||
|
# cp build/bin/_sls_detector* $PREFIX/lib/.
|
||||||
|
|
||||||
|
|
||||||
|
# #Binaries
|
||||||
|
# cp -r build/bin/sls_detector $PREFIX/lib/.
|
||||||
|
|
||||||
|
cd python
|
||||||
|
${PYTHON} setup.py install
|
0
recipe/copy_gui.sh → conda-recepie/copy_gui.sh
Normal file → Executable file
3
recipe/copy_lib.sh → conda-recepie/copy_lib.sh
Normal file → Executable file
@ -6,9 +6,8 @@ mkdir $PREFIX/include/slsDetectorPackage
|
|||||||
|
|
||||||
#Shared and static libraries
|
#Shared and static libraries
|
||||||
cp build/bin/libSlsDetector.so $PREFIX/lib/.
|
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.so $PREFIX/lib/.
|
||||||
cp build/bin/libSlsReceiver.a $PREFIX/lib/.
|
cp build/bin/libSlsSupport.so $PREFIX/lib/.
|
||||||
|
|
||||||
#Binaries
|
#Binaries
|
||||||
cp build/bin/sls_detector_acquire $PREFIX/bin/.
|
cp build/bin/sls_detector_acquire $PREFIX/bin/.
|
120
conda-recepie/meta.yaml
Executable file
@ -0,0 +1,120 @@
|
|||||||
|
|
||||||
|
package:
|
||||||
|
name: sls_detector_software
|
||||||
|
version: "refactor"
|
||||||
|
|
||||||
|
source:
|
||||||
|
- path: ..
|
||||||
|
|
||||||
|
build:
|
||||||
|
number: 0
|
||||||
|
rpaths:
|
||||||
|
- lib/
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
build:
|
||||||
|
- {{ compiler('c') }}
|
||||||
|
- {{compiler('cxx')}}
|
||||||
|
- cmake
|
||||||
|
- qwt 6.*
|
||||||
|
- qt=4.8.7=7
|
||||||
|
- zeromq=4.2.5=hfc679d8_5
|
||||||
|
- pyzmq
|
||||||
|
- xorg-libx11
|
||||||
|
- xorg-libice
|
||||||
|
- xorg-libxext
|
||||||
|
- xorg-libsm
|
||||||
|
- xorg-libxau
|
||||||
|
- xorg-libxrender
|
||||||
|
- xorg-libxfixes
|
||||||
|
- {{ cdt('mesa-libgl-devel') }} # [linux]
|
||||||
|
- {{ cdt('mesa-libegl-devel') }} # [linux]
|
||||||
|
- {{ cdt('mesa-dri-drivers') }} # [linux]
|
||||||
|
- {{ cdt('libselinux') }} # [linux]
|
||||||
|
- {{ cdt('libxdamage') }} # [linux]
|
||||||
|
- {{ cdt('libxxf86vm') }} # [linux]
|
||||||
|
|
||||||
|
host:
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
- xorg-libx11
|
||||||
|
- xorg-libice
|
||||||
|
- xorg-libxext
|
||||||
|
- xorg-libsm
|
||||||
|
- xorg-libxau
|
||||||
|
- xorg-libxrender
|
||||||
|
- xorg-libxfixes
|
||||||
|
|
||||||
|
run:
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
- name: sls_detector_lib
|
||||||
|
script: copy_lib.sh
|
||||||
|
|
||||||
|
- name: sls_detector
|
||||||
|
script: build_pylib.sh
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
build:
|
||||||
|
- {{ compiler('c') }}
|
||||||
|
- {{compiler('cxx')}}
|
||||||
|
- python {{ python }}
|
||||||
|
- setuptools
|
||||||
|
- sls_detector_lib
|
||||||
|
- pyzmq
|
||||||
|
- pybind11 2.2
|
||||||
|
host:
|
||||||
|
- python
|
||||||
|
- pybind11 2.2
|
||||||
|
- pyzmq
|
||||||
|
- sls_detector_lib
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
run:
|
||||||
|
- python
|
||||||
|
- numpy
|
||||||
|
- sls_detector_lib=refactor
|
||||||
|
- pyzmq
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
test:
|
||||||
|
imports:
|
||||||
|
- sls_detector
|
||||||
|
|
||||||
|
# requirements:
|
||||||
|
# build:
|
||||||
|
# - {{ compiler('c') }}
|
||||||
|
# - {{compiler('cxx')}}
|
||||||
|
|
||||||
|
# - name: sls_detector_gui
|
||||||
|
# version: "refactor"
|
||||||
|
# script: copy_gui.sh
|
||||||
|
# requirements:
|
||||||
|
# build:
|
||||||
|
# - {{ compiler('c') }}
|
||||||
|
# - {{compiler('cxx')}}
|
||||||
|
# - cmake
|
||||||
|
# - qwt 6.*
|
||||||
|
# - qt=4.8.7=7
|
||||||
|
# - zeromq=4.2.5=hfc679d8_5
|
||||||
|
# - pyzmq
|
||||||
|
# - xorg-libx11
|
||||||
|
# - xorg-libice
|
||||||
|
# - xorg-libxext
|
||||||
|
# - xorg-libsm
|
||||||
|
# - xorg-libxau
|
||||||
|
# - xorg-libxrender
|
||||||
|
# - xorg-libxfixes
|
||||||
|
# - {{ cdt('mesa-libgl-devel') }} # [linux]
|
||||||
|
# - {{ cdt('mesa-libegl-devel') }} # [linux]
|
||||||
|
# - {{ cdt('mesa-dri-drivers') }} # [linux]
|
||||||
|
# - {{ cdt('libselinux') }} # [linux]
|
||||||
|
# - {{ cdt('libxdamage') }} # [linux]
|
||||||
|
# - {{ cdt('libxxf86vm') }} # [linux]
|
||||||
|
# run:
|
||||||
|
# - sls_detector_lib=refactor
|
||||||
|
# - qwt 6.*
|
||||||
|
# - qt=4.8.7=7
|
1
conda-recepie/run_test.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
ctest -j2
|
0
evalVersionVariables.sh
Normal file → Executable file
0
examples/bad.chans
Normal file → Executable file
@ -1,61 +0,0 @@
|
|||||||
detsizechan 2560 1
|
|
||||||
|
|
||||||
hostname bchip074+bchip075+
|
|
||||||
|
|
||||||
#replace my_installation_path
|
|
||||||
settingsdir /my_installation_path/slsDetectorPackage/settingsdir/gotthard
|
|
||||||
caldir /my_installation_path/slsDetectorPackage/settingsdir/gotthard
|
|
||||||
|
|
||||||
0:extsig:0 trigger_in_rising_edge
|
|
||||||
0:rx_tcpport 1954
|
|
||||||
0:rx_udpport 50001
|
|
||||||
0:vhighvoltage 0
|
|
||||||
|
|
||||||
1:extsig:0 trigger_in_rising_edge
|
|
||||||
1:rx_tcpport 1955
|
|
||||||
1:rx_udpport 50002
|
|
||||||
#1:detectorip 10.1.1.52
|
|
||||||
1:vhighvoltage 0
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
#########
|
|
||||||
######### Uncomment this part to use the gotthard25umZmq process
|
|
||||||
#########
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
|
|
||||||
#0:rx_zmqip my_receiver_hostname
|
|
||||||
#0:rx_zmqport 30003
|
|
||||||
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
|
|
||||||
#0:zmqip my_client_hostname
|
|
||||||
#0:zmqport 40003
|
|
||||||
|
|
||||||
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
|
|
||||||
#1:rx_zmqip my_receiver_hostname
|
|
||||||
#1:rx_zmqport 30004
|
|
||||||
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
|
|
||||||
#1:zmqip my_client_hostname
|
|
||||||
#1:zmqport 40004
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
#########
|
|
||||||
######### until here
|
|
||||||
#########
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
|
|
||||||
r_readfreq 1
|
|
||||||
rx_datastream 1
|
|
||||||
|
|
||||||
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
|
|
||||||
rx_hostname my_receiver_hostname
|
|
||||||
rx_datastream 1
|
|
||||||
outdir /tmp/
|
|
||||||
angconv none
|
|
||||||
threaded 1
|
|
||||||
|
|
||||||
settings veryhighgain
|
|
||||||
exptime 0.000005
|
|
||||||
period 0.0001
|
|
||||||
|
|
||||||
vhighvoltage 90
|
|
0
examples/config_gen_script/beb_31_25.config_gen
Normal file → Executable file
0
examples/config_gen_script/eiger_2m_1gb.config_gen
Normal file → Executable file
0
examples/eiger_10Gb.config
Normal file → Executable file
0
examples/eiger_1Gb.config
Normal file → Executable file
0
examples/gotthard.config
Normal file → Executable file
0
examples/gotthard_setup.det
Normal file → Executable file
10
examples/bchip2modules.config → examples/gotthard_two.config
Normal file → Executable file
@ -2,9 +2,6 @@ detsizechan 2560 1
|
|||||||
|
|
||||||
hostname bchip074+bchip075+
|
hostname bchip074+bchip075+
|
||||||
|
|
||||||
#replace my_installation_path
|
|
||||||
settingsdir /my_installation_path/slsDetectorPackage/settingsdir/gotthard
|
|
||||||
caldir /my_installation_path/slsDetectorPackage/settingsdir/gotthard
|
|
||||||
|
|
||||||
0:extsig:0 trigger_in_rising_edge
|
0:extsig:0 trigger_in_rising_edge
|
||||||
0:rx_tcpport 1954
|
0:rx_tcpport 1954
|
||||||
@ -14,7 +11,6 @@ caldir /my_installation_path/slsDetectorPackage/settingsdir/gotthard
|
|||||||
1:extsig:0 trigger_in_rising_edge
|
1:extsig:0 trigger_in_rising_edge
|
||||||
1:rx_tcpport 1955
|
1:rx_tcpport 1955
|
||||||
1:rx_udpport 50002
|
1:rx_udpport 50002
|
||||||
#1:detectorip 10.1.1.52
|
|
||||||
1:vhighvoltage 0
|
1:vhighvoltage 0
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -51,11 +47,11 @@ rx_datastream 1
|
|||||||
rx_hostname my_receiver_hostname
|
rx_hostname my_receiver_hostname
|
||||||
rx_datastream 1
|
rx_datastream 1
|
||||||
outdir /tmp/
|
outdir /tmp/
|
||||||
angconv none
|
|
||||||
threaded 1
|
|
||||||
|
|
||||||
settings veryhighgain
|
settings veryhighgain
|
||||||
exptime 0.000005
|
exptime 0.000005
|
||||||
period 0.0001
|
period 0.0001
|
||||||
|
|
||||||
vhighvoltage 90
|
vhighvoltage 90
|
||||||
|
|
5
examples/howto_gotthatd_twomodules.txt → examples/howto_gotthard_twomodules.txt
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
Turn on the two receivers:
|
Turn on the two receivers:
|
||||||
slsReceiver --rx_tcpport 1954 &
|
slsReceiver -t1954 &
|
||||||
slsReceiver --rx_tcpport 1955 &
|
slsReceiver -t1955 &
|
||||||
|
|
||||||
Switch on the photon conversion on the receiver machine (replace my_receiver_hostname):
|
Switch on the photon conversion on the receiver machine (replace my_receiver_hostname):
|
||||||
gotthard25umZmq my_receiver_hostname 30003 my_receiver_hostname 40003 &
|
gotthard25umZmq my_receiver_hostname 30003 my_receiver_hostname 40003 &
|
||||||
@ -11,4 +11,3 @@ sls_detector_put config bchip2modules.config
|
|||||||
|
|
||||||
Start your measurements using the command line, the slsDetectorGui or the EPICS driver
|
Start your measurements using the command line, the slsDetectorGui or the EPICS driver
|
||||||
|
|
||||||
|
|
0
examples/jungfrau.config
Normal file → Executable file
0
examples/jungfrau_two.config
Normal file → Executable file
2
examples/moench03_T1_lab.config → examples/moench01_T1_lab.config
Normal file → Executable file
@ -487,3 +487,5 @@ period 0.1
|
|||||||
outdir /scratch/
|
outdir /scratch/
|
||||||
enablefwrite 0
|
enablefwrite 0
|
||||||
|
|
||||||
|
|
||||||
|
|
0
examples/mythen.config
Normal file → Executable file
0
examples/receiver.config
Normal file → Executable file
0
examples/scripts/.parab
Normal file → Executable file
0
examples/two_gotthard.config
Normal file → Executable file
0
examples/two_no_receiver.config
Normal file → Executable file
48
integrationTests/CMakeLists.txt
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
# MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
|
# MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# include_directories(
|
||||||
|
# ${PROJECT_SOURCE_DIR}/catch
|
||||||
|
# )
|
||||||
|
|
||||||
|
target_sources(tests PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test-integrationMulti.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test-integrationDectector.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# if(SLS_USE_TESTS)
|
||||||
|
# set(TEST_SOURCES
|
||||||
|
# src/test-slsDetector.cpp
|
||||||
|
# src/test.cpp
|
||||||
|
# )
|
||||||
|
# add_executable(detector_test ${TEST_SOURCES})
|
||||||
|
|
||||||
|
# target_link_libraries(detector_test
|
||||||
|
# slsDetectorShared
|
||||||
|
# slsProjectOptions
|
||||||
|
# slsProjectWarnings
|
||||||
|
# slsSupportLib
|
||||||
|
# pthread
|
||||||
|
# rt
|
||||||
|
# )
|
||||||
|
# set_target_properties(detector_test PROPERTIES
|
||||||
|
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
# )
|
||||||
|
|
||||||
|
# add_executable(a src/a.cpp)
|
||||||
|
# target_link_libraries(a
|
||||||
|
# slsProjectOptions
|
||||||
|
# slsProjectWarnings
|
||||||
|
# slsDetectorShared
|
||||||
|
# slsSupportLib
|
||||||
|
# pthread
|
||||||
|
# rt
|
||||||
|
# )
|
||||||
|
# set_target_properties(a PROPERTIES
|
||||||
|
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
# )
|
||||||
|
|
||||||
|
# endif()
|
||||||
|
|
87
integrationTests/a.cpp
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include "ClientSocket.h"
|
||||||
|
#include "Timer.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include "network_utils.h"
|
||||||
|
#include "slsDetector.h"
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
#include "sls_detector_exceptions.h"
|
||||||
|
#include "sls_detector_funcs.h"
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <string>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "network_utils.h"
|
||||||
|
|
||||||
|
using namespace sls;
|
||||||
|
using ROI = slsDetectorDefs::ROI;
|
||||||
|
|
||||||
|
// Easy printing of an ROI
|
||||||
|
std::ostream &operator<<(std::ostream &out, const ROI &r) {
|
||||||
|
return out << "xmin: " << std::setw(5) << r.xmin
|
||||||
|
<< " xmax: " << std::setw(5) << r.xmax
|
||||||
|
<< " ymin: " << std::setw(5) << r.ymin
|
||||||
|
<< " ymax: " << std::setw(5) << r.ymax;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
int ret[]{0,0,0};
|
||||||
|
for (auto i: ret)
|
||||||
|
std::cout << i << "\n";
|
||||||
|
// uint32_t imageSize = 101;
|
||||||
|
// uint32_t packetSize = 100;
|
||||||
|
// std::cout << "a: " << std::ceil((double)imageSize / (double)packetSize) <<'\n';
|
||||||
|
// std::cout << "b: " << imageSize / packetSize <<'\n';
|
||||||
|
// std::cout << "c: " << static_cast<double>(imageSize / packetSize) << '\n';
|
||||||
|
// std::cout << "c: " << (imageSize + packetSize-1) / packetSize << '\n';
|
||||||
|
|
||||||
|
// slsDetectorDefs::ROI roilimits[5];
|
||||||
|
// roilimits[0].xmin = 5;
|
||||||
|
// roilimits[0].xmax = 12;
|
||||||
|
// roilimits[0].ymin = 5;
|
||||||
|
// roilimits[0].ymax = 15;
|
||||||
|
|
||||||
|
// roilimits[1].xmin = 0;
|
||||||
|
// roilimits[1].xmax = 3;
|
||||||
|
// roilimits[1].ymin = 20;
|
||||||
|
// roilimits[1].ymax = 25;
|
||||||
|
|
||||||
|
// roilimits[2].xmin = 500;
|
||||||
|
// roilimits[2].xmax = 600;
|
||||||
|
// roilimits[2].ymin = 100;
|
||||||
|
// roilimits[2].ymax = 200;
|
||||||
|
|
||||||
|
// roilimits[3].xmin = 300;
|
||||||
|
// roilimits[3].xmax = 500;
|
||||||
|
// roilimits[3].ymin = 800;
|
||||||
|
// roilimits[3].ymax = 900;
|
||||||
|
|
||||||
|
// roilimits[4].xmin = 1000;
|
||||||
|
// roilimits[4].xmax = 2000;
|
||||||
|
// roilimits[4].ymin = 300;
|
||||||
|
// roilimits[4].ymax = 500;
|
||||||
|
|
||||||
|
// std::cout << "Before sorting:\n";
|
||||||
|
// for (auto r : roilimits) {
|
||||||
|
// std::cout << r << '\n';
|
||||||
|
// }
|
||||||
|
|
||||||
|
// std::sort(std::begin(roilimits), std::end(roilimits),
|
||||||
|
// [](ROI a, ROI b) { return a.xmin < b.xmin; });
|
||||||
|
|
||||||
|
// std::cout << "After sorting: \n";
|
||||||
|
// for (auto r : roilimits) {
|
||||||
|
// std::cout << r << '\n';
|
||||||
|
// }
|
||||||
|
}
|
9
integrationTests/config.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
struct SingleDetectorConfig {
|
||||||
|
slsDetectorDefs::detectorType type_enum =
|
||||||
|
slsDetectorDefs::detectorType::EIGER;
|
||||||
|
const std::string hostname = "beb083";
|
||||||
|
const std::string type_string = "Eiger";
|
||||||
|
const std::string my_ip = "129.129.205.242";
|
||||||
|
};
|
224
integrationTests/test-integrationDectector.cpp
Executable file
@ -0,0 +1,224 @@
|
|||||||
|
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
#include "ClientSocket.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include "slsDetector.h"
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
|
#include "Timer.h"
|
||||||
|
#include "sls_detector_funcs.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#define VERBOSE
|
||||||
|
|
||||||
|
//Header holding all configurations for different detectors
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
TEST_CASE("single EIGER detector no receiver basic set and get", "[.integration]") {
|
||||||
|
//TODO! this test should take command line arguments for config
|
||||||
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
|
//Read type by connecting to the detector
|
||||||
|
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||||
|
CHECK(type == c.type_enum);
|
||||||
|
|
||||||
|
//Create slsDetector of said type and set hostname and detector online
|
||||||
|
slsDetector d(type);
|
||||||
|
CHECK(d.getDetectorTypeAsEnum() == type);
|
||||||
|
CHECK(d.getDetectorTypeAsString() == c.type_string);
|
||||||
|
|
||||||
|
d.setHostname(c.hostname);
|
||||||
|
CHECK(d.getHostname() == c.hostname);
|
||||||
|
|
||||||
|
d.setOnline(true);
|
||||||
|
CHECK(d.getOnlineFlag() == true);
|
||||||
|
|
||||||
|
CHECK(d.getReceiverOnline() == false);
|
||||||
|
CHECK(d.checkDetectorVersionCompatibility() == slsDetectorDefs::OK);
|
||||||
|
|
||||||
|
//Setting and reading exposure time
|
||||||
|
auto t = 1000000000;
|
||||||
|
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||||
|
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||||
|
|
||||||
|
//size of an eiger half module with and without gap pixels
|
||||||
|
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
|
||||||
|
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::X) == 1024);
|
||||||
|
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Y) == 256);
|
||||||
|
// CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Z) == 1);
|
||||||
|
CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::X) == 1024);
|
||||||
|
CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::Y) == 256);
|
||||||
|
// CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::Z) == 1);
|
||||||
|
|
||||||
|
CHECK(d.getNChans() == 256 * 256);
|
||||||
|
CHECK(d.getNChans(slsDetectorDefs::dimension::X) == 256);
|
||||||
|
CHECK(d.getNChans(slsDetectorDefs::dimension::Y) == 256);
|
||||||
|
// CHECK(d.getNChans(slsDetectorDefs::dimension::Z) == 1);
|
||||||
|
|
||||||
|
CHECK(d.getNChips() == 4);
|
||||||
|
CHECK(d.getNChips(slsDetectorDefs::dimension::X) == 4);
|
||||||
|
CHECK(d.getNChips(slsDetectorDefs::dimension::Y) == 1);
|
||||||
|
// CHECK(d.getNChips(slsDetectorDefs::dimension::Z) == 1);
|
||||||
|
|
||||||
|
d.freeSharedMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Set control port then create a new object with this control port",
|
||||||
|
"[.integration]") {
|
||||||
|
/*
|
||||||
|
TODO!
|
||||||
|
Standard port but should not be hardcoded
|
||||||
|
Is this the best way to initialize the detectors
|
||||||
|
Using braces to make the object go out of scope
|
||||||
|
*/
|
||||||
|
int old_cport = DEFAULT_PORTNO;
|
||||||
|
int old_sport = DEFAULT_PORTNO + 1;
|
||||||
|
int new_cport = 1993;
|
||||||
|
int new_sport = 2000;
|
||||||
|
SingleDetectorConfig c;
|
||||||
|
{
|
||||||
|
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||||
|
CHECK(type == c.type_enum);
|
||||||
|
slsDetector d(type);
|
||||||
|
d.setHostname(c.hostname);
|
||||||
|
d.setOnline(true);
|
||||||
|
CHECK(d.getControlPort() == old_cport);
|
||||||
|
d.setControlPort(new_cport);
|
||||||
|
CHECK(d.getStopPort() == old_sport);
|
||||||
|
d.setStopPort(new_sport);
|
||||||
|
d.freeSharedMemory();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto type = slsDetector::getTypeFromDetector(c.hostname, new_cport);
|
||||||
|
CHECK(type == c.type_enum);
|
||||||
|
slsDetector d(type);
|
||||||
|
d.setHostname(c.hostname);
|
||||||
|
d.setControlPort(new_cport);
|
||||||
|
d.setStopPort(new_sport);
|
||||||
|
CHECK(d.getControlPort() == new_cport);
|
||||||
|
CHECK(d.getStopPort() == new_sport);
|
||||||
|
|
||||||
|
d.setOnline(true);
|
||||||
|
|
||||||
|
//Reset standard ports
|
||||||
|
d.setControlPort(old_cport);
|
||||||
|
d.setStopPort(old_sport);
|
||||||
|
d.freeSharedMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||||
|
CHECK(type == c.type_enum);
|
||||||
|
slsDetector d(type);
|
||||||
|
d.setHostname(c.hostname);
|
||||||
|
d.setOnline(true);
|
||||||
|
CHECK(d.getStopPort() == DEFAULT_PORTNO + 1);
|
||||||
|
d.freeSharedMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Locking mechanism and last ip", "[.integration]") {
|
||||||
|
SingleDetectorConfig c;
|
||||||
|
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||||
|
slsDetector d(type);
|
||||||
|
d.setHostname(c.hostname);
|
||||||
|
d.setOnline(true);
|
||||||
|
|
||||||
|
//Check that detector server is unlocked then lock
|
||||||
|
CHECK(d.lockServer() == 0);
|
||||||
|
d.lockServer(1);
|
||||||
|
CHECK(d.lockServer() == 1);
|
||||||
|
|
||||||
|
//Can we still access the detector while it's locked
|
||||||
|
auto t = 1300000000;
|
||||||
|
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||||
|
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||||
|
|
||||||
|
//unlock again and free
|
||||||
|
d.lockServer(0);
|
||||||
|
CHECK(d.lockServer() == 0);
|
||||||
|
|
||||||
|
CHECK(d.getLastClientIP() == c.my_ip);
|
||||||
|
d.freeSharedMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Excersise all possible set timer functions", "[.integration]") {
|
||||||
|
// FRAME_NUMBER, /**< number of real time frames: total number of acquisitions is number or frames*number of cycles */
|
||||||
|
// ACQUISITION_TIME, /**< exposure time */
|
||||||
|
// FRAME_PERIOD, /**< period between exposures */
|
||||||
|
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or readout (in triggered mode) */
|
||||||
|
// GATES_NUMBER, /**< number of gates per frame (in gated mode) */
|
||||||
|
// CYCLES_NUMBER, /**< number of cycles: total number of acquisitions is number or frames*number of cycles */
|
||||||
|
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||||
|
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo) */
|
||||||
|
|
||||||
|
// PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||||
|
// MEASUREMENTS_NUMBER,
|
||||||
|
// FRAMES_FROM_START,
|
||||||
|
// FRAMES_FROM_START_PG,
|
||||||
|
// SAMPLES,
|
||||||
|
// SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
|
||||||
|
// STORAGE_CELL_NUMBER, /**<number of storage cells */
|
||||||
|
// SUBFRAME_DEADTIME, /**< subframe deadtime */
|
||||||
|
// MEASURED_PERIOD, /**< measured period */
|
||||||
|
// MEASURED_SUBPERIOD, /**< measured subperiod */
|
||||||
|
// MAX_TIMERS
|
||||||
|
SingleDetectorConfig c;
|
||||||
|
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||||
|
slsDetector d(type);
|
||||||
|
d.setHostname(c.hostname);
|
||||||
|
d.setOnline(true);
|
||||||
|
|
||||||
|
//Number of frames
|
||||||
|
auto frames = 10;
|
||||||
|
d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, frames);
|
||||||
|
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER) == frames);
|
||||||
|
|
||||||
|
auto t = 10000000;
|
||||||
|
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||||
|
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||||
|
|
||||||
|
auto period = 1000000000;
|
||||||
|
d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||||
|
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD) == period);
|
||||||
|
|
||||||
|
// not implemented for EIGER
|
||||||
|
// auto delay = 10000;
|
||||||
|
// d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, delay);
|
||||||
|
// CHECK(d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER) == delay);
|
||||||
|
|
||||||
|
// auto gates = 1;
|
||||||
|
// d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, gates);
|
||||||
|
// CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
|
||||||
|
|
||||||
|
auto cycles = 2;
|
||||||
|
d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, cycles);
|
||||||
|
CHECK(d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER) == cycles);
|
||||||
|
|
||||||
|
auto subtime = 200;
|
||||||
|
d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME, subtime);
|
||||||
|
CHECK(d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME) == subtime);
|
||||||
|
|
||||||
|
d.freeSharedMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||||
|
// SingleDetectorConfig c;
|
||||||
|
// auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||||
|
// slsDetector d(type);
|
||||||
|
// d.setHostname(c.hostname);
|
||||||
|
// d.setOnline(true);
|
||||||
|
|
||||||
|
// auto period = 1000000000;
|
||||||
|
// auto exptime = 100000000;
|
||||||
|
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, 5);
|
||||||
|
// d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||||
|
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||||
|
// d.startAndReadAll();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// auto rperiod = d.getTimeLeft(slsDetectorDefs::timerIndex::MEASURED_PERIOD);
|
||||||
|
// CHECK(rperiod == 0.1);
|
||||||
|
|
||||||
|
// d.freeSharedMemory();
|
||||||
|
// }
|
11
integrationTests/test-integrationMulti.cpp
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
// #include "catch.hpp"
|
||||||
|
// #include "multiSlsDetector.h"
|
||||||
|
|
||||||
|
// #include <iostream>
|
||||||
|
// TEST_CASE("Initialize a detector") {
|
||||||
|
// multiSlsDetector det(0, true, true);
|
||||||
|
// std::cout << "Size: " << det.getNumberOfDetectors() << std::endl;
|
||||||
|
// std::cout << "Hostname: " << det.getHostname() << std::endl;
|
||||||
|
// REQUIRE(false);
|
||||||
|
|
||||||
|
// }
|
3
integrationTests/test.cpp
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
// tests-main.cpp
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include "catch.hpp"
|
0
manual/Makefile
Normal file → Executable file
0
manual/index.html
Normal file → Executable file
@ -1,26 +0,0 @@
|
|||||||
INCLUDES = -I .
|
|
||||||
SRC_TEST = main.cpp
|
|
||||||
LIBDIR = ../../bin
|
|
||||||
ZLIBDIR = ../../slsReceiverSoftware/include
|
|
||||||
|
|
||||||
LBITS := $(shell getconf LONG_BIT)
|
|
||||||
SERVER_TYPE = "64 bits compile server detected..."
|
|
||||||
LDFLAG_DET = -I. -L$(LIBDIR) -L$(ZLIBDIR) -lSlsReceiver -lSlsDetector -L/usr/lib64/ -pthread -lrt -L. -lzmq
|
|
||||||
|
|
||||||
all: manual-acq
|
|
||||||
|
|
||||||
manual-acq:$(SRC_TEST)
|
|
||||||
@echo "------------------------------------------------------------"
|
|
||||||
@echo "creating test software"
|
|
||||||
@echo $(SERVER_TYPE)
|
|
||||||
@echo "------------------------------------------------------------"
|
|
||||||
|
|
||||||
mkdir -p bin
|
|
||||||
g++ -o bin/manual-acq $(SRC_TEST) $(INCLUDES) $(LDFLAG_DET) -lm -lstdc++
|
|
||||||
cp bin/manual-acq ../../bin
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@echo "------------------------------------------------------------"
|
|
||||||
@echo "cleaning test software"
|
|
||||||
@echo "------------------------------------------------------------"
|
|
||||||
rm -rf bin/manual-acq
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/ansi.h
|
|
@ -1,21 +0,0 @@
|
|||||||
hostname bchip065+bchip195+
|
|
||||||
|
|
||||||
0:rx_tcpport 1954
|
|
||||||
0:rx_udpport 50005
|
|
||||||
0:detectorip 10.1.2.185
|
|
||||||
0:rx_udpip 10.1.2.102
|
|
||||||
|
|
||||||
1:rx_tcpport 1955
|
|
||||||
1:rx_udpport 50006
|
|
||||||
1:detectorip 10.1.2.186
|
|
||||||
1:rx_udpip 10.1.2.102
|
|
||||||
|
|
||||||
rx_hostname pc1875
|
|
||||||
|
|
||||||
outdir /home/l_msdetect/dhanya/outdir
|
|
||||||
|
|
||||||
vhighvoltage 0
|
|
||||||
|
|
||||||
enablefwrite 0
|
|
||||||
|
|
||||||
timing auto
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/libzmq.a
|
|
@ -1,900 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
|
||||||
#include <cctype>
|
|
||||||
#include <locale>
|
|
||||||
#include <sstream>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
|
||||||
#include "slsReceiverUsers.h"
|
|
||||||
|
|
||||||
#include "sls_detector_defs.h"
|
|
||||||
#include "slsDetectorUsers.h"
|
|
||||||
|
|
||||||
//#define GOTTHARD_25_TEST
|
|
||||||
//#define JUNGFRAU_TEST
|
|
||||||
#define GOTTHARD_TEST
|
|
||||||
|
|
||||||
//======================================================================================================
|
|
||||||
// test configuration
|
|
||||||
//======================================================================================================
|
|
||||||
int acquisition_nb = 1; // number of acquisition to make
|
|
||||||
int acquisition_nb_ok = 0; // number of correct acquisition
|
|
||||||
uint64_t last_acquisition_received_frames; // number of received frames during the last acquisition
|
|
||||||
std::vector <int> acquisition_nb_list;
|
|
||||||
|
|
||||||
bool use_trace = false; // activate the acquisition log
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// GOTTHARD 25um
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
#ifdef GOTTHARD_25_TEST
|
|
||||||
const int receivers_nb = 2; // number of receivers
|
|
||||||
const int receivers_rx_tcpport[receivers_nb] = {1954, 1955}; // tcp port for each receiver
|
|
||||||
|
|
||||||
const int detector_id = 0; // detector identifier for slsDetectorUsers constructor
|
|
||||||
const std::string detector_config_file_name = "gotthard25.config"; // configuration file name (must be present in the same folder of this application)
|
|
||||||
|
|
||||||
const long detector_receiver_fifo_depth = 2500;
|
|
||||||
double detector_exposure_time_sec = 0.005;
|
|
||||||
double detector_exposure_period_sec = 0.10;
|
|
||||||
const double detector_delay_after_trigger_sec = 0.0;
|
|
||||||
const std::string detector_trig_mode = "auto"; // "auto" or "trigger"
|
|
||||||
int64_t detector_nb_frames_per_cycle = 10;
|
|
||||||
const int64_t detector_nb_cycles = 1;
|
|
||||||
int detector_module_index[receivers_nb] = {0, 1};
|
|
||||||
#else
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// GOTTHARD
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
#ifdef GOTTHARD_TEST
|
|
||||||
const int receivers_nb = 1; // number of receivers
|
|
||||||
const int receivers_rx_tcpport[receivers_nb] = {1954}; // tcp port for each receiver
|
|
||||||
|
|
||||||
const int detector_id = 0; // detector identifier for slsDetectorUsers constructor
|
|
||||||
const std::string detector_config_file_name = "gotthard25.config"; // configuration file name (must be present in the same folder of this application)
|
|
||||||
|
|
||||||
const long detector_receiver_fifo_depth = 2500;
|
|
||||||
double detector_exposure_time_sec = 0.005;
|
|
||||||
double detector_exposure_period_sec = 0.1;
|
|
||||||
const double detector_delay_after_trigger_sec = 0.0;
|
|
||||||
const std::string detector_trig_mode = "auto"; // "auto" or "trigger"
|
|
||||||
int64_t detector_nb_frames_per_cycle = 10;
|
|
||||||
const int64_t detector_nb_cycles = 1;
|
|
||||||
int detector_module_index[receivers_nb] = {0};
|
|
||||||
#else
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// JUNGFRAU
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
#ifdef JUNGFRAU_TEST
|
|
||||||
const int receivers_nb = 1; // number of receivers
|
|
||||||
const int receivers_rx_tcpport[receivers_nb] = {1954}; // tcp port for each receiver
|
|
||||||
|
|
||||||
const int detector_id = 0; // detector identifier for slsDetectorUsers constructor
|
|
||||||
const std::string detector_config_file_name = "jungfrau_nanoscopium_switch.config"; // configuration file name (must be present in the same folder of this application)
|
|
||||||
|
|
||||||
const long detector_receiver_fifo_depth = 2500;
|
|
||||||
double detector_exposure_time_sec = 0.0005;
|
|
||||||
double detector_exposure_period_sec = 0.001;
|
|
||||||
const double detector_delay_after_trigger_sec = 0.0;
|
|
||||||
const std::string detector_trig_mode = "auto"; // "auto" or "trigger"
|
|
||||||
int64_t detector_nb_frames_per_cycle = 10000;
|
|
||||||
const int64_t detector_nb_cycles = 1;
|
|
||||||
const int detector_clock_divider = 1;
|
|
||||||
int detector_module_index[receivers_nb] = {0};
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// test instances
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<slsReceiverUsers *> receivers;
|
|
||||||
slsDetectorUsers * detector = NULL;
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// tools functions
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
/** Define Colors to print data call back in different colors for different recievers */
|
|
||||||
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
|
|
||||||
|
|
||||||
#define PRINT_SEPARATOR() cprintf(MAGENTA, "============================================\n")
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* \brief cleans the shared memory used by the camera
|
|
||||||
************************************************************************/
|
|
||||||
void clean_shared_memory()
|
|
||||||
{
|
|
||||||
std::string cmd = "rm /dev/shm/slsDetectorPackage*;";
|
|
||||||
std::system(cmd.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
* \brief converts a version id to a string
|
|
||||||
* \return version in string format (uppercase & hexa)
|
|
||||||
*******************************************************************/
|
|
||||||
std::string convertVersionToString(int64_t in_version)
|
|
||||||
{
|
|
||||||
std::stringstream tempStream;
|
|
||||||
tempStream << "0x" << std::uppercase << std::hex << in_version;
|
|
||||||
return tempStream.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==================================================================
|
|
||||||
// Related to commands (put & get)
|
|
||||||
//==================================================================
|
|
||||||
/*******************************************************************
|
|
||||||
* \brief Converts a standard string to args arguments
|
|
||||||
* \param in_command command in command line format
|
|
||||||
* \param out_argv output c-strings c-array
|
|
||||||
* \param out_argc output number of arguments of out_argv
|
|
||||||
*******************************************************************/
|
|
||||||
void convertStringToArgs(const std::string & in_command,
|
|
||||||
char * * & out_argv ,
|
|
||||||
int & out_argc )
|
|
||||||
{
|
|
||||||
out_argv = NULL;
|
|
||||||
out_argc = 0 ;
|
|
||||||
|
|
||||||
// filling a string vector with the command line elements
|
|
||||||
std::vector<std::string> elements;
|
|
||||||
std::stringstream ss(in_command);
|
|
||||||
|
|
||||||
while (ss)
|
|
||||||
{
|
|
||||||
std::string element;
|
|
||||||
ss >> element;
|
|
||||||
|
|
||||||
if(element.size() > 0)
|
|
||||||
{
|
|
||||||
elements.push_back(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// setting argc value
|
|
||||||
out_argc = elements.size();
|
|
||||||
|
|
||||||
// allocating argv array
|
|
||||||
out_argv = new char * [out_argc];
|
|
||||||
|
|
||||||
// filling argv array
|
|
||||||
for (int element_index = 0; element_index < out_argc; element_index++)
|
|
||||||
{
|
|
||||||
out_argv[element_index] = new char[elements[element_index].size() + 1]; // adding the allocation of end of c-string
|
|
||||||
strcpy(out_argv[element_index], elements[element_index].c_str()); // copying the string including the eos
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
* \brief Releases args arguments
|
|
||||||
* \param in_out_argv output c-strings c-array*(static_cast<int *>(p))
|
|
||||||
* \param in_out_argc output number of arguments of out_argv
|
|
||||||
*******************************************************************/
|
|
||||||
void releaseArgs(char * * & in_out_argv ,
|
|
||||||
int & in_out_argc )
|
|
||||||
{
|
|
||||||
if(in_out_argv != NULL)
|
|
||||||
{
|
|
||||||
// releasing the c_strings array content
|
|
||||||
for (int element_index = 0; element_index < in_out_argc; element_index++)
|
|
||||||
{
|
|
||||||
delete [] in_out_argv[element_index];
|
|
||||||
}
|
|
||||||
|
|
||||||
// releasing the c_strings array
|
|
||||||
delete [] in_out_argv;
|
|
||||||
|
|
||||||
in_out_argv = NULL;
|
|
||||||
in_out_argc = 0 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
* \brief Executes a set command
|
|
||||||
* \param in_command command in command line format
|
|
||||||
* \param in_module_index module index
|
|
||||||
* \return the command result
|
|
||||||
*******************************************************************/
|
|
||||||
std::string setCmd(const std::string & in_command, int in_module_index=-1)
|
|
||||||
{
|
|
||||||
std::cout << "setCmd - execute set command:\"" << in_command << "\"" << std::endl;
|
|
||||||
|
|
||||||
char * * argv ;
|
|
||||||
int argc ;
|
|
||||||
std::string result;
|
|
||||||
|
|
||||||
convertStringToArgs(in_command, argv, argc);
|
|
||||||
|
|
||||||
if(argc > 0)
|
|
||||||
{
|
|
||||||
result = detector->putCommand(argc, argv, in_module_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
releaseArgs(argv, argc);
|
|
||||||
|
|
||||||
std::cout << "result=\"" << result << "\"" << std::endl;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
* \brief Executes a get command
|
|
||||||
* \param in_command command in command line format
|
|
||||||
* \param in_module_index module index
|
|
||||||
* \return the command result
|
|
||||||
*******************************************************************/
|
|
||||||
std::string getCmd(const std::string & in_command, int in_module_index=-1)
|
|
||||||
{
|
|
||||||
std::cout << "getCmd - execute get command:\"" << in_command << "\"" << std::endl;
|
|
||||||
|
|
||||||
char * * argv ;
|
|
||||||
int argc ;
|
|
||||||
std::string result;
|
|
||||||
|
|
||||||
convertStringToArgs(in_command, argv, argc);
|
|
||||||
|
|
||||||
if(argc > 0)
|
|
||||||
{
|
|
||||||
result = detector->getCommand(argc, argv, in_module_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
releaseArgs(argv, argc);
|
|
||||||
|
|
||||||
std::cout << "result=\"" << result << "\"" << std::endl;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// Receivers callbacks
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Start Acquisition Call back
|
|
||||||
* slsReceiver writes data if file write enabled.
|
|
||||||
* Users get data to write using call back if registerCallBackRawDataReady is registered.
|
|
||||||
* @param filepath file path
|
|
||||||
* @param filename file name
|
|
||||||
* @param fileindex file index
|
|
||||||
* @param datasize data size in bytes
|
|
||||||
* @param p pointer to object
|
|
||||||
* \returns ignored
|
|
||||||
*/
|
|
||||||
int StartAcq(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*p){
|
|
||||||
cprintf(BLUE, "#### StartAcq: filepath:%s filename:%s fileindex:%llu datasize:%u ####\n",
|
|
||||||
filepath, filename, fileindex, datasize);
|
|
||||||
|
|
||||||
cprintf(BLUE, "--StartAcq: returning 0\n");
|
|
||||||
last_acquisition_received_frames = 0LL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Acquisition Finished Call back
|
|
||||||
* @param frames Number of frames caught
|
|
||||||
* @param p pointer to object
|
|
||||||
*/
|
|
||||||
void AcquisitionFinished(uint64_t frames, void*p){
|
|
||||||
cprintf(BLUE, "#### AcquisitionFinished: frames:%llu ####\n",frames);
|
|
||||||
last_acquisition_received_frames = frames;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Receiver Data Call back
|
|
||||||
* Prints in different colors(for each receiver process) the different headers for each image call back.
|
|
||||||
* @param metadata sls_receiver_header metadata
|
|
||||||
* @param datapointer pointer to data
|
|
||||||
* @param datasize data size in bytes.
|
|
||||||
* @param p pointer to object
|
|
||||||
*/
|
|
||||||
void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p)
|
|
||||||
{
|
|
||||||
if(use_trace)
|
|
||||||
{
|
|
||||||
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
|
|
||||||
const slsReceiverDefs::sls_detector_header & detectorHeader = header->detHeader;
|
|
||||||
|
|
||||||
PRINT_IN_COLOR (*(static_cast<int *>(p)),
|
|
||||||
"#### %d GetData: ####\n"
|
|
||||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
|
|
||||||
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
|
||||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
|
||||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
|
||||||
//"\t\tpacketsMask:%s"
|
|
||||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
|
||||||
*(static_cast<int *>(p)),
|
|
||||||
(long long unsigned int)detectorHeader.frameNumber,
|
|
||||||
detectorHeader.expLength,
|
|
||||||
detectorHeader.packetNumber,
|
|
||||||
(long long unsigned int)detectorHeader.bunchId,
|
|
||||||
(long long unsigned int)detectorHeader.timestamp,
|
|
||||||
detectorHeader.modId,
|
|
||||||
detectorHeader.row,
|
|
||||||
detectorHeader.column,
|
|
||||||
detectorHeader.reserved,
|
|
||||||
detectorHeader.debug,
|
|
||||||
detectorHeader.roundRNumber,
|
|
||||||
detectorHeader.detType,
|
|
||||||
detectorHeader.version,
|
|
||||||
//header->packetsMask.to_string().c_str(),
|
|
||||||
((uint8_t)(*((uint8_t*)(datapointer)))),
|
|
||||||
datasize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((datapointer != NULL) && (datasize > 0))
|
|
||||||
{
|
|
||||||
char * buffer = new char[datasize];
|
|
||||||
memcpy(buffer, datapointer, datasize);
|
|
||||||
delete [] buffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// CreateReceivers
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
void CreateReceivers(void)
|
|
||||||
{
|
|
||||||
// preparing the args for receivers creation
|
|
||||||
char temp_port[10];
|
|
||||||
const int argc = 3;
|
|
||||||
char * args[argc] = {(char*)"slsReceiver", (char*)"--rx_tcpport", temp_port};
|
|
||||||
|
|
||||||
// creating the receivers instances
|
|
||||||
for(int i = 0 ; i < receivers_nb ; i++)
|
|
||||||
{
|
|
||||||
int ret = slsReceiverDefs::OK;
|
|
||||||
|
|
||||||
// changing the udp port in the args
|
|
||||||
sprintf(temp_port, "%d", receivers_rx_tcpport[i]);
|
|
||||||
|
|
||||||
// creating the receiver using the args
|
|
||||||
slsReceiverUsers * receiver = new slsReceiverUsers(argc, args, ret);
|
|
||||||
|
|
||||||
// managing a failed result
|
|
||||||
if(ret==slsReceiverDefs::FAIL)
|
|
||||||
{
|
|
||||||
delete receiver;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// adding the receiver to the receivers container
|
|
||||||
receivers.push_back(receiver);
|
|
||||||
|
|
||||||
std::cout << "receiver (" << i << ") created - port (" << receivers_rx_tcpport[i] << ")" << std::endl;
|
|
||||||
|
|
||||||
// registering callbacks
|
|
||||||
// Call back for start acquisition
|
|
||||||
cprintf(BLUE, "Registering StartAcq()\n");
|
|
||||||
receiver->registerCallBackStartAcquisition(StartAcq, NULL);
|
|
||||||
|
|
||||||
// Call back for acquisition finished
|
|
||||||
cprintf(BLUE, "Registering AcquisitionFinished()\n");
|
|
||||||
receiver->registerCallBackAcquisitionFinished(AcquisitionFinished, NULL);
|
|
||||||
|
|
||||||
// Call back for raw data
|
|
||||||
cprintf(BLUE, "Registering GetData() \n");
|
|
||||||
receiver->registerCallBackRawDataReady(GetData, NULL);//&(detector_module_index[i]));
|
|
||||||
|
|
||||||
// starting tcp server thread
|
|
||||||
if (receiver->start() == slsReceiverDefs::FAIL)
|
|
||||||
{
|
|
||||||
delete receiver;
|
|
||||||
cprintf(BLUE,"Could not start receiver (%d)\n", i);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// ReleaseReceivers
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
void ReleaseReceivers(void)
|
|
||||||
{
|
|
||||||
// deleting the receivers instances
|
|
||||||
for(int i = 0 ; i < receivers.size() ; i++)
|
|
||||||
{
|
|
||||||
slsReceiverUsers * receiver = receivers[i];
|
|
||||||
|
|
||||||
// stoping tcp server thread
|
|
||||||
receiver->stop();
|
|
||||||
|
|
||||||
delete receiver;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// CreateDetector
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
void CreateDetector(void)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
|
|
||||||
// create the detector instance
|
|
||||||
detector = new slsDetectorUsers(result, detector_id);
|
|
||||||
|
|
||||||
if(result == slsDetectorDefs::FAIL)
|
|
||||||
{
|
|
||||||
std::cout << "slsDetectorUsers constructor failed! Could not initialize the camera!" << std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// configuration file is used to properly configure advanced settings in the shared memory
|
|
||||||
result = detector->readConfigurationFile(detector_config_file_name);
|
|
||||||
|
|
||||||
if(result == slsDetectorDefs::FAIL)
|
|
||||||
{
|
|
||||||
std::cout << "readConfigurationFile failed! Could not initialize the camera!" << std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set detector in shared memory online (in case no config file was used) */
|
|
||||||
detector->setOnline(slsDetectorDefs::ONLINE_FLAG);
|
|
||||||
|
|
||||||
// set receiver in shared memory online (in case no config file was used) */
|
|
||||||
detector->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG);
|
|
||||||
|
|
||||||
// disabling the file write by the camera
|
|
||||||
detector->enableWriteToFile(slsDetectorDefs::DISABLED);
|
|
||||||
|
|
||||||
// logging some versions informations
|
|
||||||
std::cout << "Detector developer : " << detector->getDetectorDeveloper() << std::endl;
|
|
||||||
std::cout << "Detector type : " << detector->getDetectorType() << std::endl;
|
|
||||||
std::cout << "Detector Firmware Version : " << convertVersionToString(detector->getDetectorFirmwareVersion()) << std::endl;
|
|
||||||
std::cout << "Detector Software Version : " << convertVersionToString(detector->getDetectorSoftwareVersion()) << std::endl;
|
|
||||||
|
|
||||||
// ensuring detector status is idle
|
|
||||||
int status = detector->getDetectorStatus();
|
|
||||||
|
|
||||||
if((status != slsDetectorDefs::IDLE) && (status != slsDetectorDefs::STOPPED))
|
|
||||||
{
|
|
||||||
std::cout << "Detector not ready: " << slsDetectorUsers::runStatusType(status) << std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// ReleaseDetector
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
void ReleaseDetector(void)
|
|
||||||
{
|
|
||||||
if(detector != NULL)
|
|
||||||
{
|
|
||||||
detector->setReceiverOnline(slsDetectorDefs::OFFLINE_FLAG);
|
|
||||||
detector->setOnline(slsDetectorDefs::OFFLINE_FLAG);
|
|
||||||
|
|
||||||
delete detector;
|
|
||||||
detector = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// RunAcquisition
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
int RunAcquisition(void)
|
|
||||||
{
|
|
||||||
std::string trig_mode_label;
|
|
||||||
|
|
||||||
double exposure_time ;
|
|
||||||
double exposure_period;
|
|
||||||
double delay_after_trigger;
|
|
||||||
|
|
||||||
int64_t nb_frames_per_cycle;
|
|
||||||
int64_t nb_cycles;
|
|
||||||
int64_t nb_frames;
|
|
||||||
#ifdef JUNGFRAU_TEST
|
|
||||||
int clock_divider;
|
|
||||||
#endif
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
// setting the receiver fifo depth (number of frames in the receiver memory)
|
|
||||||
detector->setReceiverFifoDepth(detector_receiver_fifo_depth);
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
detector->setExposureTime (detector_exposure_time_sec , true); // in seconds
|
|
||||||
detector->setExposurePeriod (detector_exposure_period_sec, true); // in seconds
|
|
||||||
detector->setDelayAfterTrigger(detector_delay_after_trigger_sec, true); // in seconds
|
|
||||||
|
|
||||||
exposure_time = detector->setExposureTime (-1, true); // in seconds
|
|
||||||
exposure_period = detector->setExposurePeriod (-1, true); // in seconds
|
|
||||||
delay_after_trigger = detector->setDelayAfterTrigger(-1, true, 0); // in seconds
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
// initing the number of frames per cycle and number of cycles
|
|
||||||
// to avoid problems during the trigger mode change.
|
|
||||||
detector->setNumberOfFrames(1);
|
|
||||||
detector->setNumberOfCycles(1);
|
|
||||||
|
|
||||||
// conversion of trigger mode label to trigger mode index
|
|
||||||
int trigger_mode_index = slsDetectorUsers::getTimingMode(detector_trig_mode);
|
|
||||||
|
|
||||||
// apply the trigger change
|
|
||||||
detector->setTimingMode(trigger_mode_index);
|
|
||||||
|
|
||||||
// converting trigger mode index to trigger mode label
|
|
||||||
trig_mode_label = slsDetectorUsers::getTimingMode(trigger_mode_index);
|
|
||||||
|
|
||||||
// setting the number of cycles
|
|
||||||
nb_cycles = detector->setNumberOfCycles(detector_nb_cycles);
|
|
||||||
|
|
||||||
// setting the number of frames per cycle
|
|
||||||
nb_frames_per_cycle = detector->setNumberOfFrames(detector_nb_frames_per_cycle);
|
|
||||||
|
|
||||||
// setting the gain mode
|
|
||||||
detector->setSettings(slsDetectorUsers::getDetectorSettings("dynamicgain"));
|
|
||||||
#ifndef JUNGFRAU_TEST
|
|
||||||
detector->setSettings(slsDetectorUsers::getDetectorSettings("mediumgain"));
|
|
||||||
#else
|
|
||||||
detector->setSettings(slsDetectorUsers::getDetectorSettings("dynamichg0"));
|
|
||||||
#endif
|
|
||||||
// computing the number of frames
|
|
||||||
nb_frames = nb_cycles * nb_frames_per_cycle;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
#ifdef JUNGFRAU_TEST
|
|
||||||
// clock divider
|
|
||||||
detector->setClockDivider(detector_clock_divider);
|
|
||||||
clock_divider = detector->setClockDivider(-1);
|
|
||||||
#endif
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
std::cout << "receiver fifo depth : " << detector_receiver_fifo_depth << std::endl;
|
|
||||||
std::cout << "Exposure time in seconds : " << exposure_time << std::endl;
|
|
||||||
std::cout << "Exposure period in seconds : " << exposure_period << std::endl;
|
|
||||||
std::cout << "Delay after trigger in seconds : " << delay_after_trigger << std::endl;
|
|
||||||
std::cout << "Trigger mode : " << trig_mode_label << std::endl;
|
|
||||||
std::cout << "Nb frames per cycle : " << nb_frames_per_cycle << std::endl;
|
|
||||||
std::cout << "Nb cycles : " << nb_cycles << std::endl;
|
|
||||||
std::cout << "Nb frames : " << nb_frames << std::endl;
|
|
||||||
#ifdef JUNGFRAU_TEST
|
|
||||||
std::cout << "Clock divider : " << clock_divider << std::endl;
|
|
||||||
#endif
|
|
||||||
std::cout << "Estimated frame rate : " << (1.0 / exposure_period) << std::endl;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
// reset the number of caught frames in the sdk
|
|
||||||
detector->resetFramesCaughtInReceiver();
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
const unsigned int sleep_time_sec = 1; // sleep the thread in seconds
|
|
||||||
|
|
||||||
// starting receiver listening mode
|
|
||||||
if(detector->startReceiver() == slsDetectorDefs::FAIL)
|
|
||||||
{
|
|
||||||
std::cout << "Could not start the receiver listening mode!" << std::endl;
|
|
||||||
return slsDetectorDefs::FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// starting real time acquisition in non blocking mode
|
|
||||||
// returns OK if all detectors are properly started, FAIL otherwise
|
|
||||||
if(detector->startAcquisition() == slsDetectorDefs::FAIL)
|
|
||||||
{
|
|
||||||
detector->stopReceiver();
|
|
||||||
std::cout << "Could not start real time acquisition!" << std::endl;
|
|
||||||
return slsDetectorDefs::FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
// checking if the hardware acquisition is running
|
|
||||||
int status = detector->getDetectorStatus();
|
|
||||||
if((status == slsDetectorDefs::IDLE ) ||
|
|
||||||
(status == slsDetectorDefs::STOPPED) ||
|
|
||||||
(status == slsDetectorDefs::ERROR ))
|
|
||||||
{
|
|
||||||
// we stop the treatment
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// hardware acquisition is running, we are waiting for new frames not using the cpu during this time
|
|
||||||
{
|
|
||||||
usleep(sleep_time_sec * 1000 * 1000); // sleep the thread in seconds
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// stopping receiver listening mode
|
|
||||||
if(detector->stopReceiver() == slsDetectorDefs::FAIL)
|
|
||||||
{
|
|
||||||
std::cout << "Could not stop real time acquisition!" << std::endl;
|
|
||||||
return slsDetectorDefs::FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "receiver fifo depth : " << detector_receiver_fifo_depth << std::endl;
|
|
||||||
std::cout << "Exposure time in seconds : " << exposure_time << std::endl;
|
|
||||||
std::cout << "Exposure period in seconds : " << exposure_period << std::endl;
|
|
||||||
std::cout << "Delay after trigger in seconds : " << delay_after_trigger << std::endl;
|
|
||||||
std::cout << "Trigger mode : " << trig_mode_label << std::endl;
|
|
||||||
std::cout << "Nb frames per cycle : " << nb_frames_per_cycle << std::endl;
|
|
||||||
std::cout << "Nb cyles : " << nb_cycles << std::endl;
|
|
||||||
std::cout << "Nb frames : " << nb_frames << std::endl;
|
|
||||||
#ifdef JUNGFRAU_TEST
|
|
||||||
std::cout << "Clock divider : " << clock_divider << std::endl;
|
|
||||||
#endif
|
|
||||||
std::cout << "Estimated frame rate : " << (1.0 / exposure_period) << std::endl;
|
|
||||||
|
|
||||||
if(last_acquisition_received_frames == nb_frames)
|
|
||||||
{
|
|
||||||
acquisition_nb_ok++;
|
|
||||||
return slsDetectorDefs::OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
return slsDetectorDefs::FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// test
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
void Test(void)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "CreateReceivers" << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
|
|
||||||
CreateReceivers();
|
|
||||||
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "CreateDetector" << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
|
|
||||||
CreateDetector();
|
|
||||||
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "RunAcquisition" << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
|
|
||||||
for(int acquisition_index = 0 ; acquisition_index < acquisition_nb ; acquisition_index++)
|
|
||||||
{
|
|
||||||
cprintf(MAGENTA, "Acquisition number : %d\n", acquisition_index);
|
|
||||||
if (RunAcquisition() == slsDetectorDefs::FAIL) {
|
|
||||||
acquisition_nb_list.push_back(acquisition_index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "ReleaseDetector" << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
|
|
||||||
ReleaseDetector();
|
|
||||||
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "ReleaseReceivers" << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
|
|
||||||
ReleaseReceivers();
|
|
||||||
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
if (acquisition_nb - acquisition_nb_ok)
|
|
||||||
cprintf(BOLD RED, "Correct acquisition(s) %d/%d\n", acquisition_nb_ok, acquisition_nb);
|
|
||||||
else
|
|
||||||
cprintf(BOLD GREEN, "Correct acquisition(s) %d/%d\n", acquisition_nb_ok, acquisition_nb);
|
|
||||||
if (acquisition_nb - acquisition_nb_ok) {
|
|
||||||
cprintf(RED, "Acquisition(s) gone wrong :\n");
|
|
||||||
for (int list_index = 0; list_index < acquisition_nb_list.size(); ++list_index) {
|
|
||||||
cprintf(RED, "%d\n", acquisition_nb_list[list_index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
std::cout << "unknown exception!" << std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string roi_result =
|
|
||||||
"detector 0:\n"
|
|
||||||
"0 255 -1 -1\n"
|
|
||||||
"detector 1:\n"
|
|
||||||
"1024 1279 -1 -1\n"
|
|
||||||
"\n"
|
|
||||||
"xmin xmax ymin ymax\n"
|
|
||||||
"0 255 -1 -1\n"
|
|
||||||
"2304 2559 -1 -1\n"
|
|
||||||
"roi 2\n";
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// use example :
|
|
||||||
// std::vector<slsReceiverDefs::ROI> rois;
|
|
||||||
// get_rois_from_string(roi_result, rois);
|
|
||||||
/*******************************************************************
|
|
||||||
* \brief Cuts the string in pieces
|
|
||||||
* \param[in] in_string source string
|
|
||||||
* \param[in] in_delimitor line delimitor
|
|
||||||
* \param[out] out_lines line container result
|
|
||||||
*******************************************************************/
|
|
||||||
void split_string_line(const std::string & in_string, const char in_delimitor, std::vector<std::string> & out_lines)
|
|
||||||
{
|
|
||||||
std::stringstream ss(in_string);
|
|
||||||
std::string sub_string;
|
|
||||||
|
|
||||||
while (getline(ss, sub_string, in_delimitor))
|
|
||||||
{
|
|
||||||
out_lines.push_back(sub_string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
* \brief retrieve the ROIs from a string
|
|
||||||
* \param[in] in_rois_string string from "get roi" command
|
|
||||||
* \param[out] out_rois ROI container result (empty if no set ROI)
|
|
||||||
*******************************************************************/
|
|
||||||
void get_rois_from_string(const std::string & in_rois_string, std::vector<slsReceiverDefs::ROI> & out_rois)
|
|
||||||
{
|
|
||||||
out_rois.clear();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// cuts the string in lines
|
|
||||||
std::vector<std::string> lines;
|
|
||||||
split_string_line(in_rois_string, '\n', lines);
|
|
||||||
|
|
||||||
if(lines.size() >= 1)
|
|
||||||
{
|
|
||||||
// checks if no ROI ?
|
|
||||||
if(lines[0] != "roi 0")
|
|
||||||
{
|
|
||||||
for(int roi_index = 0 ; roi_index < 2 ; roi_index++)
|
|
||||||
{
|
|
||||||
if(lines.size() >= ((roi_index + 1) * 2)) // two lines per ROI definition
|
|
||||||
{
|
|
||||||
std::stringstream detector_name;
|
|
||||||
detector_name << "detector " << roi_index << ":";
|
|
||||||
|
|
||||||
// checks the first line
|
|
||||||
if(lines[roi_index * 2] == detector_name.str())
|
|
||||||
{
|
|
||||||
std::stringstream ss(lines[(roi_index * 2) + 1]);
|
|
||||||
|
|
||||||
slsReceiverDefs::ROI roi;
|
|
||||||
ss >> roi.xmin;
|
|
||||||
ss >> roi.xmax;
|
|
||||||
ss >> roi.ymin;
|
|
||||||
ss >> roi.ymax;
|
|
||||||
|
|
||||||
out_rois.push_back(roi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
out_rois.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// read_simple_option
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
bool read_simple_option(int argc, char* argv[], const char * in_option_name)
|
|
||||||
{
|
|
||||||
int option_index = 1;
|
|
||||||
|
|
||||||
while(option_index < argc)
|
|
||||||
{
|
|
||||||
if (strcmp(argv[option_index], in_option_name) == 0)
|
|
||||||
{
|
|
||||||
std::cout << "Found option:" << in_option_name << std::endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
option_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// read_option_value
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
template <typename T> bool read_option_value(int argc, char* argv[], const char * in_option_name, T & out_option_value)
|
|
||||||
{
|
|
||||||
int option_index = 1;
|
|
||||||
|
|
||||||
while(option_index < argc)
|
|
||||||
{
|
|
||||||
if (strcmp(argv[option_index], in_option_name) == 0)
|
|
||||||
{
|
|
||||||
option_index++;
|
|
||||||
|
|
||||||
if(option_index < argc)
|
|
||||||
{
|
|
||||||
std::stringstream ss(std::string(argv[option_index]));
|
|
||||||
ss >> out_option_value;
|
|
||||||
std::cout << "Found option: " << in_option_name << " " << out_option_value << std::endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
option_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
// main
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
||||||
int main (int argc, char* argv[])
|
|
||||||
{
|
|
||||||
if(read_simple_option(argc, argv, "-help") || read_simple_option(argc, argv, "--help"))
|
|
||||||
{
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "Options:" << std::endl;
|
|
||||||
std::cout << "-clean -> clean shared memory" << std::endl;
|
|
||||||
std::cout << "-trace -> activate acquisition log" << std::endl;
|
|
||||||
std::cout << "-exp <value> -> set exposure time value in seconds (for example: -exp 0.0005)" << std::endl;
|
|
||||||
std::cout << "-period <value> -> set period time value in seconds (for example: -period 0.001)" << std::endl;
|
|
||||||
std::cout << "-frames <value> -> set number of frames (for example: -frames 10000)" << std::endl;
|
|
||||||
std::cout << "-acq <value> -> set number of acquisition (for example: -acq 10)" << std::endl;
|
|
||||||
std::cout << std::endl;
|
|
||||||
std::cout << "example: ./manual-acq -clean -trace -acq 1 -exp 0.0005 -period 0.001 -frames 1000" << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(read_simple_option(argc, argv, "-clean"))
|
|
||||||
{
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "Cleaning shared memory" << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
|
|
||||||
clean_shared_memory();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(read_simple_option(argc, argv, "-trace"))
|
|
||||||
{
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
std::cout << "Activating acquisition log..." << std::endl;
|
|
||||||
PRINT_SEPARATOR();
|
|
||||||
|
|
||||||
use_trace = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t frames_value;
|
|
||||||
|
|
||||||
if(read_option_value(argc, argv, "-frames", frames_value))
|
|
||||||
{
|
|
||||||
detector_nb_frames_per_cycle = frames_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
double exp_value;
|
|
||||||
|
|
||||||
if(read_option_value(argc, argv, "-exp", exp_value))
|
|
||||||
{
|
|
||||||
detector_exposure_time_sec = exp_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
double period_value;
|
|
||||||
|
|
||||||
if(read_option_value(argc, argv, "-period", period_value))
|
|
||||||
{
|
|
||||||
detector_exposure_period_sec = period_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
int acq_nb;
|
|
||||||
|
|
||||||
if(read_option_value(argc, argv, "-acq", acq_nb))
|
|
||||||
{
|
|
||||||
acquisition_nb = acq_nb;
|
|
||||||
}
|
|
||||||
|
|
||||||
Test();
|
|
||||||
|
|
||||||
std::cout << "====================== ENDING ======================" << std::endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
|
@ -1 +0,0 @@
|
|||||||
../../slsDetectorSoftware/slsDetector/slsDetectorUsers.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/slsReceiverUsers.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsDetectorSoftware/commonFiles/sls_detector_defs.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsDetectorSoftware/commonFiles/sls_detector_funcs.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/sls_receiver_defs.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/sls_receiver_funcs.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/zmq.h
|
|
9
manual/manual-api/CMakeLists.txt
Normal file → Executable file
@ -3,8 +3,8 @@ set(SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
../../slsSupportLib/include
|
||||||
../../slsReceiverSoftware/include
|
../../slsReceiverSoftware/include
|
||||||
../../slsDetectorSoftware/slsDetectorAnalysis
|
|
||||||
../../build/bin
|
../../build/bin
|
||||||
../../slsdetectorSoftware/slsDetector
|
../../slsdetectorSoftware/slsDetector
|
||||||
)
|
)
|
||||||
@ -16,15 +16,12 @@ add_executable(slsMultiReceiver
|
|||||||
target_link_libraries(slsMultiReceiver
|
target_link_libraries(slsMultiReceiver
|
||||||
slsReceiverShared
|
slsReceiverShared
|
||||||
pthread
|
pthread
|
||||||
zmq
|
${ZeroMQ_LIBRARIES}
|
||||||
rt
|
rt
|
||||||
${HDF5_LIBRARIES}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (HDF5_FOUND)
|
if (HDF5_FOUND)
|
||||||
target_link_libraries(slsMultiReceiver
|
target_link_libraries(slsMultiReceiver ${HDF5_LIBRARIES})
|
||||||
${HDF5_LIBRARIES}
|
|
||||||
)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
4
manual/manual-api/Makefile
Normal file → Executable file
@ -1,9 +1,9 @@
|
|||||||
PKGDIR = ../..
|
PKGDIR = ../..
|
||||||
LIBDIR = $(PKGDIR)/bin
|
LIBDIR = $(PKGDIR)/bin
|
||||||
INCLUDES = -I . -I$(PKGDIR)/slsReceiverSoftware/include -I$(PKGDIR)/slsDetectorSoftware/slsDetectorAnalysis -I$(LIBDIR) -I$(PKGDIR)/slsDetectorSoftware/slsDetector
|
INCLUDES = -I . -I$(PKGDIR)/slsSupportLib/include -I$(LIBDIR) -I$(PKGDIR)/slsDetectorSoftware/slsDetector -I$(PKGDIR)/slsReceiversoftware/include
|
||||||
SRC_DET = mainClient.cpp
|
SRC_DET = mainClient.cpp
|
||||||
SRC_REC = mainReceiver.cpp
|
SRC_REC = mainReceiver.cpp
|
||||||
ZMQLIBDIR = $(PKGDIR)/slsReceiverSoftware/include
|
ZMQLIBDIR = $(PKGDIR)/slsSupportLib/include
|
||||||
LDFLAG_DET = -I. -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread -lrt -L$(ZMQLIBDIR) -Wl,-rpath=$(ZMQLIBDIR) -lzmq
|
LDFLAG_DET = -I. -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread -lrt -L$(ZMQLIBDIR) -Wl,-rpath=$(ZMQLIBDIR) -lzmq
|
||||||
LDFLAG_REC = -I. -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread -lrt -L$(ZMQLIBDIR) -Wl,-rpath=$(ZMQLIBDIR) -lzmq
|
LDFLAG_REC = -I. -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread -lrt -L$(ZMQLIBDIR) -Wl,-rpath=$(ZMQLIBDIR) -lzmq
|
||||||
DESTDIR ?= ../docs
|
DESTDIR ?= ../docs
|
||||||
|
0
manual/manual-api/mainClient.cpp
Normal file → Executable file
42
manual/manual-api/mainReceiver.cpp
Normal file → Executable file
@ -16,7 +16,7 @@ It is linked in manual/manual-api from slsReceiverSoftware/include ]
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sls_receiver_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include "slsReceiverUsers.h"
|
#include "slsReceiverUsers.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -96,20 +96,20 @@ void AcquisitionFinished(uint64_t frames, void*p){
|
|||||||
* @param p pointer to object
|
* @param p pointer to object
|
||||||
*/
|
*/
|
||||||
void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
||||||
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
|
slsDetectorDefs::sls_receiver_header* header = (slsDetectorDefs::sls_receiver_header*)metadata;
|
||||||
slsReceiverDefs::sls_detector_header detectorHeader = header->detHeader;
|
slsDetectorDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||||
|
|
||||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
||||||
"#### %d GetData: ####\n"
|
"#### %d GetData: ####\n"
|
||||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
|
"frameNumber: %lu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %lu"
|
||||||
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
"\t\ttimestamp: %lu\t\tmodId: %u\t\t"
|
||||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
||||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||||
//"\t\tpacketsMask:%s"
|
//"\t\tpacketsMask:%s"
|
||||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||||
detectorHeader.row, (long long unsigned int)detectorHeader.frameNumber,
|
detectorHeader.row, (long unsigned int)detectorHeader.frameNumber,
|
||||||
detectorHeader.expLength, detectorHeader.packetNumber, (long long unsigned int)detectorHeader.bunchId,
|
detectorHeader.expLength, detectorHeader.packetNumber, (long unsigned int)detectorHeader.bunchId,
|
||||||
(long long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
|
(long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
|
||||||
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
|
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
|
||||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||||
detectorHeader.detType, detectorHeader.version,
|
detectorHeader.detType, detectorHeader.version,
|
||||||
@ -130,8 +130,8 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
|||||||
* @param p pointer to object
|
* @param p pointer to object
|
||||||
*/
|
*/
|
||||||
void GetData(char* metadata, char* datapointer, uint32_t &revDatasize, void* p){
|
void GetData(char* metadata, char* datapointer, uint32_t &revDatasize, void* p){
|
||||||
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
|
slsDetectorDefs::sls_receiver_header* header = (slsDetectorDefs::sls_receiver_header*)metadata;
|
||||||
slsReceiverDefs::sls_detector_header detectorHeader = header->detHeader;
|
slsDetectorDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||||
|
|
||||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
||||||
"#### %d GetData: ####\n"
|
"#### %d GetData: ####\n"
|
||||||
@ -187,7 +187,7 @@ int main(int argc, char *argv[]) {
|
|||||||
sa.sa_flags=0; // no flags
|
sa.sa_flags=0; // no flags
|
||||||
sa.sa_handler=sigInterruptHandler; // handler function
|
sa.sa_handler=sigInterruptHandler; // handler function
|
||||||
sigemptyset(&sa.sa_mask); // dont block additional signals during invocation of handler
|
sigemptyset(&sa.sa_mask); // dont block additional signals during invocation of handler
|
||||||
if (sigaction(SIGINT, &sa, NULL) == -1) {
|
if (sigaction(SIGINT, &sa, nullptr) == -1) {
|
||||||
cprintf(RED, "Could not set handler function for SIGINT\n");
|
cprintf(RED, "Could not set handler function for SIGINT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ int main(int argc, char *argv[]) {
|
|||||||
asa.sa_flags=0; // no flags
|
asa.sa_flags=0; // no flags
|
||||||
asa.sa_handler=SIG_IGN; // handler function
|
asa.sa_handler=SIG_IGN; // handler function
|
||||||
sigemptyset(&asa.sa_mask); // dont block additional signals during invocation of handler
|
sigemptyset(&asa.sa_mask); // dont block additional signals during invocation of handler
|
||||||
if (sigaction(SIGPIPE, &asa, NULL) == -1) {
|
if (sigaction(SIGPIPE, &asa, nullptr) == -1) {
|
||||||
cprintf(RED, "Could not set handler function for SIGPIPE\n");
|
cprintf(RED, "Could not set handler function for SIGPIPE\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,10 +221,10 @@ int main(int argc, char *argv[]) {
|
|||||||
char temp[10];
|
char temp[10];
|
||||||
sprintf(temp,"%d",startTCPPort + i);
|
sprintf(temp,"%d",startTCPPort + i);
|
||||||
char* args[] = {(char*)"ignored", (char*)"--rx_tcpport", temp};
|
char* args[] = {(char*)"ignored", (char*)"--rx_tcpport", temp};
|
||||||
int ret = slsReceiverDefs::OK;
|
int ret = slsDetectorDefs::OK;
|
||||||
/** - create slsReceiverUsers object with appropriate arguments */
|
/** - create slsReceiverUsers object with appropriate arguments */
|
||||||
slsReceiverUsers *receiver = new slsReceiverUsers(3, args, ret);
|
slsReceiverUsers *receiver = new slsReceiverUsers(3, args, ret);
|
||||||
if(ret==slsReceiverDefs::FAIL){
|
if(ret==slsDetectorDefs::FAIL){
|
||||||
delete receiver;
|
delete receiver;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -236,22 +236,22 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
/** - Call back for start acquisition */
|
/** - Call back for start acquisition */
|
||||||
cprintf(BLUE, "Registering StartAcq()\n");
|
cprintf(BLUE, "Registering StartAcq()\n");
|
||||||
receiver->registerCallBackStartAcquisition(StartAcq, NULL);
|
receiver->registerCallBackStartAcquisition(StartAcq, nullptr);
|
||||||
|
|
||||||
/** - Call back for acquisition finished */
|
/** - Call back for acquisition finished */
|
||||||
cprintf(BLUE, "Registering AcquisitionFinished()\n");
|
cprintf(BLUE, "Registering AcquisitionFinished()\n");
|
||||||
receiver->registerCallBackAcquisitionFinished(AcquisitionFinished, NULL);
|
receiver->registerCallBackAcquisitionFinished(AcquisitionFinished, nullptr);
|
||||||
|
|
||||||
/* - Call back for raw data */
|
/* - Call back for raw data */
|
||||||
cprintf(BLUE, "Registering GetData() \n");
|
cprintf(BLUE, "Registering GetData() \n");
|
||||||
if (withCallback == 1) receiver->registerCallBackRawDataReady(GetData,NULL);
|
if (withCallback == 1) receiver->registerCallBackRawDataReady(GetData,nullptr);
|
||||||
else if (withCallback == 2) receiver->registerCallBackRawDataModifyReady(GetData,NULL);
|
else if (withCallback == 2) receiver->registerCallBackRawDataModifyReady(GetData,nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** - start tcp server thread */
|
/** - start tcp server thread */
|
||||||
if (receiver->start() == slsReceiverDefs::FAIL){
|
if (receiver->start() == slsDetectorDefs::FAIL){
|
||||||
delete receiver;
|
delete receiver;
|
||||||
cprintf(BLUE,"Exiting Child Process [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
cprintf(BLUE,"Exiting Child Process [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -272,7 +272,7 @@ int main(int argc, char *argv[]) {
|
|||||||
sa.sa_flags=0; // no flags
|
sa.sa_flags=0; // no flags
|
||||||
sa.sa_handler=SIG_IGN; // handler function
|
sa.sa_handler=SIG_IGN; // handler function
|
||||||
sigemptyset(&sa.sa_mask); // dont block additional signals during invocation of handler
|
sigemptyset(&sa.sa_mask); // dont block additional signals during invocation of handler
|
||||||
if (sigaction(SIGINT, &sa, NULL) == -1) {
|
if (sigaction(SIGINT, &sa, nullptr) == -1) {
|
||||||
cprintf(RED, "Could not set handler function for SIGINT\n");
|
cprintf(RED, "Could not set handler function for SIGINT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
/** - Parent process waits for all child processes to exit */
|
/** - Parent process waits for all child processes to exit */
|
||||||
for(;;) {
|
for(;;) {
|
||||||
pid_t childPid = waitpid (-1, NULL, 0);
|
pid_t childPid = waitpid (-1, nullptr, 0);
|
||||||
|
|
||||||
// no child closed
|
// no child closed
|
||||||
if (childPid == -1) {
|
if (childPid == -1) {
|
||||||
|
0
manual/manual-api/slsDetectorUsers.doxy
Normal file → Executable file
0
manual/manual-calwiz/Advanced.png
Normal file → Executable file
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
0
manual/manual-calwiz/Constant_step.png
Normal file → Executable file
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
0
manual/manual-calwiz/GUI_Advanced.eps
Normal file → Executable file
0
manual/manual-calwiz/GUI_ThresholdScan.eps
Normal file → Executable file
0
manual/manual-calwiz/Makefile
Normal file → Executable file
0
manual/manual-calwiz/addEnergy.eps
Normal file → Executable file
0
manual/manual-calwiz/addEnergy.png
Normal file → Executable file
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
0
manual/manual-calwiz/ancCal.tex
Normal file → Executable file
0
manual/manual-calwiz/angleFit.eps
Normal file → Executable file
0
manual/manual-calwiz/angleFit.png
Normal file → Executable file
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
0
manual/manual-calwiz/angularCalibrationHowTo.tex
Normal file → Executable file
0
manual/manual-calwiz/calibrateModule.eps
Normal file → Executable file
0
manual/manual-calwiz/calibrateModule.png
Normal file → Executable file
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
0
manual/manual-calwiz/calibrationWizardsHowTo.tex
Normal file → Executable file
0
manual/manual-calwiz/enCal.tex
Normal file → Executable file
0
manual/manual-calwiz/enable_angcal.eps
Normal file → Executable file
0
manual/manual-calwiz/eneble_angcal.png
Normal file → Executable file
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |