From 7b95ddff95660f875e7934968eb284012302eefd Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 10 Jan 2024 17:04:24 -0500 Subject: [PATCH] refactor and rework the CMake build system slightly (so it behaves better when compiled out-of-tree, shhh); --- CMakeLists.txt | 286 ++++++++++++++++++++----------------- src/CMakeLists.txt | 150 ++++++++++--------- src/common/CMakeLists.txt | 5 - src/fne/CMakeLists.txt | 6 +- src/host/CMakeLists.txt | 36 ----- src/monitor/CMakeLists.txt | 9 +- src/remote/CMakeLists.txt | 5 - 7 files changed, 227 insertions(+), 270 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ddbd99d..bafd4044 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,21 +47,21 @@ option(CROSS_COMPILE_ARM "Cross-compile for 32-bit ARM" off) option(CROSS_COMPILE_AARCH64 "Cross-compile for 64-bit ARM" off) option(CROSS_COMPILE_RPI_ARM "Cross-compile for (old RPi) 32-bit ARM" off) -set(CMAKE_C_COMPILER gcc) -set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_COMPILER /usr/bin/gcc) +set(CMAKE_CXX_COMPILER /usr/bin/g++) set(ARCH amd64) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) if (CROSS_COMPILE_ARM) - set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) - set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) + set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc) + set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++) set(ARCH arm) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm) message(CHECK_START "Cross compiling for 32-bit ARM - ${CMAKE_C_COMPILER}") endif (CROSS_COMPILE_ARM) if (CROSS_COMPILE_AARCH64) - set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) - set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) + set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc) + set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++) set(ARCH arm64) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64) message(CHECK_START "Cross compiling for 64-bit ARM - ${CMAKE_C_COMPILER}") @@ -76,7 +76,7 @@ endif (WITH_RPI_ARM_TOOLS) if (CROSS_COMPILE_RPI_ARM) if (NOT WITH_RPI_ARM_TOOLS) message("-- Cloning legacy Raspberry Pi compilation toolchain") - Include(FetchContent) + include(FetchContent) FetchContent_Declare( RPiTools GIT_REPOSITORY https://github.com/raspberrypi/tools.git @@ -135,33 +135,37 @@ set(CMAKE_INSTALL_PREFIX "/usr/local") # # Library Inclusions # -option(WITH_ASIO "Manually specify the location for the ASIO library" off) -if (WITH_ASIO) - set(ASIO_INCLUDE_DIR ${WITH_ASIO}/include) - message(CHECK_START "With ASIO: ${ASIO_INCLUDE_DIR}") -else() - message("-- Cloning ASIO") - Include(FetchContent) +if (NOT ASIO_INCLUDED) + option(WITH_ASIO "Manually specify the location for the ASIO library" off) + if (WITH_ASIO) + set(ASIO_INCLUDE_DIR ${WITH_ASIO}/include) + message(CHECK_START "With ASIO: ${ASIO_INCLUDE_DIR}") + else() + message("-- Cloning ASIO") + include(FetchContent) + FetchContent_Declare( + ASIO + GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git + GIT_TAG 7609450f71434bdc9fbd9491a9505b423c2a8496 # asio-1-28-2 + ) + FetchContent_MakeAvailable(ASIO) + set(ASIO_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/_deps/asio-src/asio/include) + set(ASIO_INCLUDED 1) + endif (WITH_ASIO) +endif (NOT ASIO_INCLUDED) + +if (ENABLE_TUI_SUPPORT AND NOT FC_INCLUDED) + message("-- Cloning finalcut") + include(FetchContent) FetchContent_Declare( - ASIO - GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git - GIT_TAG 7609450f71434bdc9fbd9491a9505b423c2a8496 # asio-1-28-2 + FINALCUT + GIT_REPOSITORY https://github.com/gatekeep/finalcut-cmake.git ) - FetchContent_MakeAvailable(ASIO) - set(ASIO_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/_deps/asio-src/asio/include) -endif (WITH_ASIO) - -if (ENABLE_TUI_SUPPORT) -message("-- Cloning finalcut") -Include(FetchContent) -FetchContent_Declare( - FINALCUT - GIT_REPOSITORY https://github.com/gatekeep/finalcut-cmake.git -) -set(F_COMPILE_STATIC 1) -FetchContent_MakeAvailable(FINALCUT) -set(FINALCUT_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/_deps/finalcut-src/src) -endif (ENABLE_TUI_SUPPORT) + set(FC_INCLUDED 1) + set(F_COMPILE_STATIC 1) + FetchContent_MakeAvailable(FINALCUT) + set(FINALCUT_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/_deps/finalcut-src/src) +endif (ENABLE_TUI_SUPPORT AND NOT FC_INCLUDED) # # Set GIT_VER compiler directive @@ -178,7 +182,7 @@ project(dvmhost) include(src/CMakeLists.txt) if (ENABLE_TESTS) -include(tests/CMakeLists.txt) + include(tests/CMakeLists.txt) endif (ENABLE_TESTS) # @@ -201,50 +205,60 @@ install(CODE "execute_process(COMMAND bash \"-c\" \"sed -i 's/file: talkgroup_ru # # Helper target to force strip binaries. # -if (CROSS_COMPILE_ARM) - if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) - add_custom_target(strip - COMMAND arm-linux-gnueabihf-strip -s dvmhost - COMMAND arm-linux-gnueabihf-strip -s dvmcmd - COMMAND arm-linux-gnueabihf-strip -s dvmmon) +if (NOT TARGET strip) + if (CROSS_COMPILE_ARM) + if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + add_custom_target(strip + COMMAND arm-linux-gnueabihf-strip -s dvmhost + COMMAND arm-linux-gnueabihf-strip -s dvmfne + COMMAND arm-linux-gnueabihf-strip -s dvmcmd + COMMAND arm-linux-gnueabihf-strip -s dvmmon) + else() + add_custom_target(strip + COMMAND arm-linux-gnueabihf-strip -s dvmhost + COMMAND arm-linux-gnueabihf-strip -s dvmfne + COMMAND arm-linux-gnueabihf-strip -s dvmcmd) + endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + elseif (CROSS_COMPILE_AARCH64) + if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + add_custom_target(strip + COMMAND aarch64-linux-gnu-strip -s dvmhost + COMMAND aarch64-linux-gnu-strip -s dvmfne + COMMAND aarch64-linux-gnu-strip -s dvmcmd + COMMAND aarch64-linux-gnu-strip -s dvmmon) + else() + add_custom_target(strip + COMMAND aarch64-linux-gnu-strip -s dvmhost + COMMAND aarch64-linux-gnu-strip -s dvmfne + COMMAND aarch64-linux-gnu-strip -s dvmcmd) + endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + elseif (CROSS_COMPILE_RPI_ARM) + if (NOT WITH_RPI_ARM_TOOLS) + add_custom_target(strip + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/_deps/rpitools-src/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmhost + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/_deps/rpitools-src/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmfne + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/_deps/rpitools-src/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmcmd) + else() + add_custom_target(strip + COMMAND ${RPI_ARM_TOOLS}/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmhost + COMMAND ${RPI_ARM_TOOLS}/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmfne + COMMAND ${RPI_ARM_TOOLS}/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmcmd) + endif () else() - add_custom_target(strip - COMMAND arm-linux-gnueabihf-strip -s dvmhost - COMMAND arm-linux-gnueabihf-strip -s dvmcmd) - endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) -elseif (CROSS_COMPILE_AARCH64) - if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) - add_custom_target(strip - COMMAND aarch64-linux-gnu-strip -s dvmhost - COMMAND aarch64-linux-gnu-strip -s dvmcmd - COMMAND aarch64-linux-gnu-strip -s dvmmon) - else() - add_custom_target(strip - COMMAND aarch64-linux-gnu-strip -s dvmhost - COMMAND aarch64-linux-gnu-strip -s dvmcmd) - endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) -elseif (CROSS_COMPILE_RPI_ARM) - if (NOT WITH_RPI_ARM_TOOLS) - add_custom_target(strip - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/_deps/rpitools-src/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmhost - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/_deps/rpitools-src/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmcmd) - else() - add_custom_target(strip - COMMAND ${RPI_ARM_TOOLS}/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmhost - COMMAND ${RPI_ARM_TOOLS}/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip -s dvmcmd) - endif () -else() - if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) - add_custom_target(strip - COMMAND strip -s dvmhost - COMMAND strip -s dvmcmd - COMMAND strip -s dvmmon) - else() - add_custom_target(strip - COMMAND strip -s dvmhost - COMMAND strip -s dvmcmd) - endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) -endif (CROSS_COMPILE_ARM) + if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + add_custom_target(strip + COMMAND strip -s dvmhost + COMMAND strip -s dvmfne + COMMAND strip -s dvmcmd + COMMAND strip -s dvmmon) + else() + add_custom_target(strip + COMMAND strip -s dvmhost + COMMAND strip -s dvmfne + COMMAND strip -s dvmcmd) + endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + endif (CROSS_COMPILE_ARM) +endif (NOT TARGET strip) #/* #** bryanb: Please do not change the following section unless adding or removing paths that need to be part of a build @@ -255,65 +269,67 @@ endif (CROSS_COMPILE_ARM) # Custom make target to perform a tarball packaging. This will ultimately contain the same type of pathing # the non-standard legacy install to "/opt/dvm" does. # -set(CMAKE_INSTALL_PREFIX_TARBALL "tar_build") -if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) - add_custom_target(tarball - COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL} - COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log - COMMAND touch ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log/INCLUDE_DIRECTORY - COMMAND cp -v dvmhost ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND cp -v dvmcmd ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND cp -v dvmmon ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND cp -v dvmfne ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND cp ../tools/*.sh ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm - COMMAND chmod +x ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/*.sh - COMMAND cp -v ../configs/*.yml ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm - COMMAND cp -v ../configs/*.dat ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm - COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw - COMMAND if [ -e dvm-firmware_f4.elf ]\; then cp -v dvm-firmware_f4.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4.bin ]\; then cp -v dvm-firmware_f4.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-pog.elf ]\; then cp -v dvm-firmware_f4-pog.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-pog.bin ]\; then cp -v dvm-firmware_f4-pog.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_eda.elf ]\; then cp -v dvm-firmware_eda.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_eda.bin ]\; then cp -v dvm-firmware_eda.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-dvmv1.elf ]\; then cp -v dvm-firmware_f4-dvmv1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-dvmv1.bin ]\; then cp -v dvm-firmware_f4-dvmv1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_due.elf ]\; then cp -v dvm-firmware_due.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_due.bin ]\; then cp -v dvm-firmware_due.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware-hs_f1.elf ]\; then cp -v dvm-firmware-hs_f1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware-hs_f1.bin ]\; then cp -v dvm-firmware-hs_f1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND cd ${CMAKE_INSTALL_PREFIX_TARBALL} && tar czvf ../dvmhost_${CPACK_DEBIAN_PACKAGE_VERSION}_${ARCH}.tar.gz * - COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL}) -else() - add_custom_target(tarball - COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL} - COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log - COMMAND touch ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log/INCLUDE_DIRECTORY - COMMAND cp -v dvmhost ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND cp -v dvmcmd ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND cp -v dvmfne ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin - COMMAND cp ../tools/*.sh ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm - COMMAND chmod +x ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/*.sh - COMMAND cp -v ../configs/*.yml ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm - COMMAND cp -v ../configs/*.dat ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm - COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw - COMMAND if [ -e dvm-firmware_f4.elf ]\; then cp -v dvm-firmware_f4.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4.bin ]\; then cp -v dvm-firmware_f4.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-pog.elf ]\; then cp -v dvm-firmware_f4-pog.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-pog.bin ]\; then cp -v dvm-firmware_f4-pog.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_eda.elf ]\; then cp -v dvm-firmware_eda.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_eda.bin ]\; then cp -v dvm-firmware_eda.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-dvmv1.elf ]\; then cp -v dvm-firmware_f4-dvmv1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_f4-dvmv1.bin ]\; then cp -v dvm-firmware_f4-dvmv1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_due.elf ]\; then cp -v dvm-firmware_due.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware_due.bin ]\; then cp -v dvm-firmware_due.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware-hs_f1.elf ]\; then cp -v dvm-firmware-hs_f1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND if [ -e dvm-firmware-hs_f1.bin ]\; then cp -v dvm-firmware-hs_f1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi - COMMAND cd ${CMAKE_INSTALL_PREFIX_TARBALL} && tar czvf ../dvmhost_${CPACK_DEBIAN_PACKAGE_VERSION}_${ARCH}.tar.gz * - COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL}) -endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) +if (NOT TARGET tarball) + set(CMAKE_INSTALL_PREFIX_TARBALL "tar_build") + if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + add_custom_target(tarball + COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL} + COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log + COMMAND touch ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log/INCLUDE_DIRECTORY + COMMAND cp -v dvmhost ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND cp -v dvmcmd ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND cp -v dvmmon ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND cp -v dvmfne ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND cp ../tools/*.sh ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm + COMMAND chmod +x ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/*.sh + COMMAND cp -v ../configs/*.yml ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm + COMMAND cp -v ../configs/*.dat ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm + COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw + COMMAND if [ -e dvm-firmware_f4.elf ]\; then cp -v dvm-firmware_f4.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4.bin ]\; then cp -v dvm-firmware_f4.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-pog.elf ]\; then cp -v dvm-firmware_f4-pog.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-pog.bin ]\; then cp -v dvm-firmware_f4-pog.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_eda.elf ]\; then cp -v dvm-firmware_eda.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_eda.bin ]\; then cp -v dvm-firmware_eda.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-dvmv1.elf ]\; then cp -v dvm-firmware_f4-dvmv1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-dvmv1.bin ]\; then cp -v dvm-firmware_f4-dvmv1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_due.elf ]\; then cp -v dvm-firmware_due.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_due.bin ]\; then cp -v dvm-firmware_due.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware-hs_f1.elf ]\; then cp -v dvm-firmware-hs_f1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware-hs_f1.bin ]\; then cp -v dvm-firmware-hs_f1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND cd ${CMAKE_INSTALL_PREFIX_TARBALL} && tar czvf ../dvmhost_${CPACK_DEBIAN_PACKAGE_VERSION}_${ARCH}.tar.gz * + COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL}) + else() + add_custom_target(tarball + COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL} + COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log + COMMAND touch ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/log/INCLUDE_DIRECTORY + COMMAND cp -v dvmhost ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND cp -v dvmcmd ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND cp -v dvmfne ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/bin + COMMAND cp ../tools/*.sh ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm + COMMAND chmod +x ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/*.sh + COMMAND cp -v ../configs/*.yml ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm + COMMAND cp -v ../configs/*.dat ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm + COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw + COMMAND if [ -e dvm-firmware_f4.elf ]\; then cp -v dvm-firmware_f4.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4.bin ]\; then cp -v dvm-firmware_f4.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-pog.elf ]\; then cp -v dvm-firmware_f4-pog.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-pog.bin ]\; then cp -v dvm-firmware_f4-pog.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_eda.elf ]\; then cp -v dvm-firmware_eda.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_eda.bin ]\; then cp -v dvm-firmware_eda.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-dvmv1.elf ]\; then cp -v dvm-firmware_f4-dvmv1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_f4-dvmv1.bin ]\; then cp -v dvm-firmware_f4-dvmv1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_due.elf ]\; then cp -v dvm-firmware_due.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware_due.bin ]\; then cp -v dvm-firmware_due.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware-hs_f1.elf ]\; then cp -v dvm-firmware-hs_f1.elf ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND if [ -e dvm-firmware-hs_f1.bin ]\; then cp -v dvm-firmware-hs_f1.bin ${CMAKE_INSTALL_PREFIX_TARBALL}/dvm/fw\; fi + COMMAND cd ${CMAKE_INSTALL_PREFIX_TARBALL} && tar czvf ../dvmhost_${CPACK_DEBIAN_PACKAGE_VERSION}_${ARCH}.tar.gz * + COMMAND rm -rf ${CMAKE_INSTALL_PREFIX_TARBALL}) + endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) +endif (NOT TARGET tarball) # # Custom make target to perform non-standard legacy install to "/opt/dvm". This is meant diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30a9ee0c..186dd00a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,82 +23,6 @@ #* along with this program; if not, write to the Free Software #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #*/ -file(GLOB common_SRC - # DMR module - "src/common/dmr/*.cpp" - "src/common/dmr/acl/*.cpp" - "src/common/dmr/data/*.cpp" - "src/common/dmr/lc/*.cpp" - "src/common/dmr/lc/csbk/*.cpp" - "src/common/dmr/lookups/*.cpp" - - # P25 module - "src/common/p25/*.cpp" - "src/common/p25/acl/*.cpp" - "src/common/p25/data/*.cpp" - "src/common/p25/dfsi/*.cpp" - "src/common/p25/lc/*.cpp" - "src/common/p25/lc/tdulc/*.cpp" - "src/common/p25/lc/tsbk/*.cpp" - "src/common/p25/lookups/*.cpp" - - # NXDN module - "src/common/nxdn/*.cpp" - "src/common/nxdn/acl/*.cpp" - "src/common/nxdn/channel/*.cpp" - "src/common/nxdn/edac/*.cpp" - "src/common/nxdn/lc/*.cpp" - "src/common/nxdn/lc/rcch/*.cpp" - - # Core - "src/common/edac/*.cpp" - "src/common/lookups/*.cpp" - "src/common/network/*.cpp" - "src/common/network/rest/*.cpp" - "src/common/network/rest/http/*.cpp" - "src/common/yaml/*.cpp" - "src/common/*.cpp" -) - -file(GLOB common_INCLUDE - # DMR module - "src/common/dmr/*.h" - "src/common/dmr/acl/*.h" - "src/common/dmr/data/*.h" - "src/common/dmr/lc/*.h" - "src/common/dmr/lc/csbk/*.h" - "src/common/dmr/lookups/*.h" - - # P25 module - "src/common/p25/*.h" - "src/common/p25/acl/*.h" - "src/common/p25/data/*.h" - "src/common/p25/dfsi/*.h" - "src/common/p25/lc/*.h" - "src/common/p25/lc/tdulc/*.h" - "src/common/p25/lc/tsbk/*.h" - "src/common/p25/lookups/*.h" - - # NXDN module - "src/common/nxdn/*.h" - "src/common/nxdn/acl/*.h" - "src/common/nxdn/channel/*.h" - "src/common/nxdn/edac/*.h" - "src/common/nxdn/lc/*.h" - "src/common/nxdn/lc/rcch/*.h" - - # Core - "src/common/edac/*.h" - "src/common/edac/rs/*.h" - "src/common/lookups/*.h" - "src/common/network/*.h" - "src/common/network/json/*.h" - "src/common/network/rest/*.h" - "src/common/network/rest/http/*.h" - "src/common/yaml/*.h" - "src/common/*.h" -) - if (ENABLE_TUI_SUPPORT) option(ENABLE_SETUP_TUI "Enable interactive setup TUI" on) if (ENABLE_SETUP_TUI) @@ -260,8 +184,80 @@ if (HAVE_SENDMMSG) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DHAVE_SENDMMSG=1") endif (HAVE_SENDMMSG) +# +## common +# +project(common) include(src/common/CMakeLists.txt) +add_library(common STATIC ${common_SRC} ${common_INCLUDE}) +target_link_libraries(common PRIVATE asio::asio Threads::Threads util) +target_include_directories(common PRIVATE src src/common) + +# +## dvmhost +# +project(dvmhost) include(src/host/CMakeLists.txt) +if (ENABLE_SETUP_TUI) + # add finalcut + target_include_directories(finalcut INTERFACE ${FINALCUT_INCLUDE_DIR}) +endif (ENABLE_SETUP_TUI) + +add_executable(dvmhost ${common_INCLUDE} ${dvmhost_SRC}) +if (ENABLE_SETUP_TUI) + target_link_libraries(dvmhost PRIVATE common asio::asio finalcut Threads::Threads util) +else() + target_link_libraries(dvmhost PRIVATE common asio::asio Threads::Threads util) +endif (ENABLE_SETUP_TUI) +target_include_directories(dvmhost PRIVATE src src/host) + +set(CPACK_SET_DESTDIR true) +set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") + +set(CPACK_GENERATOR "DEB") +set(CPACK_PACKAGE_NAME "dvmhost") +set(CPACK_DEBIAN_PACKAGE_NAME "dvmhost") + +set(CPACK_PACKAGE_VENDOR "DVMProject") + +set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "The DVM Host software provides the host computer implementation of a mixed-mode DMR, P25 and/or NXDN or dedicated-mode DMR, P25 or NXDN repeater system that talks to the actual modem hardware. The host software; is the portion of a complete Over-The-Air modem implementation that performs the data processing, decision making and FEC correction for a digital repeater.") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "DVMProject Authors") +set(CPACK_DEBIAN_PACKAGE_VERSION "3.6.0") +set(CPACK_DEBIAN_PACKAGE_RELEASE "0") +set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/dvmproject") + +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/debian/postrm") + +set(CPACK_DEBIAN_FILE_NAME ${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb) + +include(CPack) + +# +## dvmfne +# +project(dvmfne) include(src/fne/CMakeLists.txt) -include(src/monitor/CMakeLists.txt) +add_executable(dvmfne ${common_INCLUDE} ${dvmfne_SRC}) +target_link_libraries(dvmfne PRIVATE common asio::asio Threads::Threads) +target_include_directories(dvmfne PRIVATE src src/host src/fne) + +# +## dvmmon +# +if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + project(dvmmon) + include(src/monitor/CMakeLists.txt) + add_executable(dvmmon ${common_INCLUDE} ${dvmmon_SRC}) + target_link_libraries(dvmmon PRIVATE common asio::asio finalcut Threads::Threads) + target_include_directories(dvmmon PRIVATE src src/host src/monitor) +endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) + +# +## dvmcmd +# +project(dvmcmd) include(src/remote/CMakeLists.txt) +add_executable(dvmcmd ${common_INCLUDE} ${dvmcmd_SRC}) +target_link_libraries(dvmcmd PRIVATE common asio::asio Threads::Threads) +target_include_directories(dvmcmd PRIVATE src src/remote) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 76233b76..709ad936 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -100,8 +100,3 @@ file(GLOB common_INCLUDE "src/common/yaml/*.h" "src/common/*.h" ) - -project(common) -add_library(common STATIC ${common_SRC} ${common_INCLUDE}) -target_link_libraries(common PRIVATE asio::asio Threads::Threads util) -target_include_directories(common PRIVATE src src/common) diff --git a/src/fne/CMakeLists.txt b/src/fne/CMakeLists.txt index 1cb22db8..e828332a 100644 --- a/src/fne/CMakeLists.txt +++ b/src/fne/CMakeLists.txt @@ -26,6 +26,7 @@ file(GLOB dvmfne_SRC "src/host/network/Network.h" "src/host/network/Network.cpp" + "src/fne/network/fne/*.h" "src/fne/network/fne/*.cpp" "src/fne/network/*.h" @@ -33,8 +34,3 @@ file(GLOB dvmfne_SRC "src/fne/*.h" "src/fne/*.cpp" ) - -project(dvmfne) -add_executable(dvmfne ${common_INCLUDE} ${dvmfne_SRC}) -target_link_libraries(dvmfne PRIVATE common asio::asio Threads::Threads) -target_include_directories(dvmfne PRIVATE src src/host src/fne) diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt index e7d96e7f..a4f93e3a 100644 --- a/src/host/CMakeLists.txt +++ b/src/host/CMakeLists.txt @@ -67,39 +67,3 @@ file(GLOB dvmhost_SRC "src/remote/RESTClient.cpp" "src/remote/RESTClient.h" ) - -project(dvmhost) -if (ENABLE_SETUP_TUI) - # add finalcut - target_include_directories(finalcut INTERFACE ${FINALCUT_INCLUDE_DIR}) -endif (ENABLE_SETUP_TUI) - -add_executable(dvmhost ${common_INCLUDE} ${dvmhost_SRC}) -if (ENABLE_SETUP_TUI) - target_link_libraries(dvmhost PRIVATE common asio::asio finalcut Threads::Threads util) -else() - target_link_libraries(dvmhost PRIVATE common asio::asio Threads::Threads util) -endif (ENABLE_SETUP_TUI) -target_include_directories(dvmhost PRIVATE src src/host) - -set(CPACK_SET_DESTDIR true) -set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") - -set(CPACK_GENERATOR "DEB") -set(CPACK_PACKAGE_NAME "dvmhost") -set(CPACK_DEBIAN_PACKAGE_NAME "dvmhost") - -set(CPACK_PACKAGE_VENDOR "DVMProject") - -set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "The DVM Host software provides the host computer implementation of a mixed-mode DMR, P25 and/or NXDN or dedicated-mode DMR, P25 or NXDN repeater system that talks to the actual modem hardware. The host software; is the portion of a complete Over-The-Air modem implementation that performs the data processing, decision making and FEC correction for a digital repeater.") -set(CPACK_DEBIAN_PACKAGE_MAINTAINER "DVMProject Authors") -set(CPACK_DEBIAN_PACKAGE_VERSION "3.5.5") -set(CPACK_DEBIAN_PACKAGE_RELEASE "0") -set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/dvmproject") - -set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA - "${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/debian/postrm") - -set(CPACK_DEBIAN_FILE_NAME ${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb) - -include(CPack) diff --git a/src/monitor/CMakeLists.txt b/src/monitor/CMakeLists.txt index be6a69e5..0753e630 100644 --- a/src/monitor/CMakeLists.txt +++ b/src/monitor/CMakeLists.txt @@ -26,15 +26,10 @@ #*/ file(GLOB dvmmon_SRC "src/host/modem/Modem.h" + "src/remote/RESTClient.cpp" "src/remote/RESTClient.h" + "src/monitor/*.h" "src/monitor/*.cpp" ) - -if (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) -project(dvmmon) -add_executable(dvmmon ${common_INCLUDE} ${dvmmon_SRC}) -target_link_libraries(dvmmon PRIVATE common asio::asio finalcut Threads::Threads) -target_include_directories(dvmmon PRIVATE src src/host src/monitor) -endif (ENABLE_TUI_SUPPORT AND (NOT DISABLE_MONITOR)) diff --git a/src/remote/CMakeLists.txt b/src/remote/CMakeLists.txt index e31058a9..a3eb35fc 100644 --- a/src/remote/CMakeLists.txt +++ b/src/remote/CMakeLists.txt @@ -27,8 +27,3 @@ file(GLOB dvmcmd_SRC "src/remote/*.h" "src/remote/*.cpp" ) - -project(dvmcmd) -add_executable(dvmcmd ${common_INCLUDE} ${dvmcmd_SRC}) -target_link_libraries(dvmcmd PRIVATE common asio::asio Threads::Threads) -target_include_directories(dvmcmd PRIVATE src src/remote)