Add Gateway build script.

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2021-05-01 16:36:01 +09:00
parent c4efb6d31c
commit 8a2d28a5e4
7 changed files with 38 additions and 20 deletions

4
.gitignore vendored
View File

@@ -10,8 +10,10 @@
/Release/ /Release/
/Debug/ /Debug/
/core /core
Build Build/
*.a *.a
CMakeFiles/ CMakeFiles/
*.cmake *.cmake
CMakeCache.txt CMakeCache.txt
bin/
/build.gateway/

View File

@@ -5,9 +5,9 @@ This Gateway can run as a transparent or aggregating Gateway by specifying the g
### **step1. Build the gateway** ### **step1. Build the gateway**
```` ````
$ git clone -b develop https://github.com/eclipse/paho.mqtt-sn.embedded-c $ git clone -b develop https://github.com/eclipse/paho.mqtt-sn.embedded-c
$ cmake .. [-DSENSORNET={udp|udp6|xbee|loralink}] $ cd paho.mqtt-sn.embedded-c/MQTTSNGateway
$ make $ ./build.sh {udp|udp6|xbee|loralink}]
```` ````
By default, a gateway for UDP is built. By default, a gateway for UDP is built.
@@ -19,7 +19,7 @@ MQTT-SNGateway and MQTT-SNLogmonitor (executable programs) are built in the Buil
```` ````
$ ./Build/MQTT-SNGateway -f ./MQTTSNGateway/gateway.conf $ ./bin/MQTT-SNGateway -f gateway.conf
```` ````
If you get the error message as follows: If you get the error message as follows:
```` ````
@@ -28,7 +28,7 @@ Aborted (core dumped)
```` ````
You have to start using sudo command only once for the first time. You have to start using sudo command only once for the first time.
```` ````
$ sudo ./Build/MQTT-SNGateway -f ./MQTTSNGateway/gateway.conf $ sudo ./bin/MQTT-SNGateway -f gateway.conf
```` ````
### **How to Change the configuration of the gateway** ### **How to Change the configuration of the gateway**
@@ -119,7 +119,7 @@ Restart the gateway with sudo only once to create shared memories.
open ssh terminal and execute LogMonitor. open ssh terminal and execute LogMonitor.
`$ ./MQTT-SNLogmonitor` `$ ./bin/MQTT-SNLogmonitor`
Now you can get the Log on your terminal. Now you can get the Log on your terminal.

17
MQTTSNGateway/build.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: build.sh { udp | udp6 | xbee | loralink }"
else
echo "Start building MQTT-SN Gateway"
SCRIPT_DIR=$(cd $(dirname $0); pwd)
cd $SCRIPT_DIR/..
rm -rf build.gateway
mkdir build.gateway
cd build.gateway
cmake .. -DSENSORNET=$1
make MQTTSNPacke
make MQTT-SNGateway
make MQTT-SNLogmonitor
fi

View File

@@ -11,19 +11,20 @@
# http://www.eclipse.org/org/documents/edl-v10.php. # http://www.eclipse.org/org/documents/edl-v10.php.
# #
# Contributors: # Contributors:
# a1lu - initial version # a1lu - initial version
# ty4tw - modify
#*******************************************************************************/ #*******************************************************************************/
PROJECT(mqtt-sn-gateway CXX) PROJECT(mqtt-sn-gateway CXX)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../bin)
set(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_STANDARD 11)
SET(OS linux) SET(OS linux)
if(NOT DEFINED SENSORNET) IF(NOT DEFINED SENSORNET)
set(SENSORNET udp) SET(SENSORNET udp)
endif() ENDIF()
message(STATUS "SENSORNET: " ${SENSORNET}) MESSAGE(STATUS "SENSORNET: " ${SENSORNET})
ADD_LIBRARY(mqtt-sngateway_common ADD_LIBRARY(mqtt-sngateway_common
MQTTGWConnectionHandler.cpp MQTTGWConnectionHandler.cpp

View File

@@ -16,8 +16,6 @@
PROJECT(mqtt-sn-samples) PROJECT(mqtt-sn-samples)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build)
INCLUDE_DIRECTORIES(../src) INCLUDE_DIRECTORIES(../src)
ADD_EXECUTABLE( ADD_EXECUTABLE(

View File

@@ -16,8 +16,6 @@
PROJECT(mqtt-sn-tests) PROJECT(mqtt-sn-tests)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build)
INCLUDE_DIRECTORIES(../src) INCLUDE_DIRECTORIES(../src)
ADD_EXECUTABLE( ADD_EXECUTABLE(

View File

@@ -6,15 +6,17 @@ rm -rf build.paho
mkdir build.paho mkdir build.paho
cd build.paho cd build.paho
echo "travis build dir $TRAVIS_BUILD_DIR pwd $PWD" echo "travis build dir $TRAVIS_BUILD_DIR pwd $PWD"
cmake .. cmake .. -DSENSORNET=loralink
make make
ctest -VV --timeout 600 ctest -VV --timeout 600
cmake .. -DSENSORNET=xbee cmake .. -DSENSORNET=xbee
make MQTT-SNGateway make MQTT-SNGateway
cmake .. -DSENSORNET=udp6 cmake .. -DSENSORNET=udp6
make MQTT-SNGateway make MQTT-SNGateway
cmake .. -DSENSORNET=loralink cmake .. -DSENSORNET=udp
make MQTT-SNGateway make MQTT-SNGateway
cd ../MQTTSNGateway/GatewayTester cd ../MQTTSNGateway/GatewayTester
make make