Skip to content

Commit

Permalink
use gnu install dirs for cmake install rules
Browse files Browse the repository at this point in the history
added variable to configure sysctl directory

simplify systemd unit directory and default
  • Loading branch information
guruofquality committed Nov 2, 2020
1 parent f0209ab commit f7a39bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")

# Use standard GNU install paths
include(GNUInstallDirs)

#find soapy sdr with modern cmake support
find_package(SoapySDR "0.8.0" CONFIG)

Expand Down
4 changes: 2 additions & 2 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ if (MSVC)
target_include_directories(SoapySDRServer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/msvc)
endif ()

install(TARGETS SoapySDRServer DESTINATION bin)
install(TARGETS SoapySDRServer DESTINATION ${CMAKE_INSTALL_BINDIR})

#install man pages for the application executable
install(FILES SoapySDRServer.1 DESTINATION share/man/man1)
install(FILES SoapySDRServer.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)

########################################################################
# Thread config support
Expand Down
16 changes: 6 additions & 10 deletions system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
option(ENABLE_SYSTEMD "Install systemd unit" ON)
if(ENABLE_SYSTEMD)

if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
set(SYSTEMD_UNIT_INSTALL_DIR /lib/systemd/system)
else()
#source installs will use the install prefix
set(SYSTEMD_UNIT_INSTALL_DIR lib/systemd/system)
endif()

set(SYSTEMD_UNIT_DIR "${SYSTEMD_UNIT_INSTALL_DIR}" CACHE STRING "Directory to install systemd unit")
set(SYSTEMD_UNIT_DIR "lib/systemd/system" CACHE STRING "Directory to install systemd unit")

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/SoapySDRServer.service.in
Expand All @@ -20,16 +13,19 @@ if(ENABLE_SYSTEMD)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/SoapySDRServer.service
DESTINATION ${SYSTEMD_UNIT_DIR})
DESTINATION "${SYSTEMD_UNIT_DIR}")
endif()

########################################################################
# Increase the sysctl network limits
########################################################################
option(ENABLE_SYSCTL "Install kernel tweaks for socket buffer sizes" ON)
if(ENABLE_SYSCTL)

set(SYSCTL_CONFIG_DIR "lib/sysctl.d" CACHE STRING "Directory to install sysctl.d configs")

install(
FILES SoapySDRServer.sysctl
RENAME 10-SoapySDRServer.conf
DESTINATION lib/sysctl.d)
DESTINATION "${SYSCTL_CONFIG_DIR}")
endif()
2 changes: 1 addition & 1 deletion system/SoapySDRServer.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Wants=network-online.target
After=network-online.target

[Service]
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/SoapySDRServer --bind
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/SoapySDRServer --bind
KillMode=process
Restart=on-failure
LimitRTPRIO=99
Expand Down

0 comments on commit f7a39bb

Please sign in to comment.