Skip to content

Commit

Permalink
added systemd service for excecution
Browse files Browse the repository at this point in the history
  • Loading branch information
faressc committed Mar 18, 2024
1 parent e7ece4f commit 7668e3c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ target_link_libraries(${PROJECT_NAME} PUBLIC jack lo yaml-cpp::yaml-cpp)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${INSTALL_POSTFIX}")

include(cmake/install.cmake)
add_subdirectory(systemd)

# Exclude from all also makes sure that the test libs are not installed
# https://stackoverflow.com/questions/64900981/how-do-you-prevent-cmake-from-install-ing-targets-from-within-projects-include
# but this is not a good solution, TODO: find a better solution
if (BUILD_TESTS)
add_subdirectory(test)
endif()
3 changes: 3 additions & 0 deletions systemd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/audio-matrix.service.in ${CMAKE_CURRENT_BINARY_DIR}/audio-matrix.service @ONLY)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/audio-matrix.service DESTINATION /etc/systemd/user)
14 changes: 14 additions & 0 deletions systemd/audio-matrix.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=@PROJECT_NAME@
After=jack.service
Requires=jack.service

[Service]
Type=notify
ExecStart=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/@PROJECT_NAME@ --configfile @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_SYSCONFDIR@/@PROJECT_NAME@/@[email protected]
LimitRTPRIO=95
LimitRTTIME=infinity
LimitMEMLOCK=infinity

[Install]
WantedBy=default.target

0 comments on commit 7668e3c

Please sign in to comment.