mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-13 15:34:48 +01:00
* basic ctb config api for register and bit names * tests for define and definelist pass. yet to implement using them for reg, setbit, clearbit and getbit * improved autocomplete for getbit,setbit, clearbit * validate autocomplete * definelist has no put * updating help * converting char array+int in runtimeerror compiles but throws at runtime.Fixed.Tested for it. Also check if string or int before using getregisterdefinitonbyvalue to see if it threw to call the other function. because both of it can throw and we should differentiate the issues for both * removed std::vector<std::pair<string,int> to std::map<string, int> for defiitions list * Dev/define cmd tie bit to reg (#1328) * strong type * moved everythign to bit_utils class * pybindings * added tests for python * removed duplicates * removed bit names in reg * changed BitPosition to BitAddress * Using define reg/bit from python (#1344) * define_bit, define_addr in python. * setBit/clearBit takes int or addr * added example using bits * split define into 2 commands define_reg and define_bit, definelist into 2: definelist_reg and definelist_bit * allow string for register and bit names in c++ api * refactor from github comments * naming refactoring (getRegisterDefnition to retunr name and address specifically * added marker for 8 cmd tests connected to define, changed macro to static constexpr * changed bitPosition from int to uint32_t * got rid of setbitposition and setaddress, instead overloaded constructor to take in strings so that the conversion from string to bit address members, takes place within the class for easy maintainance in case type changes * Removing implicit conversions: RegisterAddresss and RegisterValue: Removed the implicit conversions. RegisterAddress: Changed member name from address_ to value_ and method as well to value(). RegisterValue: Also added | operator to be able to concatenate with uint32_t. Same in python bindings (but could not find the tests to modify * Allowed concatenation with other RegisterValue, made them all constexpr * fix a ctbConfig test * Maponstack works with integration tests, but need unit tests * tests on mapstack * fixed ctb tests and FixedString being initialized with gibberish * removing parsing from string inside the class RegisterAddress, BitAddress and RegisterValue * updated python bindings * fixed bit utils test * renaming getRegisterDefintiionAddress/Name=>getRegisterAddress/Name and similary for getBitDefinitionAddress/Name * updated python bindings * fix tests (format) * a few python tests added and python bindings corrected * replaceing str with __str__ for bit.cpp * repr reimplemented for bit.cpp * removed make with registerAddress etc * starting server for tests per session and nor module * killprocess throws if no process found-> github runs fails, changed to pkill and not throw * clean shm shouldnt raise, in ci binary not found * ignoring these tests for CI, which fail on CI because simulators are not generated in CI. This is in another PR, where it should work --------- Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com> Co-authored-by: froejdh_e <erik.frojdh@psi.ch>
164 lines
4.8 KiB
CMake
Executable File
164 lines
4.8 KiB
CMake
Executable File
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
|
|
|
|
|
|
set(SOURCES
|
|
src/string_utils.cpp
|
|
src/file_utils.cpp
|
|
src/ClientSocket.cpp
|
|
src/DataSocket.cpp
|
|
src/ServerSocket.cpp
|
|
src/ServerInterface.cpp
|
|
src/ToString.cpp
|
|
src/network_utils.cpp
|
|
src/ZmqSocket.cpp
|
|
src/UdpRxSocket.cpp
|
|
src/sls_detector_exceptions.cpp
|
|
src/md5_helper.cpp
|
|
src/Version.cpp
|
|
src/bit_utils.cpp
|
|
)
|
|
|
|
# Header files to install as a part of the library
|
|
set(PUBLICHEADERS
|
|
include/sls/sls_detector_defs.h
|
|
include/sls/sls_detector_exceptions.h
|
|
include/sls/container_utils.h
|
|
include/sls/string_utils.h
|
|
include/sls/network_utils.h
|
|
include/sls/ToString.h
|
|
include/sls/TypeTraits.h
|
|
include/sls/TimeHelper.h
|
|
include/sls/bit_utils.h
|
|
)
|
|
|
|
# Additional headers to be installed if SLS_DEVEL_HEADERS
|
|
# is specified as an option. Aim is to give the developer
|
|
# access to utilities in the support library while
|
|
# at the same time offer a minimal install
|
|
if(SLS_DEVEL_HEADERS)
|
|
set(PUBLICHEADERS
|
|
${PUBLICHEADERS}
|
|
include/sls/ansi.h
|
|
include/sls/logger.h
|
|
include/sls/file_utils.h
|
|
include/sls/sls_detector_funcs.h
|
|
include/sls/ClientSocket.h
|
|
include/sls/DataSocket.h
|
|
include/sls/ServerSocket.h
|
|
include/sls/ServerInterface.h
|
|
include/sls/Timer.h
|
|
include/sls/StaticVector.h
|
|
include/sls/UdpRxSocket.h
|
|
include/sls/versionAPI.h
|
|
include/sls/ZmqSocket.h
|
|
include/sls/bit_utils.h
|
|
include/sls/md5.h
|
|
include/sls/md5_helper.h
|
|
include/sls/Version.h
|
|
)
|
|
endif()
|
|
|
|
|
|
# Library for md5 c code that we are using (and potentially other c code)
|
|
# Maybe this should be broken out into it's own folder etc.
|
|
add_library(md5sls STATIC
|
|
src/md5.c
|
|
)
|
|
|
|
target_include_directories(md5sls
|
|
PUBLIC
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
)
|
|
|
|
|
|
# Create an object library to avoid building the library twice
|
|
add_library(slsSupportObject OBJECT
|
|
${SOURCES}
|
|
${HEADERS}
|
|
)
|
|
|
|
target_include_directories(slsSupportObject
|
|
PUBLIC
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
PRIVATE
|
|
${SLS_INTERNAL_RAPIDJSON_DIR}
|
|
)
|
|
|
|
message(STATUS "RAPID: ${SLS_INTERNAL_RAPIDJSON_DIR}")
|
|
|
|
target_link_libraries(slsSupportObject
|
|
PUBLIC
|
|
slsProjectOptions
|
|
${STD_FS_LIB} # from helpers.cmake
|
|
Threads::Threads # slsDetector and Receiver need this
|
|
|
|
PRIVATE
|
|
slsProjectWarnings
|
|
md5sls
|
|
)
|
|
|
|
#RH8 glibc 2.28, RH9 glibc 2.34 linking rt is only needed with glibc < 2.34
|
|
#but we do it for all Linux builds to avoid too many conditionals
|
|
target_link_libraries (slsSupportObject PUBLIC $<$<PLATFORM_ID:Linux>:rt>)
|
|
|
|
#Treat both vendored and system zmq as interface for receiver binaries
|
|
if(SLS_USE_SYSTEM_ZMQ)
|
|
message(STATUS "slsSupportLib using ZEROMQ_TARGET=${ZEROMQ_TARGET}")
|
|
target_link_libraries(slsSupportObject PRIVATE "${ZEROMQ_TARGET}")
|
|
else()
|
|
target_link_libraries(slsSupportObject PRIVATE "$<BUILD_INTERFACE:libzmq-static>")
|
|
endif()
|
|
|
|
if (SLS_USE_TESTS)
|
|
add_subdirectory(tests)
|
|
endif(SLS_USE_TESTS)
|
|
|
|
#List of targets to support adding removing targets as config
|
|
set(SUPPORT_LIBRARY_TARGETS slsSupportObject)
|
|
|
|
# Add shared library version of the support lib
|
|
if(SLS_BUILD_SHARED_LIBRARIES)
|
|
add_library(slsSupportShared SHARED $<TARGET_OBJECTS:slsSupportObject>)
|
|
target_link_libraries(slsSupportShared PUBLIC slsSupportObject)
|
|
|
|
set_target_properties(slsSupportShared PROPERTIES
|
|
VERSION ${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}
|
|
SOVERSION ${PACKAGE_VERSION_MAJOR}
|
|
LIBRARY_OUTPUT_NAME SlsSupport
|
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
|
PUBLIC_HEADER "${PUBLICHEADERS}"
|
|
)
|
|
list(APPEND SUPPORT_LIBRARY_TARGETS slsSupportShared)
|
|
endif(SLS_BUILD_SHARED_LIBRARIES)
|
|
|
|
# Add static version of the support lib
|
|
add_library(slsSupportStatic STATIC $<TARGET_OBJECTS:slsSupportObject>)
|
|
target_link_libraries(slsSupportStatic PUBLIC slsSupportObject)
|
|
|
|
set_target_properties(slsSupportStatic PROPERTIES
|
|
ARCHIVE_OUTPUT_NAME SlsSupportStatic
|
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
|
PUBLIC_HEADER "${PUBLICHEADERS}"
|
|
)
|
|
list(APPEND SUPPORT_LIBRARY_TARGETS slsSupportStatic)
|
|
|
|
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
|
set_property(TARGET ${SUPPORT_LIBRARY_TARGETS} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
|
endif()
|
|
|
|
|
|
list(APPEND SUPPORT_LIBRARY_TARGETS md5sls)
|
|
|
|
install(TARGETS ${SUPPORT_LIBRARY_TARGETS}
|
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sls
|
|
)
|
|
|
|
|