mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-18 02:10:41 +02:00
* commands code generation (#803) * commands code generation for only frames command * fix cmake file and add Caller files * working exptime, fully extended commands file and its variants * start adding template commands * add INT_CMD_VEC_ID template * add list command, generate multiple bins, format code * reach 208 commands using the cpp macros * add tests for command parser * start adding tests for commands parser * fix typo to use commands.yaml * add more tests for command_parser * add all template functions (up to 218 commands) * finish template functions and add more CmdProxy.cpp functions (250+) * 257 commands * 300 commands the rest are very special commands * add special commands without generation * separate special functions from generated c++ file * implementing one command for put and get (buggy) * add infer action in a separate file * generate header for special commands from yaml * allow only 0 or 1 for bool inputs * group all commands in gen_commands.py * add help to gen_commands.py * add autocomplete bash script * autocompletion: add support for module levels and help * remove debugging line * add autocompletion, help to commands, change int [0,1] to bool * copy tests for Caller.cpp. Tests pass * update with the new developer branch changes * fix errors after merging (there is problems with tests) * fixed port/stopport in yaml (intput typo), added '_caller' to the test dac and test on chip dac command in global test for cmdcaller * undo previous test simulator debug change * add documentation for the generated code * reducing the comment to be replaced in length so formatting does not split into 2 lines * removed formatting specific style of C++11 in gen_commands.py to keep with the top level clang format of the project * regeneratign code for commands * automation generated * Redirect deprecated commands (#872) * working implementation, need to fix dac * fixed deprecation redirect for dac command * Detector specific autocomplete (#873) * working implementation, need to fix dac * fixed deprecation redirect for dac command * detector specific completion for dac * added autocomplete using detector specific * fixed error when autocompleting partial words * Generate commands/fix commands (#875) * fix vm_a, im_a etc have deg Celsius suffix, also help missing or changed in some places * dac: require det id for all, arg0 to be printed at output, help for onchip dac and dac, onchipdac: spacing * getscan detid and blocking trigger help * udp_Dstlist det_id fixed, but rx_id invalid * cmdApp in line with cmdLineApp (missing version, receiver_id, not creating det object in help action * added set_command to differentiate between check_det_id and require_det_id (mixed up), args: -1 needs to check for at least one argument * reordering * reordering and checked till integer_command_hex * fixed a lot more commands * fix caller tests for eiger * changes to tests after Bechir left * changing .cmd to .cmdcall for the caller commands * fixed tests for caller, still warning for setexptime about cast input * autocomplete ran * add moench test * regenerating autocomplete and commands * fixing other things from merge conflicts (renaming slsDetectorDefs to defs in commands.yaml) * formatting * added code injection to help (#876) * updated 3 commands to have get output that can be put into put (#877) * updated some commands to have get output that can be put into put * fix tests for clkdiv * adding help to free (#878) * removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy) (#879) * More helpful error messages for unsupported actions (#880) * removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy) * Added specific help for unsupported actions * fixed a vetofile get special exception message. more specific warning for special exception message instead of no function warning * added condition checking true in exceptions for special message --------- Co-authored-by: Bechir Brahem <bachbrahem@gmail.com> Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com> Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
131 lines
3.7 KiB
CMake
Executable File
131 lines
3.7 KiB
CMake
Executable File
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
set(SOURCES
|
|
src/DetectorImpl.cpp
|
|
src/Module.cpp
|
|
src/Detector.cpp
|
|
src/HelpDacs.cpp
|
|
src/CmdParser.cpp
|
|
src/Pattern.cpp
|
|
src/CtbConfig.cpp
|
|
src/Caller.cpp
|
|
src/CallerSpecial.cpp
|
|
src/inferAction.cpp
|
|
)
|
|
|
|
add_library(slsDetectorObject OBJECT
|
|
${SOURCES}
|
|
)
|
|
|
|
target_include_directories(slsDetectorObject PUBLIC
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
PRIVATE
|
|
${SLS_INTERNAL_RAPIDJSON_DIR}
|
|
)
|
|
|
|
target_link_libraries(slsDetectorObject
|
|
PUBLIC
|
|
slsProjectOptions
|
|
slsSupportStatic
|
|
pthread
|
|
rt
|
|
PRIVATE
|
|
slsProjectWarnings
|
|
)
|
|
|
|
set(DETECTOR_LIBRARY_TARGETS slsDetectorObject)
|
|
|
|
|
|
set(PUBLICHEADERS
|
|
include/sls/detectorData.h
|
|
include/sls/Detector.h
|
|
include/sls/Result.h
|
|
include/sls/Pattern.h
|
|
)
|
|
|
|
#Shared library
|
|
if(SLS_BUILD_SHARED_LIBRARIES)
|
|
add_library(slsDetectorShared SHARED $<TARGET_OBJECTS:slsDetectorObject>)
|
|
target_link_libraries(slsDetectorShared PUBLIC slsDetectorObject)
|
|
set_target_properties(slsDetectorShared PROPERTIES
|
|
VERSION ${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}
|
|
SOVERSION ${PACKAGE_VERSION_MAJOR}
|
|
LIBRARY_OUTPUT_NAME SlsDetector
|
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
|
PUBLIC_HEADER "${PUBLICHEADERS}"
|
|
)
|
|
list(APPEND DETECTOR_LIBRARY_TARGETS slsDetectorShared)
|
|
endif(SLS_BUILD_SHARED_LIBRARIES)
|
|
|
|
#Static library
|
|
add_library(slsDetectorStatic STATIC $<TARGET_OBJECTS:slsDetectorObject>)
|
|
target_link_libraries(slsDetectorStatic PUBLIC slsDetectorObject)
|
|
|
|
set_target_properties(slsDetectorStatic PROPERTIES
|
|
ARCHIVE_OUTPUT_NAME SlsDetectorStatic
|
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
|
PUBLIC_HEADER "${PUBLICHEADERS}"
|
|
)
|
|
list(APPEND DETECTOR_LIBRARY_TARGETS slsDetectorStatic)
|
|
|
|
|
|
|
|
|
|
|
|
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
|
set_property(TARGET ${DETECTOR_LIBRARY_TARGETS} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
|
endif()
|
|
|
|
|
|
if(SLS_USE_TEXTCLIENT)
|
|
set(det_bin_names "sls_detector_put"
|
|
"sls_detector_get"
|
|
"sls_detector_acquire"
|
|
"sls_detector_help"
|
|
"sls_detector"
|
|
)
|
|
set(det_cmd_name "PUT" "GET" "READOUT" "HELP" "INFER")
|
|
list(LENGTH det_bin_names len1)
|
|
math(EXPR len2 "${len1} - 1")
|
|
|
|
foreach(val RANGE ${len2})
|
|
list(GET det_bin_names ${val} val1)
|
|
list(GET det_cmd_name ${val} val2)
|
|
message(STATUS "${val1} ${val2}")
|
|
|
|
add_executable(${val1} src/CmdApp.cpp)
|
|
|
|
target_link_libraries(${val1}
|
|
slsDetectorStatic
|
|
pthread
|
|
rt
|
|
)
|
|
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")
|
|
|
|
set_target_properties(${val1} PROPERTIES
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
|
COMPILE_DEFINITIONS ${val2}=1
|
|
)
|
|
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
|
set_property(TARGET ${val1} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
|
endif()
|
|
endforeach()
|
|
install(TARGETS ${det_bin_names} DESTINATION bin) # was not there for detp. Include? FIXME
|
|
|
|
|
|
endif(SLS_USE_TEXTCLIENT)
|
|
|
|
if (SLS_USE_TESTS)
|
|
add_subdirectory(tests)
|
|
endif(SLS_USE_TESTS)
|
|
|
|
|
|
install(TARGETS ${DETECTOR_LIBRARY_TARGETS}
|
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sls
|
|
)
|