Added target for library

This commit is contained in:
2026-04-16 13:16:09 +02:00
parent f95d106d65
commit 87003df25c
5 changed files with 31 additions and 17 deletions
+20
View File
@@ -41,6 +41,24 @@ set(LIBS
$ENV{MIDASSYS}/lib/libmscb.a
)
################################################################################
## Driver Library
################################################################################
add_library(
m_epics_ca
INTERFACE
)
target_sources(m_epics_ca INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/bus/m_epics_ca.h
${CMAKE_CURRENT_SOURCE_DIR}/bus/m_epics_ca.tpp
)
target_include_directories(m_epics_ca INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/bus
)
################################################################################
## Test executable
################################################################################
@@ -62,6 +80,7 @@ target_include_directories(
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
m_epics_ca
$ENV{MIDASSYS}/drivers
$ENV{MIDASSYS}/include
# This is redundant if MIDASSYS =/ Midas repo, but needed if MIDAS has been
@@ -77,6 +96,7 @@ target_include_directories(
target_link_libraries(
m_epics_ca_test
m_epics_ca
${LIBS}
)
+1 -1
View File
@@ -42,7 +42,7 @@ template <typename T> constexpr int dbfFromType() {
}
}
template <typename T, typename V> void assertEqual() {
template <typename T, typename V> constexpr void assertEqual() {
static_assert(dbfFromType<T>() == dbfFromType<V>());
}
-6
View File
@@ -1,11 +1,5 @@
#!/usr/local/bin/iocsh
errlogInit(10000)
dbLoadRecords("$(IOCDIR)/record.db")
iocInit()
# Apparently, the IOC needs a bit of time to "settle" down before exiting st.cmd
# This is again typical EPICS shenaningans ...
epicsThreadSleep(1.0)
+3 -7
View File
@@ -2,13 +2,9 @@
export EPICS_BASE=/usr/local/epics/base-7.0.7
export EPICS_HOST_ARCH=RHEL8-x86_64
export EPICS_CA_AUTO_ADDR_LIST=NO
# Detect primary IPv4 used for routing
IP=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')
export EPICS_CAS_INTF_ADDR_LIST="$IP"
export EPICS_CA_ADDR_LIST="$IP"
export EPICS_CAS_INTF_ADDR_LIST=127.0.0.1
export EPICS_CA_ADDR_LIST=127.0.0.1
cd "$(dirname "$0")"
export IOCDIR=$(pwd)
./st.cmd
./st.cmd
+7 -3
View File
@@ -1,5 +1,5 @@
#include "bus/m_epics_ca.h"
#include "cadef.h"
#include "m_epics_ca.h"
#include <cassert>
#include <chrono>
#include <iostream>
@@ -38,7 +38,7 @@ class IocProcess {
setpgid(0, 0);
execl(path.c_str(), path.c_str(), (char *)nullptr);
perror("execl failed");
_exit(127);
_exit(1);
}
if (_pid < 0) {
@@ -77,6 +77,10 @@ class IocProcess {
int main() {
// Client setting for local testing
setenv("EPICS_CA_AUTO_ADDR_LIST", "NO", 1);
setenv("EPICS_CA_ADDR_LIST", "127.0.0.255", 1);
// Scope everything so the IOC gets torn down by the IocProcess destructor
// before reporting that the tests were successfull.
{
@@ -146,7 +150,7 @@ int main() {
EQUAL(double_val, new_double_val);
}
printf("\nTest was successfull\n");
printf("\nTest was successful\n");
return 0;
}