diff --git a/proto_gen.sh b/proto_gen.sh index c4d6d04..e4e07d7 100644 --- a/proto_gen.sh +++ b/proto_gen.sh @@ -1,7 +1,7 @@ -#!/bin/sh +#!/bin/bash -cd src/external/PiScan-protobuf +#cd src/external/PiScan-protobuf -protoc -I=. --cpp_out=. *.proto +protoc -I=src/external/PiScan-protobuf --cpp_out=src/external/PiScan-protobuf *.proto -cd ../../.. +#cd ../../.. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index af33140..1629ff7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,12 @@ set(CMAKE_BUILD_TYPE Debug) add_executable(piScan_backend piScan_backend.cpp) +execute_process( + COMMAND protoc -I=${CMAKE_SOURCE_DIR}/external/PiScan-protobuf --cpp_out=${CMAKE_SOURCE_DIR}/external/PiScan-protobuf context.proto + COMMAND protoc -I=${CMAKE_SOURCE_DIR}/external/PiScan-protobuf --cpp_out=${CMAKE_SOURCE_DIR}/external/PiScan-protobuf messages.proto + COMMAND protoc -I=${CMAKE_SOURCE_DIR}/external/PiScan-protobuf --cpp_out=${CMAKE_SOURCE_DIR}/external/PiScan-protobuf request.proto +) + MACRO(use_included_rtaudio) SET (cubicsdr_sources ${cubicsdr_sources} @@ -114,9 +120,11 @@ include_directories(${SOAPY_SDR_INCLUDE_DIR}) SET(OTHER_LIBRARIES ${SOAPY_SDR_LIBRARY} ${OTHER_LIBRARIES}) ADD_DEFINITIONS( -DUSE_SOAPY_SDR=1 -) +) -target_link_libraries(piScan_backend core cubic external loguru scan server sigproc +add_dependencies(server proto) + +target_link_libraries(piScan_backend core cubic external loguru proto scan server sigproc pthread boost_system protobuf liquid ${OTHER_LIBRARIES}) diff --git a/src/external/CMakeLists.txt b/src/external/CMakeLists.txt index a0c5534..91584c7 100644 --- a/src/external/CMakeLists.txt +++ b/src/external/CMakeLists.txt @@ -3,26 +3,40 @@ add_library(external concurrentqueue.h liquid.h readerwriterqueue.h - ) +) add_library(loguru) +add_library(proto) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/loguru) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/rtaudio) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tinyxml) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/loguru) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/rtaudio) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tinyxml) - target_include_directories(loguru PUBLIC loguru) - target_include_directories(external PUBLIC PiScan-protobuf loguru rtaudio tinyxml) - target_include_directories(piScan_backend PUBLIC PiScan-protobuf loguru rtaudio tinyxml) +target_include_directories(loguru PUBLIC loguru) +target_include_directories(external PUBLIC loguru rtaudio tinyxml) +target_include_directories(proto PUBLIC PiScan-protobuf) +target_include_directories(piScan_backend PUBLIC PiScan-protobuf loguru rtaudio tinyxml) - target_sources(external PUBLIC +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/context.pb.cc PROPERTIES GENERATED 1 + ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/context.pb.h PROPERTIES GENERATED 1 + ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/messages.pb.cc PROPERTIES GENERATED 1 + ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/messages.pb.h PROPERTIES GENERATED 1 + ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/request.pb.cc PROPERTIES GENERATED 1 + ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/request.pb.h PROPERTIES GENERATED 1 +) + +target_sources(proto PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/context.pb.cc ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/context.pb.h ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/messages.pb.cc ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/messages.pb.h ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/request.pb.cc ${CMAKE_CURRENT_SOURCE_DIR}/PiScan-protobuf/request.pb.h +) + +target_sources(external PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml/tinystr.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml/tinystr.h ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml/tinyxml.cpp @@ -31,9 +45,9 @@ add_library(loguru) ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml/tinyxmlparser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rtaudio/RtAudio.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rtaudio/RtAudio.h - ) +) - target_sources(loguru PUBLIC +target_sources(loguru PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/loguru/loguru.cpp ${CMAKE_CURRENT_SOURCE_DIR}/loguru/loguru.hpp - ) +) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d635a15..fd2ffc2 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -12,5 +12,5 @@ else (DETACH_KERNEL_DRIVER) message (STATUS "Building with kernel driver detaching disabled, use -DDETACH_KERNEL_DRIVER=ON to enable") endif (DETACH_KERNEL_DRIVER) -target_link_libraries(testclient server external pthread boost_system protobuf dl) +target_link_libraries(testclient core server proto loguru pthread boost_system protobuf dl) target_link_libraries(test_utils pthread)