From 2e122ba49d5693fe841dbfe82bf99a755fbfc650 Mon Sep 17 00:00:00 2001 From: Edward Wall Date: Wed, 10 Sep 2025 12:38:50 +0200 Subject: [PATCH] provide the device driver as a library --- CMakeLists.txt | 46 +++++++++++++++++++++++++++++++++++++++----- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 89 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43c8fa5..7ad3a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,10 +30,14 @@ set( -lutil -lrt # librt for real time guarantees (really just backwards compat) -ldl # libdl for dynamic loading - $ENV{MIDAS_PREFIX}/lib/libmfe.a - $ENV{MIDAS_PREFIX}/lib/libmidas.a + $ENV{MIDASSYS}/lib/libmfe.a + $ENV{MIDASSYS}/lib/libmidas.a ) +################################################################################ +## 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 @@ -54,9 +58,12 @@ else() ) endif() -add_executable( +################################################################################ +## Device Library +################################################################################ + +add_library( keller_dv2ps - frontends/keller_dv2ps_scfe.cxx device/keller_dv2ps.cxx ${DRIVERS} ) @@ -70,8 +77,9 @@ set_property( target_include_directories( keller_dv2ps - PRIVATE + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE $ENV{MIDASSYS}/drivers $ENV{MIDASSYS}/include $ENV{MIDASSYS}/mscb/include @@ -81,3 +89,31 @@ target_link_libraries( keller_dv2ps ${LIBS} ) + +################################################################################ +## Test Frontend +################################################################################ + +add_executable( + keller_dv2ps_fe + frontends/keller_dv2ps_scfe.cxx +) + +set_property( + TARGET + keller_dv2ps_fe + PROPERTY + CXX_STANDARD 11 +) + +target_include_directories( + keller_dv2ps_fe + PRIVATE + $ENV{MIDASSYS}/drivers + $ENV{MIDASSYS}/include +) + +target_link_libraries( + keller_dv2ps_fe + keller_dv2ps +) diff --git a/README.md b/README.md index 9cf643a..83b2e35 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,8 @@ PS Digital Manometer. ## Requirements -Requires a Midas installation with the environment variables `MIDASSYS` and -`MIDAS_PREFIX` pointing to the source code and the built artifacts, -respectively. +Requires a Midas installation with the environment variable `MIDASSYS` pointing +to the built Midas artifacts and headers. ## Build @@ -21,5 +20,50 @@ cmake --build --clean-first -- -j8 ## Run ```bash -/build/driver/keller_dv2ps -e flame +/build/driver/keller_dv2ps_fe -e flame +``` + +## Including in Custom Frontend + +To include this driver in a custom frontend, you should ensure the environment +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 keller_dv2ps repository is outside of the frontend +# repository, you also need to provide a location for the keller_dv2ps +# artifacts as a second argument to `add_subdirectory` +# e.g. `./device/keller_dv2ps` +add_subdirectory( + +) + +add_executable( + + + + : +) + +set_property( + TARGET + + PROPERTY + CXX_STANDARD 11 +) + +target_include_directories( + + PRIVATE + $ENV{MIDASSYS}/drivers + $ENV{MIDASSYS}/include +) + +target_link_libraries( + + keller_dv2ps + + + : +) ```