Commit 0b4885d7 authored by Alexander David Hellwig's avatar Alexander David Hellwig

Merge branch '23-prepare-for-hand-in' into 'master'

Resolve "Prepare for hand in"

See merge request !12
parents 78ab2bf2 a61d1098
Pipeline #185171 passed with stage
in 49 seconds
......@@ -3,21 +3,27 @@
A project that generates MQTT-Adapter for EmbeddedMontiArcMath components.
## Warning
This generator is part of an composite generator and does not create an executable. Look at EMAM2Middleware if you want to generate one.
## Getting Started
These instructions will get MQTT up and running on your **Ubuntu** system
These instructions will get this project installed on your **Ubuntu** system
### Installing project
Download this project to your computer
[Download](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/emam2mqtt/-/archive/master/emam2mqtt-master.zip) this project to your computer
[Download](https://openjdk.java.net/install/) and install Java JDK (alternatively via `apt install openjdk-8-jdk`)
[Download](https://maven.apache.org/guides/getting-started/) and install Maven
[Download](https://maven.apache.org/guides/getting-started/) and install Maven (alternatively via `apt install maven`)
[Download](https://www.eclipse.org/downloads/) and install Ecplise IDE
Import the project as "Maven Project" in Eclipse
Open terminal and switch to your project directory
Open terminal and switch to the root of your project directory
In terminal run
......@@ -29,17 +35,17 @@ Open terminal
Add new MQTT repository
`sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa`
`apt-add-repository ppa:mosquitto-dev/mosquitto-ppa`
Run update
`sudo apt-get update`
`apt-get update`
Install mosquitto and mosquitto-clients
`sudo apt-get install mosquitto`
`apt install mosquitto`
`sudo apt-get install mosquitto-clients`
`apt install mosquitto-clients`
### Installing MQTT broker (locally on Windows)
......@@ -53,27 +59,25 @@ Mosquitto is now available and can be accessed via command line using `mosquitto
Open terminal and run
`sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui`
`apt install build-essential gcc make cmake git`
#### Installing PahoMQTT C library
run
```bash
git clone https://github.com/eclipse/paho.mqtt.c.git
git clone https://github.com/eclipse/paho.mqtt.c
cd paho.mqtt.c
git checkout v1.2.1
cmake -Bbuild -H. -DPAHO_WITH_SSL=ON
cmake -Bbuild -H. -DPAHO_WITH_SSL=OFF
sudo cmake --build build/ --target install
sudo ldconfig
```
#### Installing PahoMQTT C++ library
**after** installation of C library run
```bash
git clone https://github.com/eclipse/paho.mqtt.cpp
cd paho.mqtt.cpp
cmake -Bbuild -H.
cmake -Bbuild -H. -DPAHO_WITH_SSL=OFF
sudo cmake --build build/ --target install
```
#### Set environment variables for MQTT
#### Set environment variables for MQTT (optional)
additionaly, you can set the environment variables for MQTT libs and includes directory by modifying the environment file on your system
```bash
sudo nano /etc/environment
......
......@@ -14,6 +14,8 @@ RUN apt -y install \
RUN git clone https://github.com/eclipse/paho.mqtt.c.git ; cd paho.mqtt.c ; cmake -Bbuild -H. -DPAHO_WITH_SSL=OFF ; cmake --build build/ --target install
RUN git clone https://github.com/eclipse/paho.mqtt.cpp ; cd paho.mqtt.cpp ; cmake -Bbuild -H. -DPAHO_WITH_SSL=OFF ; cmake --build build/ --target install
RUN rm -rf paho.mqtt.c paho.mqtt.cpp
ADD https://rwth-aachen.sciebo.de/s/igDWzLpdO5zYHBj/download?path=%2Fubuntu%2F18.10.24-armadillo-linux&files=armadillo-8.500.1-linux.zip /root/armadillo.zip
RUN unzip /root/armadillo.zip -d /root/
ENV Armadillo_HOME=/root/armadillo-8.500.1-linux
RUN apt -y install \
liblapack-dev \
libblas-dev \
libboost-dev \
libarmadillo-dev
# Setting cmake version
cmake_minimum_required(VERSION 3.1...3.14)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
......@@ -9,15 +8,10 @@ endif()
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
# Setting search paths for cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/modules")
# Setting project name and description
project(MqttAdapter VERSION 1.0
DESCRIPTION "MQTT adapter"
LANGUAGES CXX)
project(tests.a.compA)
set(SEARCH_MQTT FALSE)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)
# Check is environment variable was set
IF(DEFINED ENV{MQTT_INCLUDE_DIR} AND DEFINED ENV{MQTT_LIBS})
......@@ -36,15 +30,16 @@ CallbackN.cpp
CallbackZ.cpp
CallbackB.cpp
MqttAdapter_tests_a_compA.cpp
tests_a_compA.cpp
CallbackQ.hpp
CallbackN.hpp
CallbackZ.hpp
CallbackB.hpp
MqttAdapter_tests_a_compA.h
tests_a_compA.h
)
list(APPEND LIBRARIES tests_a_compA)
list(APPEND LIBRARIES IAdapter_tests_a_compA)
# Checking if everything was found
if(SEARCH_MQTT)
if (NOT MQTT_C_LIB OR NOT MQTT_A_LIB OR NOT MQTT_PP_LIB)
......@@ -58,10 +53,10 @@ if(SEARCH_MQTT)
endif()
# Adding include directory to a target
target_include_directories(MqttAdapter_tests_a_compA PUBLIC ${MQTT_INCLUDE_DIR})
target_include_directories(MqttAdapter_tests_a_compA PUBLIC ${LIBRARIES} ${MQTT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
# Linking libraries to target
target_link_libraries(MqttAdapter_tests_a_compA PUBLIC ${MQTT_LIBS})
target_link_libraries(MqttAdapter_tests_a_compA PUBLIC ${LIBRARIES} ${MQTT_LIBS})
# Export target to a cmake module file for outside usage
export(TARGETS MqttAdapter_tests_a_compA FILE MqttAdapter_tests_a_compA.cmake)
export(TARGETS MqttAdapter_tests_a_compA FILE MQTTAdapter_tests_a_compA.cmake)
# (c) https://github.com/MontiCore/monticore
# (c) https://github.com/MontiCore/monticore
# (c) https://github.com/MontiCore/monticore
# Created by Georg Vinogradov on 28.05.19
message("Searching for installed MQTT on your system...")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment