adds function to build default frontend with custom name and event id

This commit is contained in:
2026-08-24 14:51:39 +02:00
parent e0a0eb0de6
commit c33bbfaa35
3 changed files with 26 additions and 83 deletions
+19 -53
View File
@@ -37,22 +37,9 @@ if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
set(LIBS ${LIBS} -lpthread -lutil -lrt -lbsd -ldl)
endif()
option(
BUILD_FRONTEND
"If ON, build the default frontend executable"
OFF
)
set(CMAKE_PREFIX_PATH "$ENV{MIDASSYS}")
find_package(Midas REQUIRED)
set(
TCPIP_DRIVER_DIR
$ENV{MIDASSYS}/drivers/bus/tcpip.cxx
CACHE STRING
"path to tcpip driver that should be used"
)
set(SYS_LIBS
pthread
util
@@ -66,8 +53,6 @@ set(MIDAS_LIBS
midas::mscb
)
set(TCPIP_DRIVER)
set(LIBS ${SYS_LIBS} ${MIDAS_LIBS})
set(EPICS_LIBS
${LIBS}
@@ -79,29 +64,6 @@ if(NOT TARGET midas_lan_gpib)
add_subdirectory(midas_lan_gpib)
endif()
################################################################################
## make tcpip library configurable
################################################################################
if(IS_DIRECTORY ${TCPIP_DRIVER_DIR})
add_subdirectory(
# TODO not sure, should it be a submodule? does it really make sense to
# separate everything?
${TCPIP_DRIVER_DIR} ./bus/tcpip
)
set(
LIBS
${LIBS}
tcpip
)
else()
set(
TCPIP_DRIVER
${TCPIP_DRIVER_DIR}
)
endif()
################################################################################
## Device Libraries
################################################################################
@@ -110,8 +72,7 @@ add_library(
expmag
device/expmag.cxx
device/spline.cxx
${TCPIP_DRIVER}
$ENV{MIDASSYS}/drivers/class/generic.cxx
$ENV{MIDASSYS}/drivers/bus/tcpip.cxx
)
set_property(
@@ -143,8 +104,7 @@ add_library(
device/expmag.cxx
device/epics_ca.cxx
device/spline.cxx
${TCPIP_DRIVER}
$ENV{MIDASSYS}/drivers/class/generic.cxx
$ENV{MIDASSYS}/drivers/bus/tcpip.cxx
)
set_property(
@@ -181,27 +141,32 @@ target_compile_definitions(
)
################################################################################
## Test Frontend
## Default Frontend Builder
################################################################################
if(${BUILD_FRONTEND})
set(EXPMAG_FRONTEND_NAME "Magnets_instr" CACHE STRING "Overridable frontend name")
set(_DEFAULT_EXPMAG_FRONTEND_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
function(default_expmag_frontend F_TARGET F_NAME F_EVENT_ID F_NUM_CHAN)
add_executable(
Magnets_instr_scfe
frontend/expmag_scfe.cxx
${F_TARGET}
${_DEFAULT_EXPMAG_FRONTEND_DIR}/frontend/expmag_scfe.cxx
$ENV{MIDASSYS}/drivers/class/generic.cxx
)
add_compile_definitions(Magnets_instr_scfe PRIVATE FRONTEND_NAME="${EXPMAG_FRONTEND_NAME}")
target_compile_definitions(${F_TARGET} PRIVATE FRONTEND_NAME="${F_NAME}")
target_compile_definitions(${F_TARGET} PRIVATE FRONTEND_ID=${F_EVENT_ID})
target_compile_definitions(${F_TARGET} PRIVATE FRONTEND_NUM_CHAN=${F_NUM_CHAN})
set_property(
TARGET
Magnets_instr_scfe
${F_TARGET}
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
Magnets_instr_scfe
${F_TARGET}
PRIVATE
$ENV{MIDASSYS}/drivers
$ENV{MIDASSYS}/include
@@ -209,14 +174,15 @@ if(${BUILD_FRONTEND})
)
target_link_libraries(
Magnets_instr_scfe
${F_TARGET}
expmag_epics
midas::mfe
)
install(
TARGETS
Magnets_instr_scfe
${F_TARGET}
RUNTIME DESTINATION bin
)
endif()
endfunction()
+5 -27
View File
@@ -41,32 +41,10 @@ add_subdirectory(
<path-to-expmag-repository>
)
add_executable(
<frontend-name>
<frontend-code-path-1>
<frontend-code-path-2>
:
)
set_property(
TARGET
<frontend-name>
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
<frontend-name>
PRIVATE
$ENV{MIDASSYS}/drivers
$ENV{MIDASSYS}/include
)
target_link_libraries(
<frontend-name>
expmag
<additional-library-1>
<additional-library-2>
:
default_expmag_frontend(
Magnets_instr_scfe # Target Name
Magnets_instr # Frontend Name
16 # Event ID
4 # Number of channels
)
```
+2 -3
View File
@@ -57,8 +57,7 @@ BOOL equipment_common_overwrite = FALSE;
/* device driver list */
DEVICE_DRIVER expmag_driver[] = {
{FRONTEND_NAME, expmag, 9, NULL,
DF_PRIO_DEVICE}, /* initial demand value taken from instrument */
{"EXPMAG", expmag, FRONTEND_NUM_CHAN, NULL, DF_PRIO_DEVICE}, /* initial demand value taken from instrument */
};
EQUIPMENT equipment[] = {
@@ -66,7 +65,7 @@ EQUIPMENT equipment[] = {
{
FRONTEND_NAME, /* equipment name */
{
16,
FRONTEND_ID,
0, /* event ID, trigger mask */
"SYSTEM", /* event buffer */
EQ_SLOW, /* equipment type */