Skip to content

Commit 1cf5a22

Browse files
committed
cmake: implement basic cpack functionality
to create ZIP package run cpack to add new generator modify CPACK_GENERATOR variable. NOTE: pay attention on CPU flags optimization when you redistribuite the package (segmentation fault)
1 parent 1ab26c6 commit 1cf5a22

File tree

10 files changed

+96
-64
lines changed

10 files changed

+96
-64
lines changed

CMakeLists.txt

+32-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ set(CUSTOM_TEST_DIR "${CMAKE_SOURCE_DIR}/test")
8282
set(CUSTOM_TEST_SCRIPTS_DIR "${CUSTOM_TEST_DIR}/scripts")
8383
set(CUSTOM_SHELL_SHABANG "#!/bin/sh -e")
8484

85+
# cpack variables
86+
set(CPACK_GENERATOR "ZIP")
87+
set(CPACK_STRIP_FILES true)
88+
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
89+
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${direwolf_VERSION}_${CMAKE_SYSTEM_PROCESSOR}")
90+
set(CPACK_PACKAGE_CONTACT "https://github.com/wb2osz/direwolf")
91+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Dire Wolf is a software soundcard AX.25 packet modem/TNC and APRS encoder/decoder")
92+
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
93+
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
94+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
95+
set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR};/.git/;.gitignore;menu.yml;.travis.yml;.appveyor.yml;default.nix;.envrc;TODOs.org;/.scripts/")
96+
8597
# if we don't set build_type
8698
if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
8799
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
@@ -152,6 +164,23 @@ elseif (C_GCC)
152164
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmax-errors=1")
153165
endif()
154166

167+
# set installation directories
168+
if (WIN32 OR CYGWIN)
169+
set(INSTALL_BIN_DIR ".")
170+
set(INSTALL_DOC_DIR "doc")
171+
set(INSTALL_CONF_DIR ".")
172+
set(INSTALL_SCRIPTS_DIR "scripts")
173+
set(INSTALL_MAN_DIR "man")
174+
set(INSTALL_DATA_DIR "data")
175+
else()
176+
set(INSTALL_BIN_DIR "bin")
177+
set(INSTALL_DOC_DIR "share/doc/${CMAKE_PROJECT_NAME}")
178+
set(INSTALL_CONF_DIR "${INSTALL_DOC_DIR}/conf")
179+
set(INSTALL_SCRIPTS_DIR "${INSTALL_DOC_DIR}/scripts")
180+
set(INSTALL_MAN_DIR "share/man/man1")
181+
set(INSTALL_DATA_DIR "share/${PROJECT_NAME}")
182+
endif(WIN32 OR CYGWIN)
183+
155184
# requirements
156185
set(THREADS_PREFER_PTHREAD_FLAG ON)
157186
find_package(Threads REQUIRED)
@@ -224,9 +253,9 @@ add_subdirectory(scripts)
224253
add_subdirectory(conf)
225254

226255
# install basic docs
227-
install(FILES ${CMAKE_SOURCE_DIR}/CHANGES.md DESTINATION share/doc/${CMAKE_PROJECT_NAME})
228-
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION share/doc/${CMAKE_PROJECT_NAME})
229-
install(FILES ${CMAKE_SOURCE_DIR}/external/LICENSE DESTINATION share/doc/${CMAKE_PROJECT_NAME}/external)
256+
install(FILES ${CMAKE_SOURCE_DIR}/CHANGES.md DESTINATION ${INSTALL_DOC_DIR})
257+
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ${INSTALL_DOC_DIR})
258+
install(FILES ${CMAKE_SOURCE_DIR}/external/LICENSE DESTINATION ${INSTALL_DOC_DIR}/external)
230259
add_subdirectory(doc)
231260
add_subdirectory(man)
232261

cmake/cpack/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# empty for the moment
1+
include(CPack)

conf/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ if(LINUX)
2929
install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION /etc/udev/rules.d/)
3030
endif()
3131

32-
install(FILES "${CMAKE_BINARY_DIR}/direwolf.conf" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
33-
install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
32+
install(FILES "${CMAKE_BINARY_DIR}/direwolf.conf" DESTINATION ${INSTALL_CONF_DIR})
33+
install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION ${INSTALL_CONF_DIR})
3434

3535
# Put sample configuration & startup files in home directory.
3636
# This step would be done as ordinary user.

data/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ ExternalProject_Add(download_symbolsx
8989
add_custom_target(update-data)
9090
add_dependencies(update-data data_rename download_tocalls download_symbols-new download_symbolsx)
9191

92-
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${TOCALLS_TXT}" DESTINATION share/${PROJECT_NAME})
93-
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLS-NEW_TXT}" DESTINATION share/${PROJECT_NAME})
94-
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLSX_TXT}" DESTINATION share/${PROJECT_NAME})
92+
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${TOCALLS_TXT}" DESTINATION ${INSTALL_DATA_DIR})
93+
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLS-NEW_TXT}" DESTINATION ${INSTALL_DATA_DIR})
94+
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLSX_TXT}" DESTINATION ${INSTALL_DATA_DIR})

doc/CMakeLists.txt

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

2-
install(FILES "${CUSTOM_DOC_DIR}/README.md" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
3-
install(FILES "${CUSTOM_DOC_DIR}/2400-4800-PSK-for-APRS-Packet-Radio.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
4-
install(FILES "${CUSTOM_DOC_DIR}/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
5-
install(FILES "${CUSTOM_DOC_DIR}/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
6-
install(FILES "${CUSTOM_DOC_DIR}/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
7-
install(FILES "${CUSTOM_DOC_DIR}/APRS-Telemetry-Toolkit.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
8-
install(FILES "${CUSTOM_DOC_DIR}/APRStt-Implementation-Notes.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
9-
install(FILES "${CUSTOM_DOC_DIR}/APRStt-interface-for-SARTrack.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
10-
install(FILES "${CUSTOM_DOC_DIR}/APRStt-Listening-Example.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
11-
install(FILES "${CUSTOM_DOC_DIR}/Bluetooth-KISS-TNC.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
12-
install(FILES "${CUSTOM_DOC_DIR}/Going-beyond-9600-baud.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
13-
install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-APRS.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
14-
install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-APRS-Tracker.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
15-
install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-SDR-IGate.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
16-
install(FILES "${CUSTOM_DOC_DIR}/Successful-APRS-IGate-Operation.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
17-
install(FILES "${CUSTOM_DOC_DIR}/User-Guide.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
18-
install(FILES "${CUSTOM_DOC_DIR}/WA8LMF-TNC-Test-CD-Results.pdf" DESTINATION share/doc/${CMAKE_PROJECT_NAME})
2+
install(FILES "${CUSTOM_DOC_DIR}/README.md" DESTINATION ${INSTALL_DOC_DIR})
3+
install(FILES "${CUSTOM_DOC_DIR}/2400-4800-PSK-for-APRS-Packet-Radio.pdf" DESTINATION ${INSTALL_DOC_DIR})
4+
install(FILES "${CUSTOM_DOC_DIR}/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf" DESTINATION ${INSTALL_DOC_DIR})
5+
install(FILES "${CUSTOM_DOC_DIR}/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf" DESTINATION ${INSTALL_DOC_DIR})
6+
install(FILES "${CUSTOM_DOC_DIR}/A-Closer-Look-at-the-WA8LMF-TNC-Test-CD.pdf" DESTINATION ${INSTALL_DOC_DIR})
7+
install(FILES "${CUSTOM_DOC_DIR}/APRS-Telemetry-Toolkit.pdf" DESTINATION ${INSTALL_DOC_DIR})
8+
install(FILES "${CUSTOM_DOC_DIR}/APRStt-Implementation-Notes.pdf" DESTINATION ${INSTALL_DOC_DIR})
9+
install(FILES "${CUSTOM_DOC_DIR}/APRStt-interface-for-SARTrack.pdf" DESTINATION ${INSTALL_DOC_DIR})
10+
install(FILES "${CUSTOM_DOC_DIR}/APRStt-Listening-Example.pdf" DESTINATION ${INSTALL_DOC_DIR})
11+
install(FILES "${CUSTOM_DOC_DIR}/Bluetooth-KISS-TNC.pdf" DESTINATION ${INSTALL_DOC_DIR})
12+
install(FILES "${CUSTOM_DOC_DIR}/Going-beyond-9600-baud.pdf" DESTINATION ${INSTALL_DOC_DIR})
13+
install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-APRS.pdf" DESTINATION ${INSTALL_DOC_DIR})
14+
install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-APRS-Tracker.pdf" DESTINATION ${INSTALL_DOC_DIR})
15+
install(FILES "${CUSTOM_DOC_DIR}/Raspberry-Pi-SDR-IGate.pdf" DESTINATION ${INSTALL_DOC_DIR})
16+
install(FILES "${CUSTOM_DOC_DIR}/Successful-APRS-IGate-Operation.pdf" DESTINATION ${INSTALL_DOC_DIR})
17+
install(FILES "${CUSTOM_DOC_DIR}/User-Guide.pdf" DESTINATION ${INSTALL_DOC_DIR})
18+
install(FILES "${CUSTOM_DOC_DIR}/WA8LMF-TNC-Test-CD-Results.pdf" DESTINATION ${INSTALL_DOC_DIR})

man/CMakeLists.txt

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
install(FILES "${CUSTOM_MAN_DIR}/aclients.1" DESTINATION share/man/man1)
2-
install(FILES "${CUSTOM_MAN_DIR}/atest.1" DESTINATION share/man/man1)
3-
install(FILES "${CUSTOM_MAN_DIR}/decode_aprs.1" DESTINATION share/man/man1)
4-
install(FILES "${CUSTOM_MAN_DIR}/direwolf.1" DESTINATION share/man/man1)
5-
install(FILES "${CUSTOM_MAN_DIR}/gen_packets.1" DESTINATION share/man/man1)
6-
install(FILES "${CUSTOM_MAN_DIR}/kissutil.1" DESTINATION share/man/man1)
7-
install(FILES "${CUSTOM_MAN_DIR}/ll2utm.1" DESTINATION share/man/man1)
8-
install(FILES "${CUSTOM_MAN_DIR}/log2gpx.1" DESTINATION share/man/man1)
9-
install(FILES "${CUSTOM_MAN_DIR}/text2tt.1" DESTINATION share/man/man1)
10-
install(FILES "${CUSTOM_MAN_DIR}/tt2text.1" DESTINATION share/man/man1)
11-
install(FILES "${CUSTOM_MAN_DIR}/utm2ll.1" DESTINATION share/man/man1)
1+
if(NOT (WIN32 OR CYGWIN))
2+
install(FILES "${CUSTOM_MAN_DIR}/aclients.1" DESTINATION ${INSTALL_MAN_DIR})
3+
install(FILES "${CUSTOM_MAN_DIR}/atest.1" DESTINATION ${INSTALL_MAN_DIR})
4+
install(FILES "${CUSTOM_MAN_DIR}/decode_aprs.1" DESTINATION ${INSTALL_MAN_DIR})
5+
install(FILES "${CUSTOM_MAN_DIR}/direwolf.1" DESTINATION ${INSTALL_MAN_DIR})
6+
install(FILES "${CUSTOM_MAN_DIR}/gen_packets.1" DESTINATION ${INSTALL_MAN_DIR})
7+
install(FILES "${CUSTOM_MAN_DIR}/kissutil.1" DESTINATION ${INSTALL_MAN_DIR})
8+
install(FILES "${CUSTOM_MAN_DIR}/ll2utm.1" DESTINATION ${INSTALL_MAN_DIR})
9+
install(FILES "${CUSTOM_MAN_DIR}/log2gpx.1" DESTINATION ${INSTALL_MAN_DIR})
10+
install(FILES "${CUSTOM_MAN_DIR}/text2tt.1" DESTINATION ${INSTALL_MAN_DIR})
11+
install(FILES "${CUSTOM_MAN_DIR}/tt2text.1" DESTINATION ${INSTALL_MAN_DIR})
12+
install(FILES "${CUSTOM_MAN_DIR}/utm2ll.1" DESTINATION ${INSTALL_MAN_DIR})
13+
endif(NOT (WIN32 OR CYGWIN))

scripts/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
if(NOT (WIN32 OR CYGWIN))
3-
install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dwespeak.sh" DESTINATION bin)
4-
install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
3+
install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dwespeak.sh" DESTINATION ${INSTALL_BIN_DIR})
4+
install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION ${INSTALL_SCRIPTS_DIR})
55
add_subdirectory(telemetry-toolkit)
66
endif()
+12-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-balloon.pl" DESTINATION bin)
2-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-bits.pl" DESTINATION bin)
3-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-data.pl" DESTINATION bin)
4-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-data91.pl" DESTINATION bin)
5-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-eqns.pl" DESTINATION bin)
6-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-parm.pl" DESTINATION bin)
7-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-seq.sh" DESTINATION bin)
8-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-unit.pl" DESTINATION bin)
9-
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-volts.py" DESTINATION bin)
1+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-balloon.pl" DESTINATION ${INSTALL_BIN_DIR})
2+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-bits.pl" DESTINATION ${INSTALL_BIN_DIR})
3+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-data.pl" DESTINATION ${INSTALL_BIN_DIR})
4+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-data91.pl" DESTINATION ${INSTALL_BIN_DIR})
5+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-eqns.pl" DESTINATION ${INSTALL_BIN_DIR})
6+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-parm.pl" DESTINATION ${INSTALL_BIN_DIR})
7+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-seq.sh" DESTINATION ${INSTALL_BIN_DIR})
8+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-unit.pl" DESTINATION ${INSTALL_BIN_DIR})
9+
install(PROGRAMS "${CUSTOM_TELEMETRY_DIR}/telem-volts.py" DESTINATION ${INSTALL_BIN_DIR})
1010

11-
install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
12-
install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
13-
install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
11+
install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" DESTINATION ${INSTALL_CONF_DIR})
12+
install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" DESTINATION ${INSTALL_CONF_DIR})
13+
install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" DESTINATION ${INSTALL_CONF_DIR})

src/CMakeLists.txt

+13-13
Original file line numberDiff line numberDiff line change
@@ -455,18 +455,18 @@ if(WIN32 OR CYGWIN)
455455
target_link_libraries(ttcalc ws2_32)
456456
endif()
457457

458-
install(TARGETS direwolf DESTINATION bin)
459-
install(TARGETS decode_aprs DESTINATION bin)
460-
install(TARGETS text2tt DESTINATION bin)
461-
install(TARGETS tt2text DESTINATION bin)
462-
install(TARGETS ll2utm DESTINATION bin)
463-
install(TARGETS utm2ll DESTINATION bin)
464-
install(TARGETS aclients DESTINATION bin)
465-
install(TARGETS log2gpx DESTINATION bin)
466-
install(TARGETS gen_packets DESTINATION bin)
467-
install(TARGETS atest DESTINATION bin)
468-
install(TARGETS ttcalc DESTINATION bin)
469-
install(TARGETS kissutil DESTINATION bin)
458+
install(TARGETS direwolf DESTINATION ${INSTALL_BIN_DIR})
459+
install(TARGETS decode_aprs DESTINATION ${INSTALL_BIN_DIR})
460+
install(TARGETS text2tt DESTINATION ${INSTALL_BIN_DIR})
461+
install(TARGETS tt2text DESTINATION ${INSTALL_BIN_DIR})
462+
install(TARGETS ll2utm DESTINATION ${INSTALL_BIN_DIR})
463+
install(TARGETS utm2ll DESTINATION ${INSTALL_BIN_DIR})
464+
install(TARGETS aclients DESTINATION ${INSTALL_BIN_DIR})
465+
install(TARGETS log2gpx DESTINATION ${INSTALL_BIN_DIR})
466+
install(TARGETS gen_packets DESTINATION ${INSTALL_BIN_DIR})
467+
install(TARGETS atest DESTINATION ${INSTALL_BIN_DIR})
468+
install(TARGETS ttcalc DESTINATION ${INSTALL_BIN_DIR})
469+
install(TARGETS kissutil DESTINATION ${INSTALL_BIN_DIR})
470470
if(UDEV_FOUND)
471-
install(TARGETS cm108 DESTINATION bin)
471+
install(TARGETS cm108 DESTINATION ${INSTALL_BIN_DIR})
472472
endif()

src/symbols.c

+1
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ static const struct {
265265

266266
static const char *search_locations[] = {
267267
(const char *) "symbols-new.txt",
268+
(const char *) "data/symbols-new.txt",
268269
(const char *) "../data/symbols-new.txt",
269270
#ifndef __WIN32__
270271
(const char *) "/usr/local/share/direwolf/symbols-new.txt",

0 commit comments

Comments
 (0)