diff options
| author | Thijs Paelman <thijs@ouroboros.rocks> | 2025-11-11 19:20:06 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2025-11-24 13:29:37 +0100 |
| commit | 3430c1a0c99e52685783a58c1c717eb54aa06a69 (patch) | |
| tree | be13c3d26cc75e5b4448a542110e345f553dad1c | |
| parent | e54be25b524316006d7a36893c8847d438df06e5 (diff) | |
| download | ouroboros-3430c1a0c99e52685783a58c1c717eb54aa06a69.tar.gz ouroboros-3430c1a0c99e52685783a58c1c717eb54aa06a69.zip | |
build: Fix systemd --config option
The --config command line parameter in the systemd service unit was
never properly set at install, because the CMake variables
LIBTOML_LIBRARIES and DISABLE_CONFIGFILE are only defined after
descending into the `src/` directory. The systemd service file is
correctly configured if CMake does this *after* it processed
`src/irmd/CMakeLists.txt`.
There should also be a path seperator in between the config directory
and the config file, which wasn't the case anymore due to
e35302ca0ab64edd21b9d8e40d3aa74a3a4f4f7e.
Refine the config file wording at the same moment.
Signed-off-by: Thijs Paelman <thijs@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
| -rw-r--r-- | CMakeLists.txt | 52 | ||||
| -rw-r--r-- | irmd.conf.in | 9 |
2 files changed, 31 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 978da287..66acf0e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,31 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ouroboros-dev.pc" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ouroboros-irm.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +include(CTest) # Sets BUILD_TESTING by default to on. +# BUILD_TESTS: control if tests are included by CMAKE for this project. +if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) + set(BUILD_TESTS ON) +else () + set(BUILD_TESTS OFF) +endif() +add_custom_target(build_tests) +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) +add_dependencies(check build_tests) + +find_package(ProtobufC QUIET) +if (NOT (PROTOBUF_C_INCLUDE_DIRS AND PROTOBUF_C_LIBRARY + AND PROTOBUF_PROTOC_C_EXECUTABLE)) + message(FATAL_ERROR "Protobuf C compiler required but not found. " + "Please install Google Protocol Buffers.") +else () + message(STATUS "Found protobuf C compiler in ${PROTOBUF_PROTOC_C_EXECUTABLE}") +endif () +include_directories(${PROTOBUF_C_INCLUDE_DIRS}) + +add_subdirectory(include) +add_subdirectory(src) +add_subdirectory(doc) + # modified from https://github.com/ximion/limba set(SYSTEMD_INSTALL_FILES "DETECT" CACHE STRING "Install systemd .service files (NO (never), DETECT (use pkg-config - default),\ @@ -166,7 +191,7 @@ if (SYSTEMD_INSTALL_FILES STREQUAL "DETECT" OR SYSTEMD_INSTALL_FILES STREQUAL "F if (NOT ${SYSTEMD_UNITDIR_INTERNAL} STREQUAL "") message(STATUS "Systemd service installation enabled to: ${SYSTEMD_UNITDIR_INTERNAL}") if (LIBTOML_LIBRARIES AND NOT DISABLE_CONFIGFILE) - set (CONFIGURE_STRING "--config ${OUROBOROS_CONFIG_DIR}${OUROBOROS_CONFIG_FILE}") + set (CONFIGURE_STRING "--config ${OUROBOROS_CONFIG_DIR}/${OUROBOROS_CONFIG_FILE}") else () set (CONFIGURE_STRING "") endif () @@ -179,31 +204,6 @@ else () message(STATUS "Systemd service installation disabled by user") endif() -include(CTest) # Sets BUILD_TESTING by default to on. -# BUILD_TESTS: control if tests are included by CMAKE for this project. -if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) - set(BUILD_TESTS ON) -else () - set(BUILD_TESTS OFF) -endif() -add_custom_target(build_tests) -add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) -add_dependencies(check build_tests) - -find_package(ProtobufC QUIET) -if (NOT (PROTOBUF_C_INCLUDE_DIRS AND PROTOBUF_C_LIBRARY - AND PROTOBUF_PROTOC_C_EXECUTABLE)) - message(FATAL_ERROR "Protobuf C compiler required but not found. " - "Please install Google Protocol Buffers.") -else () - message(STATUS "Found protobuf C compiler in ${PROTOBUF_PROTOC_C_EXECUTABLE}") -endif () -include_directories(${PROTOBUF_C_INCLUDE_DIRS}) - -add_subdirectory(include) -add_subdirectory(src) -add_subdirectory(doc) - # Uninstall target configure_file("${CMAKE_SOURCE_DIR}/cmake/CmakeUninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake/CmakeUninstall.cmake" IMMEDIATE @ONLY) diff --git a/irmd.conf.in b/irmd.conf.in index 83ab19b5..cdfd0309 100644 --- a/irmd.conf.in +++ b/irmd.conf.in @@ -1,9 +1,10 @@ ### Example Ouroboros configuration file # -# This file contains a summary of current machine configuration -# options for the O7s prototype. The IRMd will attempt to load its -# configuration file during startup from the file -# @OUROBOROS_CONFIG_DIR@@OUROBOROS_CONFIG_FILE@. +# This file contains a summary of current machine configuration options +# for the O7s prototype. The IRMd systemd service will by default +# attempt to load its configuration file during startup from the file +# @OUROBOROS_CONFIG_DIR@/@OUROBOROS_CONFIG_FILE@. +# If not found, it will error out. # # At the top level, it accepts configuration of # services via the "name" directive, and configuration of the network |
