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

Merged
wall_e merged 1 commits from trying_to_remove_dups into main 2026-08-24 10:30:22 +02:00
3 changed files with 59 additions and 51 deletions

No files matched your search

+43 -17
View File
@@ -63,9 +63,9 @@ foreach(target IN ITEMS el734 el734new el734_12MOT)
$ENV{MIDASSYS}/drivers
)
target_link_libraries(${target}
PUBLIC
${LIBS}
target_link_libraries(
${target}
${LIBS}
)
endforeach()
@@ -83,45 +83,71 @@ target_compile_definitions(
)
################################################################################
## Test Frontends
## Default Frontend Builder
################################################################################
if(${BUILD_FRONTEND})
set(_DEFAULT_EL734_FRONTEND_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
# Example name from GPS
set(EL734_FRONTEND_NAME "smel734" CACHE STRING "Overridable frontend name")
function(default_el734_frontend F_TARGET F_NAME F_EVENT_ID)
# Has optional default args EL734_TARGET NUM_AXES
if(ARGC GREATER 3)
set(EL734_TARGET "${ARGV3}")
else()
set(EL734_TARGET el734)
endif()
if(ARGC GREATER 4)
set(NUM_AXES "${ARGV4}")
else()
set(NUM_AXES 2)
endif()
if(EL734_TARGET STREQUAL "el734")
set(F_HEADER "device/el734dev.h")
elseif(EL734_TARGET STREQUAL "el734_12MOT")
set(F_HEADER "device/el734dev.h")
else()
set(F_HEADER "device/el734.h")
endif()
message("EL734: ${F_NAME} ${F_EVENT_ID} ${EL734_TARGET} ${NUM_AXES} ${F_HEADER}")
add_executable(
el734_scfe
frontend/el734_flame_fe.cxx
${F_TARGET}
"${_DEFAULT_EL734_FRONTEND_DIR}/frontend/el734_flame_fe.cxx"
)
add_compile_definitions(el734_scfe PRIVATE FRONTEND_NAME="${EL734_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_AXES=${NUM_AXES})
target_compile_definitions(${F_TARGET} PRIVATE FRONTEND_HEADER="${F_HEADER}")
set_property(
TARGET
el734_scfe
${F_TARGET}
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
el734_scfe
${F_TARGET}
PRIVATE
$ENV{MIDASSYS}/drivers
)
find_package(Midas REQUIRED)
target_link_libraries(
el734_scfe
el734
${F_TARGET}
${EL734_TARGET}
midas::mfe
)
install(
TARGETS
el734_scfe
${F_TARGET}
RUNTIME DESTINATION bin
)
endif()
endfunction()
+13 -31
View File
@@ -1,7 +1,7 @@
# EL734 motion controller
This repository contains the driver code and "default" Midas frontend for the
EL734 motion controller (developed in-house at PSI).
EL734 motion controller (developed in-house at PSI).
## Requirements
@@ -30,40 +30,22 @@ variable `MIDASSYS` points to your system install and include a snippet in your
`CMakeLists.txt` similar to the following:
```CMake
# If the path to the copley_stepnet repository is outside of the frontend
# repository, you also need to provide a location for the copley_stepnet
# If the path to the el734 repository is outside of the frontend
# repository, you also need to provide a location for the el734
# artifacts as a second argument to `add_subdirectory`
# e.g. `./device/copley_stepnet`
# e.g. `./device/el734`
add_subdirectory(
<path-to-copley_stepnet-repository>
<path-to-el734-repository>
)
add_executable(
<frontend-name>
<frontend-code-path-1>
<frontend-code-path-2>
:
)
# Target Name Frontend Name Event Id
default_el734_frontend(Sample_angle_scfe Sample_angle 7 )
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>
el734
<additional-library-1>
<additional-library-2>
:
default_el734_frontend(
GPD_Positions_scfe # Target Name
GPD_Positions # Frontend Name
90 # Event ID
el734_12MOT # Non-default library version
12 # Non-default number of motor axes
)
```
+3 -3
View File
@@ -56,7 +56,7 @@ extern BOOL should_exit;
#include <stdio.h>
#include "midas.h"
#include "class/generic.h"
#include "device/el734dev.h"
#include FRONTEND_HEADER
#include "bus/tcpip.h"
/*-- Globals -------------------------------------------------------*/
@@ -98,7 +98,7 @@ BOOL equipment_common_overwrite = FALSE;
/* device driver list */
DEVICE_DRIVER sm_driver[] = {
{"EL734", el734dev, 2, tcpip, DF_PRIO_DEVICE},
{"EL734", el734dev, FRONTEND_AXES, tcpip, DF_PRIO_DEVICE},
/* only initial demand value is taken from instrument */
};
@@ -106,7 +106,7 @@ EQUIPMENT equipment[] = {
{
FRONTEND_NAME, /* equipment name */
{7, 0, /* event ID, trigger mask */
{FRONTEND_ID, 0, /* event ID, trigger mask */
"SYSTEM", /* event buffer */
EQ_SLOW, /* equipment type */
0, /* event source */