Skip to content

move to cmake, ctest, cpack to build direwolf #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cmake: move install-conf target to conf/install_conf.cmake file
this way permit to use cmake language to manipulate the target and
avoid restriction imposed by CMAKE_COMMAND command mode
  • Loading branch information
ra1nb0w committed Nov 9, 2019
commit d06b6446309e835d2bec63c7052f52f32d8180e9
16 changes: 8 additions & 8 deletions conf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand All @@ -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()
23 changes: 23 additions & 0 deletions conf/install_conf.cmake
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 2 additions & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
5 changes: 0 additions & 5 deletions scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
6 changes: 0 additions & 6 deletions scripts/telemetry-toolkit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
15 changes: 15 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <name> COMMAND <command> [<arg>...]
# [CONFIGURATIONS <config>...]
# [WORKING_DIRECTORY <dir>])


endif()