Compare commits

...

4 Commits

Author SHA1 Message Date
84f2560f13 eiger server 2021-03-15 15:16:18 +01:00
bdeb030fea Better way of finding libzmq (#235)
* new strategy for finding zmq based on cppzmq
2021-03-15 15:03:45 +01:00
435146ca9c notes 2021-03-09 13:35:17 +01:00
39926497b2 bugfix for bottom when setting quad 2021-03-09 08:00:21 +01:00
17 changed files with 205 additions and 140 deletions

View File

@ -158,7 +158,26 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
#From: https://github.com/zeromq/cppzmq/
if (NOT TARGET libzmq)
find_package(ZeroMQ 4 QUIET)
# libzmq autotools install: fallback to pkg-config
if(NOT ZeroMQ_FOUND)
message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)")
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
find_package(ZeroMQ 4 REQUIRED) find_package(ZeroMQ 4 REQUIRED)
endif()
# TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
if(NOT ZeroMQ_FOUND)
message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")
endif()
if (ZeroMQ_FOUND AND NOT TARGET libzmq)
message(FATAL_ERROR "ZeroMQ version not supported!")
endif()
endif()
if (SLS_USE_TESTS) if (SLS_USE_TESTS)
enable_testing() enable_testing()

View File

@ -33,7 +33,8 @@ This document describes the differences between 5.1.0 and 5.x.x releases.
1. Aded settings and threshold features for Mythen3. 1. Aded settings and threshold features for Mythen3.
2. Internal modification of acquire for Mythen3. 2. Internal modification of acquire for Mythen3.
3. Added getMaster functio for M3 3. Added getMaster for Mythen3
4. Mythen3, API function to set pattern from memory
Mythen3 server Mythen3 server
@ -52,6 +53,7 @@ This document describes the differences between 5.1.0 and 5.x.x releases.
1. Current code only calls Implementation::setDetectorType from constructor, 1. Current code only calls Implementation::setDetectorType from constructor,
but potential memory leak if called out of constructor context. Fixed. but potential memory leak if called out of constructor context. Fixed.
Client Client
------ ------
@ -59,6 +61,11 @@ This document describes the differences between 5.1.0 and 5.x.x releases.
2. cmk.sh refactored to have better option handling 2. cmk.sh refactored to have better option handling
Server
--------
1. Bottom port not mirrored correctly for Eiger quad
@ -66,7 +73,11 @@ This document describes the differences between 5.1.0 and 5.x.x releases.
4. Firmware Requirements 4. Firmware Requirements
======================== ========================
No updates from 5.0.0 Mythen3: 0x210201
Jungfrau: 0x210218 (1.0 pcb)
0x200721 (2.0 pcb, not changed)
Other detectors no updates from 5.0.0

View File

@ -1,112 +0,0 @@
# 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()

View File

@ -25,6 +25,12 @@ install(FILES
DESTINATION ${CMAKE_INSTALL_DIR} DESTINATION ${CMAKE_INSTALL_DIR}
) )
install(FILES
"${CMAKE_SOURCE_DIR}/libzmq-pkg-config/FindZeroMQ.cmake"
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config
)
if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES) if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES)
install( install(
EXPORT "${TARGETS_EXPORT_NAME}" EXPORT "${TARGETS_EXPORT_NAME}"

View File

@ -12,8 +12,21 @@ include(CMakeFindDependencyMacro)
set(SLS_USE_HDF5 "@SLS_USE_HDF5@") set(SLS_USE_HDF5 "@SLS_USE_HDF5@")
# Add optional dependencies here
find_package(ZeroMQ 4 QUIET)
# libzmq autotools install: fallback to pkg-config
if(NOT ZeroMQ_FOUND)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
find_package(ZeroMQ 4 REQUIRED)
endif()
if(NOT ZeroMQ_FOUND)
message(FATAL_ERROR "ZeroMQ was NOT found!")
endif()
find_dependency(Threads) find_dependency(Threads)
# Add optional dependencies here
if (SLS_USE_HDF5) if (SLS_USE_HDF5)
find_dependency(HDF5) find_dependency(HDF5)
endif () endif ()

View File

@ -13,8 +13,9 @@ cmake .. \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_HDF5=OFF\ -DSLS_USE_HDF5=OFF\
NCORES=$(getconf _NPROCESSORS_ONLN)
cmake --build . -- -j10 echo "Building using: ${NCORES} cores"
cmake --build . -- -j${NCORES}
cmake --build . --target install cmake --build . --target install
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2 CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2

View File

@ -1,3 +1,3 @@
#Copy the GUI #Copy the GUI
mkdir $PREFIX/bin mkdir -p $PREFIX/bin
cp build/bin/slsDetectorGui $PREFIX/bin/. cp build/install/bin/slsDetectorGui $PREFIX/bin/.

View File

@ -1,6 +1,6 @@
mkdir $PREFIX/lib mkdir -p $PREFIX/lib
mkdir $PREFIX/bin mkdir -p $PREFIX/bin
mkdir -p $PREFIX/include/sls mkdir -p $PREFIX/include/sls
# mkdir $PREFIX/include/slsDetectorPackage # mkdir $PREFIX/include/slsDetectorPackage

View File

@ -59,6 +59,16 @@ outputs:
script: copy_lib.sh script: copy_lib.sh
requirements: requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- libstdcxx-ng
- libgcc-ng
- zeromq
host:
- zeromq
run: run:
- libstdcxx-ng - libstdcxx-ng
- libgcc-ng - libgcc-ng
@ -78,6 +88,8 @@ outputs:
host: host:
- python - python
- {{ pin_subpackage('slsdetlib', exact=True) }}
run: run:
- libstdcxx-ng - libstdcxx-ng
@ -94,6 +106,13 @@ outputs:
- name: slsdetgui - name: slsdetgui
script: copy_gui.sh script: copy_gui.sh
requirements: requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- {{ pin_subpackage('slsdetlib', exact=True) }}
- qwt 6.*
run: run:
- {{ pin_subpackage('slsdetlib', exact=True) }} - {{ pin_subpackage('slsdetlib', exact=True) }}
- qwt 6.* - qwt 6.*

View File

@ -0,0 +1,27 @@
#From: https://github.com/zeromq/cppzmq/
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
find_package(PkgConfig)
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
find_library(ZeroMQ_LIBRARY NAMES libzmq.so libzmq.dylib libzmq.dll
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq-static.a libzmq.a libzmq.dll.a
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
set(ZeroMQ_FOUND ON)
endif()
if (TARGET libzmq)
# avoid errors defining targets twice
return()
endif()
add_library(libzmq SHARED IMPORTED)
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})

View File

@ -0,0 +1,80 @@
import subprocess
import os
import sys
from pathlib import Path
import shutil as sh
from argparse import ArgumentParser
class color:
HEADER = "\033[95m"
BLUE = "\033[94m"
CYAN = "\033[96m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
RED = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
MAGENTA = "\033[35m"
@staticmethod
def red(s):
return f"{color.RED}{s}{color.ENDC}"
@staticmethod
def green(s):
return f"{color.GREEN}{s}{color.ENDC}"
def add_to_path():
paths = [
"/opt/uClinux/bfin-uclinux/bin",
"/opt/nios2-gcc/bin",
"/opt/eldk-5.1/powerpc-4xx-softfloat/sysroots/i686-eldk-linux/usr/bin/ppc405-linux",
]
os.environ["PATH"] += os.pathsep + os.pathsep.join(paths)
def rc_to_string(rc):
if rc == 0:
return color.green("OK")
else:
return color.red("FAIL")
parser = ArgumentParser()
parser.add_argument('-t', '--tag', help = 'Tag added to server file name', default='developer')
parser.add_argument('-g', '--git', help='Add new servers to the git repo', action="store_true")
args = parser.parse_args()
servers = [
"eigerDetectorServer",
# "jungfrauDetectorServer",
# "mythen3DetectorServer",
# "gotthard2DetectorServer",
# "gotthardDetectorServer",
# "ctbDetectorServer",
# "moenchDetectorServer",
]
server_root = Path("../../slsDetectorServers/").resolve()
add_to_path()
for server in servers:
bin_name = f"{server}_{args.tag}"
path = server_root / server
print(f"{bin_name} - ", end="")
os.chdir(path)
try:
sh.rmtree(path/'bin')
except FileNotFoundError:
pass
p = subprocess.run(["make"], stdout=subprocess.DEVNULL)
print(rc_to_string(p.returncode))
if p.returncode == 0:
sh.move(f"bin/{server}", f"bin/{bin_name}")
if args.git:
print("Adding to git")
subprocess.run(['git', 'add', 'bin', '-f'])

View File

@ -91,7 +91,6 @@ target_include_directories(slsDetectorGui PUBLIC
target_link_libraries(slsDetectorGui PUBLIC target_link_libraries(slsDetectorGui PUBLIC
slsProjectOptions slsProjectOptions
slsProjectWarnings
slsDetectorStatic slsDetectorStatic
${QT_QTCORE_LIBRARIES} ${QT_QTCORE_LIBRARIES}
${QT_QTGUI_LIBRARIES} ${QT_QTGUI_LIBRARIES}
@ -101,6 +100,9 @@ target_link_libraries(slsDetectorGui PUBLIC
Qt4::QtOpenGL Qt4::QtOpenGL
Qt4::QtSvg Qt4::QtSvg
expat expat
PRIVATE
slsProjectWarnings
) )
set_target_properties(slsDetectorGui PROPERTIES set_target_properties(slsDetectorGui PROPERTIES
@ -111,7 +113,7 @@ if(SLS_LTO_AVAILABLE)
endif() endif()
install(TARGETS slsDetectorGui install(TARGETS slsDetectorGui
EXPORT "${TARGETS_EXPORT_NAME}" # EXPORT "${TARGETS_EXPORT_NAME}" #do not export gui
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}

View File

@ -1395,7 +1395,7 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
int Feb_Control_SetQuad(int val) { int Feb_Control_SetQuad(int val) {
LOG(logINFO, ("Setting Quad to %d in Feb\n", val)); LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
// only setting on the right feb if quad // only setting on the right feb if quad
return Feb_Control_SetTop(val == 0 ? TOP_HARDWARE : OW_TOP, 0, 1); return Feb_Control_SetTop(val == 0 ? TOP_HARDWARE : OW_BOTTOM, 0, 1);
} }
int Feb_Control_SetReadNLines(int value) { int Feb_Control_SetReadNLines(int value) {

View File

@ -54,7 +54,7 @@ bool CmdProxy::ReplaceIfDepreciated(std::string &command) {
if (d_it != depreciated_functions.end()) { if (d_it != depreciated_functions.end()) {
LOG(logWARNING) LOG(logWARNING)
<< command << command
<< " is depreciated and will be removed. Please migrate to: " << " is deprecated and will be removed. Please migrate to: "
<< d_it->second; << d_it->second;
// insert old command into arguments (for dacs) // insert old command into arguments (for dacs)
if (d_it->second == "dac") { if (d_it->second == "dac") {

View File

@ -10,7 +10,6 @@ set(SOURCES
src/ZmqSocket.cpp src/ZmqSocket.cpp
src/UdpRxSocket.cpp src/UdpRxSocket.cpp
src/sls_detector_exceptions.cpp src/sls_detector_exceptions.cpp
# src/sls_detector_defs.cpp
) )
# Header files to install as a part of the library # Header files to install as a part of the library
@ -57,14 +56,12 @@ target_include_directories(slsSupportObject
PUBLIC PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
PRIVATE
${ZeroMQ_INCLUDE_DIRS}
) )
target_link_libraries(slsSupportObject target_link_libraries(slsSupportObject
PUBLIC PUBLIC
slsProjectOptions slsProjectOptions
${ZeroMQ_LIBRARIES} libzmq
rapidjson rapidjson
PRIVATE PRIVATE
slsProjectWarnings slsProjectWarnings
@ -76,7 +73,6 @@ endif(SLS_USE_TESTS)
# Add shared library version of the support lib # Add shared library version of the support lib
add_library(slsSupportShared SHARED $<TARGET_OBJECTS:slsSupportObject>) add_library(slsSupportShared SHARED $<TARGET_OBJECTS:slsSupportObject>)
target_link_libraries(slsSupportShared PUBLIC slsSupportObject) target_link_libraries(slsSupportShared PUBLIC slsSupportObject)
set_target_properties(slsSupportShared PROPERTIES set_target_properties(slsSupportShared PROPERTIES
@ -108,3 +104,4 @@ install(TARGETS slsSupportShared slsSupportStatic slsSupportObject
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sls PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sls
) )

View File

@ -19,21 +19,23 @@ set_target_properties(testserver PROPERTIES
add_executable(tests ${SLS_TEST_SOURCES}) add_executable(tests ${SLS_TEST_SOURCES})
target_link_libraries(tests target_link_libraries(tests
PUBLIC
slsProjectOptions slsProjectOptions
slsProjectWarnings
slsSupportShared slsSupportShared
pthread pthread
rt rt
PRIVATE
slsProjectWarnings
) )
if (SLS_USE_TEXTCLIENT) if (SLS_USE_TEXTCLIENT)
target_link_libraries(tests target_link_libraries(tests PUBLIC
slsDetectorShared slsDetectorShared
) )
endif (SLS_USE_TEXTCLIENT) endif (SLS_USE_TEXTCLIENT)
if (SLS_USE_RECEIVER) if (SLS_USE_RECEIVER)
target_link_libraries(tests target_link_libraries(tests PUBLIC
slsReceiverShared slsReceiverShared
) )
endif (SLS_USE_RECEIVER) endif (SLS_USE_RECEIVER)