diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index 61d668e..91b9e41 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -24,7 +24,6 @@ string(REGEX REPLACE "^%C%([^\n]*)" "\\1" file_content "${file_content}") file(WRITE "${CMAKE_BINARY_DIR}/direwolf.conf" "${file_content}") - # install udev rules for CM108 if(LINUX) install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION etc/udev/rules.d/) @@ -37,12 +36,13 @@ install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION share/doc/${CMAKE_PROJEC # This step would be done as ordinary user. # Some people like to put the direwolf config file in /etc/ax25. # Note that all of these are also in $(DESTDIR)/share/doc/direwolf/examples/. -add_custom_target(install-conf-conf - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/direwolf.conf" ~ - COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_CONF_DIR}/sdr.conf" ~ - ) - if(NOT WIN32) - add_custom_target(install-conf) - add_dependencies(install-conf install-conf-conf install-conf-scripts install-conf-telemetry) + add_custom_target(install-conf + COMMAND ${CMAKE_COMMAND} + -DCMAKE_BINARY_DIR="${CMAKE_BINARY_DIR}" + -DCUSTOM_CONF_DIR="${CUSTOM_CONF_DIR}" + -DCUSTOM_SCRIPTS_DIR="${CUSTOM_SCRIPTS_DIR}" + -DCUSTOM_TELEMETRY_DIR="${CUSTOM_TELEMETRY_DIR}" + -P "${CMAKE_SOURCE_DIR}/conf/install_conf.cmake" + ) endif() diff --git a/conf/install_conf.cmake b/conf/install_conf.cmake new file mode 100644 index 0000000..8abfe96 --- /dev/null +++ b/conf/install_conf.cmake @@ -0,0 +1,23 @@ +if(NOT EXISTS ~/direwolf.conf) + install(FILES "${CMAKE_BINARY_DIR}/direwolf.conf" DESTINATION ~) +endif() + +if(NOT EXISTS ~/sdr.conf) + install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION ~) +endif() + +if(NOT EXISTS ~/dw-start.sh) + install(FILES "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION ~) +endif() + +if(NOT EXISTS ~/telem-m0xer-3.txt) + install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" DESTINATION ~) +endif() + +if(NOT EXISTS ~/telem-balloon.conf) + install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" DESTINATION ~) +endif() + +if(NOT EXISTS ~/telem-volts.conf) + install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" DESTINATION ~) +endif() diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index d2af835..7675b95 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -26,6 +26,8 @@ set(SYMBOLSX_TXT_BKP "symbolsX.txt.old") set(SYMBOLSX_URL "http://www.aprs.org/symbols/symbolsX.txt") set(CUSTOM_BINARY_DATA_DIR "${CMAKE_BINARY_DIR}/data") +# we can also move to a separate cmake file and use file(download) +# see conf/install_conf.cmake as example file(COPY "${CUSTOM_DATA_DIR}/${TOCALLS_TXT}" DESTINATION "${CUSTOM_BINARY_DATA_DIR}") file(COPY "${CUSTOM_DATA_DIR}/${SYMBOLS-NEW_TXT}" DESTINATION "${CUSTOM_BINARY_DATA_DIR}") file(COPY "${CUSTOM_DATA_DIR}/${SYMBOLSX_TXT}" DESTINATION "${CUSTOM_BINARY_DATA_DIR}") diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 1a3d612..dae8d50 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -2,10 +2,5 @@ if(NOT WIN32) install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dwespeak.sh" DESTINATION bin) install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples) - - add_custom_target(install-conf-scripts - COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" ~ - ) - add_subdirectory(telemetry-toolkit) endif() diff --git a/scripts/telemetry-toolkit/CMakeLists.txt b/scripts/telemetry-toolkit/CMakeLists.txt index 5d44c21..2adc3e3 100644 --- a/scripts/telemetry-toolkit/CMakeLists.txt +++ b/scripts/telemetry-toolkit/CMakeLists.txt @@ -1,9 +1,3 @@ -add_custom_target(install-conf-telemetry - COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" ~ - COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" ~ - COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" ~ - ) - install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-balloon.pl" DESTINATION bin) install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-bits.pl" DESTINATION bin) install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-data.pl" DESTINATION bin) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 501ed4a..067b0c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -438,3 +438,18 @@ install(TARGETS kissutil DESTINATION bin) if(UDEV_FOUND) install(TARGETS cm108 DESTINATION bin) endif() + + + +## TESTS +# Note CMake will generate tests only if the enable_testing() command +# has been invoked. The CTest module invokes the command automatically +# when the BUILD_TESTING option is ON. +include(CTest) +if(BUILD_TESTING) + # add_test(NAME COMMAND [...] + # [CONFIGURATIONS ...] +# [WORKING_DIRECTORY ]) + + +endif()