Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
src/apps/halcs_generic_udev: add option to build app or not
Browse files Browse the repository at this point in the history
  • Loading branch information
lerwys committed Apr 30, 2020
1 parent b5c502b commit 2feeac4
Showing 1 changed file with 48 additions and 40 deletions.
88 changes: 48 additions & 40 deletions src/apps/halcs_generic_udev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ set (halcs_generic_udev_OUTPUT_BASENAME "halcs_generic_udev"
# User compile-time options
########################################################################

option(BUILD_halcs_generic_udev "Whether or not to build halcs_generic_udev" ON)

if(BUILD_halcs_generic_udev)
list(APPEND apps_halcs_generic_udev "halcs_generic_udev")
endif()

#######################################
# HALCS_GENERIC_UDEV
#######################################
Expand Down Expand Up @@ -60,46 +66,48 @@ set(NOPREFIX_HALCS_SYSCONFDIR "halcs")
# Binaries declaration
########################################################################

# install config files
if(halcs_generic_udev_INSTALL_UDEV_RULES)
# general scripts location
set(halcs_generic_udev_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/halcs)
install(DIRECTORY DESTINATION ${halcs_generic_udev_INSTALL_DATADIR})

# general scripts
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/find-script.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/get-fpga-gateware-properties.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/get-halcs-idxs.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/run-fpga-program.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/stop-fpga-program.sh
DESTINATION ${halcs_generic_udev_INSTALL_DATADIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

# udev files. Use an install script so we are able to change the
# absolute paths of systemd unit files on install, which can be
# prefixed by CMAKE_INSTALL_PREFIX. SYSTEMD variables are always fixed
# to an absolute path.
install(CODE "set(SYSTEMD_SERVICES_INSTALL_DIR ${SYSTEMD_SERVICES_INSTALL_DIR})")
install(CODE "set(SYSTEMD_CONF_INSTALL_DIR ${SYSTEMD_CONF_INSTALL_DIR})")
install(CODE "set(UDEV_SYSCONFDIR ${UDEV_SYSCONFDIR})")
install(CODE "set(NOPREFIX_HALCS_SYSCONFDIR ${NOPREFIX_HALCS_SYSCONFDIR})")

# udev rules
install(CODE "set(input_file
\"${CMAKE_CURRENT_SOURCE_DIR}/init/systemd/etc/udev/rules.d/50-udev_fpga.rules.in\")")
install(CODE "set(output_file
\"${CMAKE_CURRENT_BINARY_DIR}/init/systemd/50-udev_fpga.rules\")")
install(SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/CMakeConfigureInstall.cmake")

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/init/systemd/50-udev_fpga.rules
DESTINATION ${UDEV_SYSCONFDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ
)
if(BUILD_halcs_generic_udev)
# install config files
if(halcs_generic_udev_INSTALL_UDEV_RULES)
# general scripts location
set(halcs_generic_udev_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/halcs)
install(DIRECTORY DESTINATION ${halcs_generic_udev_INSTALL_DATADIR})

# general scripts
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/find-script.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/get-fpga-gateware-properties.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/get-halcs-idxs.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/run-fpga-program.sh
${CMAKE_CURRENT_SOURCE_DIR}/init-generic/share/halcs/scripts/stop-fpga-program.sh
DESTINATION ${halcs_generic_udev_INSTALL_DATADIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

# udev files. Use an install script so we are able to change the
# absolute paths of systemd unit files on install, which can be
# prefixed by CMAKE_INSTALL_PREFIX. SYSTEMD variables are always fixed
# to an absolute path.
install(CODE "set(SYSTEMD_SERVICES_INSTALL_DIR ${SYSTEMD_SERVICES_INSTALL_DIR})")
install(CODE "set(SYSTEMD_CONF_INSTALL_DIR ${SYSTEMD_CONF_INSTALL_DIR})")
install(CODE "set(UDEV_SYSCONFDIR ${UDEV_SYSCONFDIR})")
install(CODE "set(NOPREFIX_HALCS_SYSCONFDIR ${NOPREFIX_HALCS_SYSCONFDIR})")

# udev rules
install(CODE "set(input_file
\"${CMAKE_CURRENT_SOURCE_DIR}/init/systemd/etc/udev/rules.d/50-udev_fpga.rules.in\")")
install(CODE "set(output_file
\"${CMAKE_CURRENT_BINARY_DIR}/init/systemd/50-udev_fpga.rules\")")
install(SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/CMakeConfigureInstall.cmake")

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/init/systemd/50-udev_fpga.rules
DESTINATION ${UDEV_SYSCONFDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ
)
endif()
endif()

# set list to global, as linker options are passed through this
Expand Down

0 comments on commit 2feeac4

Please sign in to comment.