Skip to content

Commit

Permalink
Gateway directory structure re-organizing.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed May 13, 2024
1 parent 6bb9521 commit c9d9e1c
Show file tree
Hide file tree
Showing 69 changed files with 56 additions and 56 deletions.
49 changes: 2 additions & 47 deletions gateway/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,7 @@ if (NOT CC_MQTTSN_BUILD_GATEWAY)
return ()
endif ()

######################################################################

find_package(LibComms REQUIRED)
find_package(cc_mqttsn REQUIRED)
find_package(cc_mqtt311 REQUIRED)

######################################################################

set (GATEWAY_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-backtrace-limit=0")
endif ()

set (MQTTSN_GATEWAY_LIB_NAME "cc_mqttsn_gateway")

add_subdirectory (src)
add_subdirectory (test)

install (
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/cc_mqttsn_gateway
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install (
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/etc/
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cc_mqttsn_gateway
)

######################################################################

find_package (Doxygen)
if (DOXYGEN_FOUND)
set (doc_output_dir "${CMAKE_INSTALL_FULL_DATAROOTDIR}/doc/cc_mqttsn_gateway")
make_directory (${doc_output_dir})

set (match_str "OUTPUT_DIRECTORY[^\n]*")
set (replacement_str "OUTPUT_DIRECTORY = ${doc_output_dir}")
set (output_file "${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf")

set (config_file "${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen.conf")
file (READ ${config_file} config_text)
string (REGEX REPLACE "${match_str}" "${replacement_str}" modified_config_text "${config_text}")
file (WRITE "${output_file}" "${modified_config_text}")

add_custom_target ("doc_mqttsn_gateway"
COMMAND ${DOXYGEN_EXECUTABLE} ${output_file}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif ()
add_subdirectory (lib)
add_subdirectory (app)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ function (bin_gateway_udp)
SessionWrapper.h
)

#qt5_add_resources(resources ${CMAKE_CURRENT_SOURCE_DIR}/ui.qrc)

add_executable(${name} ${src} ${moc})
target_link_libraries(${name} ${MQTTSN_GATEWAY_LIB_NAME} Qt5::Network Qt5::Core)
target_link_libraries(${name} cc::${MQTTSN_GATEWAY_LIB_NAME} Qt5::Network Qt5::Core)

install (
TARGETS ${name}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion gateway/etc/cc_mqttsn_gateway.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# =================================================================

# Gateway ID, reported in ADVERTISE and GWINFO messages. Default value is 0.
#cc_mqttsn_gw_id 0
#mqttsn_gw_id 0

# Advertise period (in seconds), when gateway is expected to advertise its
# presence by broadcasting ADVERTISE message. Default value is 900 (=15 min).
Expand Down
48 changes: 48 additions & 0 deletions gateway/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
######################################################################

find_package(LibComms REQUIRED)
find_package(cc_mqttsn REQUIRED)
find_package(cc_mqtt311 REQUIRED)

######################################################################

set (GATEWAY_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-backtrace-limit=0")
endif ()


add_subdirectory (src)
add_subdirectory (test)

install (
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/cc_mqttsn_gateway
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install (
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/etc/
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cc_mqttsn_gateway
)

######################################################################

find_package (Doxygen)
if (DOXYGEN_FOUND)
set (doc_output_dir "${CMAKE_INSTALL_FULL_DATAROOTDIR}/doc/cc_mqttsn_gateway")
make_directory (${doc_output_dir})

set (match_str "OUTPUT_DIRECTORY[^\n]*")
set (replacement_str "OUTPUT_DIRECTORY = ${doc_output_dir}")
set (output_file "${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf")

set (config_file "${CMAKE_CURRENT_SOURCE_DIR}/doc/doxygen.conf")
file (READ ${config_file} config_text)
string (REGEX REPLACE "${match_str}" "${replacement_str}" modified_config_text "${config_text}")
file (WRITE "${output_file}" "${modified_config_text}")

add_custom_target ("doc_mqttsn_gateway"
COMMAND ${DOXYGEN_EXECUTABLE} ${output_file}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif ()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion gateway/doc/session.dox → gateway/lib/doc/session.dox
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
/// @b C++ interface:
/// @code
/// session->setCancelTickWaitReqCb(
/// []()
/// []() -> unsigned
/// {
/// ... // cancel timer
/// return ...; // return number of elapsed milliseconds
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function (lib_mqttsn_gateway)
)

add_library (${name} STATIC ${src})
add_library (cc::${name} ALIAS ${name})

target_link_libraries(${name} PRIVATE cc::cc_mqtt311 cc::cc_mqttsn cc::comms)

Expand Down Expand Up @@ -51,7 +52,7 @@ function (lib_mqttsn_gateway)
)

include(CMakePackageConfigHelpers)
file (READ "${CMAKE_CURRENT_SOURCE_DIR}/../../include/cc_mqttsn_gateway/version.h" version_file)
file (READ "${CMAKE_CURRENT_SOURCE_DIR}/../include/cc_mqttsn_gateway/version.h" version_file)
string (REGEX MATCH "CC_MQTTSN_GW_MAJOR_VERSION ([0-9]*)U*" _ ${version_file})
set (major_ver ${CMAKE_MATCH_1})
string (REGEX MATCH "CC_MQTTSN_GW_MINOR_VERSION ([0-9]*)U*" _ ${version_file})
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace

const char CommentChar = '#';
const std::string SpaceChars(" \t");
const std::string GatewayIdKey("cc_mqttsn_gw_id");
const std::string GatewayIdKey("mqttsn_gw_id");
const std::string AdvertiseKey("mqttsn_advertise");
const std::string RetryPeriodKey("mqttsn_retry_period");
const std::string RetryCountKey("mqttsn_retry_count");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions gateway/src/CMakeLists.txt

This file was deleted.

0 comments on commit c9d9e1c

Please sign in to comment.