Implements TwinLink.cpp with constructor (random priority nonce via std::random_device, signal wiring), initialize() (parse [TWIN] HOST/PORT/ SECRET and [GLOBAL] LOCAL_PREFIX, addStaticSRVRecord + reconnect policy, m_con.connect()), onConnected() sending MsgTrunkHello with ROLE_TWIN, handleMsgTrunkHello() validating role/HMAC/prefix-match, heartbeatTick() (2s TX / 5s RX thresholds), sendMsg/sendMsgOnOutbound/sendMsgOnInbound, and acceptInboundConnection(). Phase C handlers (talker mirror, audio, ext-trunk) are present as empty stubs. Wires Reflector::initTwinLink() to construct and initialize a real TwinLink (replaces stub), adds destructor cleanup, and adds TwinLink.cpp to CMakeLists sources. Build passes clean.
69 lines
2.2 KiB
CMake
69 lines
2.2 KiB
CMake
# Find the popt library
|
|
find_package(Popt REQUIRED)
|
|
set(LIBS ${LIBS} ${POPT_LIBRARIES})
|
|
include_directories(${POPT_INCLUDE_DIRS})
|
|
add_definitions(${POPT_DEFINITIONS})
|
|
|
|
# Find the GCrypt library
|
|
#find_package(GCrypt REQUIRED)
|
|
#set(LIBS ${LIBS} ${GCRYPT_LIBRARIES})
|
|
#include_directories(${GCRYPT_INCLUDE_DIRS})
|
|
#add_definitions(${GCRYPT_DEFINITIONS})
|
|
|
|
# Find jsoncpp library
|
|
#find_package(jsoncpp REQUIRED)
|
|
#get_target_property(JSONCPP_INC_PATH jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES)
|
|
#include_directories(${JSONCPP_INC_PATH})
|
|
#set(LIBS ${LIBS} jsoncpp_lib)
|
|
pkg_check_modules (JSONCPP REQUIRED jsoncpp)
|
|
include_directories(${JSONCPP_INCLUDE_DIRS})
|
|
set(LIBS ${LIBS} ${JSONCPP_LIBRARIES})
|
|
|
|
# Find mosquitto library (MQTT publishing)
|
|
pkg_check_modules(MOSQUITTO REQUIRED libmosquitto)
|
|
include_directories(${MOSQUITTO_INCLUDE_DIRS})
|
|
set(LIBS ${LIBS} ${MOSQUITTO_LIBRARIES})
|
|
|
|
# Find hiredis library (Redis C client)
|
|
pkg_check_modules(HIREDIS REQUIRED hiredis)
|
|
include_directories(${HIREDIS_INCLUDE_DIRS})
|
|
set(LIBS ${LIBS} ${HIREDIS_LIBRARIES})
|
|
|
|
# Add project libraries
|
|
set(LIBS asynccpp asyncaudio asynccore svxmisc ${LIBS})
|
|
|
|
# Build the executable
|
|
add_executable(svxreflector
|
|
svxreflector.cpp Reflector.cpp ReflectorClient.cpp TGHandler.cpp TrunkLink.cpp
|
|
TwinLink.cpp
|
|
SatelliteLink.cpp SatelliteClient.cpp MqttPublisher.cpp RedisStore.cpp
|
|
RedisAsyncAdapter.cpp RedisLiveQueue.cpp
|
|
)
|
|
target_link_libraries(svxreflector ${LIBS})
|
|
set_target_properties(svxreflector PROPERTIES
|
|
RUNTIME_OUTPUT_DIRECTORY ${RUNTIME_OUTPUT_DIRECTORY}
|
|
)
|
|
|
|
# Generate config file with correct paths
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/svxreflector.conf.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/svxreflector.conf
|
|
@ONLY
|
|
)
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ca-hook.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/ca-hook.py
|
|
@ONLY
|
|
)
|
|
|
|
# Install targets
|
|
install(TARGETS svxreflector DESTINATION ${BIN_INSTALL_DIR})
|
|
install_if_not_exists(${CMAKE_CURRENT_BINARY_DIR}/svxreflector.conf
|
|
${SVX_SYSCONF_INSTALL_DIR}
|
|
)
|
|
install_if_not_exists(ca-hook.yaml ${SVX_SYSCONF_INSTALL_DIR})
|
|
install(PROGRAMS svxreflector-status
|
|
DESTINATION ${BIN_INSTALL_DIR}
|
|
)
|
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/ca-hook.py
|
|
DESTINATION ${SVX_SHARE_INSTALL_DIR}
|
|
)
|