Alexander David Hellwig committed Feb 25, 2018 1 # EMAM2Middleware  Alexander David Hellwig committed Jul 09, 2018 2 3 ![pipeline](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/EMAM2Middleware/badges/master/build.svg) ![coverage](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/EMAM2Middleware/badges/master/coverage.svg)  Alexander David Hellwig committed Oct 22, 2018 4 5 6 7 8 9 ## Purpose This generator takes an EMAM or EMADL model and connects it to a middleware library. If all Ports of two connected Components are marked as middleware Ports, the generator will create 2 executables that can be deployed on different machines. All communication of these 2 Components will then be tunneled trough the specified middleware: ![MiddlewareAdapter](/uploads/6e9c69e6b56554579551769174df3697/MiddlewareAdapter.png)  Alexander David Hellwig committed Jun 26, 2018 10 11 12 ## Writing your own Middleware Generator see [TUTORIAL_ADD_MIDDLEWARE.md](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/EMAM2Middleware/blob/master/TUTORIAL_ADD_MIDDLEWARE.md)  Alexander David Hellwig committed Aug 12, 2018 13 ## Dependencies needed to compile the generated projects  Alexander David Hellwig committed Oct 21, 2018 14 ### All generated projects  Alexander David Hellwig committed Oct 21, 2018 15 CMake, Make,a C++ compiler, and Armadillo are required to compile the generated projects.  Alexander David Hellwig committed Oct 21, 2018 16 17 18 19 20 21 #### Linux Gcc is recommended as the C++ compiler. Example install of all needed packages for ubuntu: bash sudo apt install gcc cmake make   Alexander David Hellwig committed Oct 24, 2018 22 Then download Armadillo from here: [Linux](https://rwth-aachen.sciebo.de/s/igDWzLpdO5zYHBj/download?path=%2Fubuntu%2F18.10.24-armadillo-linux&files=armadillo-8.500.1-linux.zip) and set the environment variable Armadillo_HOME to the base dir of your installation.  Alexander David Hellwig committed Aug 12, 2018 23   Alexander David Hellwig committed Oct 21, 2018 24 To check everything is installed correctly use whereis/ls:  Alexander David Hellwig committed Oct 21, 2018 25 26 27 28 29 30 31 bash $whereis g++ g++: /usr/bin/g++$ whereis cmake cmake: /usr/bin/cmake $whereis make make: /usr/bin/make  Alexander David Hellwig committed Oct 21, 2018 32 $ ls "$Armadillo_HOME/include"  Alexander David Hellwig committed Oct 21, 2018 33 34 35 armadillo_bits armadillo.h   Alexander David Hellwig committed Oct 21, 2018 36 Compiling a generated project:  Alexander David Hellwig committed Oct 21, 2018 37 bash  Alexander David Hellwig committed Oct 21, 2018 38 cd /path/to/build/directory  Alexander David Hellwig committed Oct 21, 2018 39 40 41 cmake /path/to/generated/project/source make   Alexander David Hellwig committed Oct 21, 2018 42   Alexander David Hellwig committed Oct 21, 2018 43 #### Windows  Alexander David Hellwig committed Oct 24, 2018 44 Mingw64 gcc is recommended as the C++ compiler. Download a version with all needed tools from [here](https://rwth-aachen.sciebo.de/s/igDWzLpdO5zYHBj/download?path=%2Fwin64&files=mingw64.zip).  Alexander David Hellwig committed Oct 21, 2018 45   Alexander David Hellwig committed Oct 21, 2018 46 CMake for Windows: https://cmake.org/download/  Alexander David Hellwig committed Oct 21, 2018 47   Alexander David Hellwig committed Oct 21, 2018 48 49 Make for Windows: http://gnuwin32.sourceforge.net/packages/make.htm  Alexander David Hellwig committed Oct 24, 2018 50 51 Add the bin directories of all 3 to your PATH variable.  Alexander David Hellwig committed Oct 21, 2018 52 53 Then download Armadillo from here: [Windows](https://rwth-aachen.sciebo.de/s/igDWzLpdO5zYHBj/download?path=%2Fwin64&files=armadillo-8.200.2.zip) and set the environment variable Armadillo_HOME to the base dir of your installation. To check everything is installed correctly use where/dir:  Alexander David Hellwig committed Oct 21, 2018 54 batch  Alexander David Hellwig committed Oct 21, 2018 55 56 57 58 59 60 > where g++ C:\mingw64\bin\g++.exe > where cmake C:\Program Files\CMake\bin\cmake.exe > where make C:\Program Files\make-3.81-bin\bin\make.exe  Alexander David Hellwig committed Oct 24, 2018 61 > dir /b "%Armadillo_HOME%\include"  Alexander David Hellwig committed Oct 21, 2018 62 63 64 65 66 67 68 69 armadillo armadillo.h ...  Compiling a generated project: batch cd C:\path\to\build\directory  Alexander David Hellwig committed Oct 21, 2018 70 cmake C:\path\to\generated\project\source -G "MinGW Makefiles"  Alexander David Hellwig committed Oct 21, 2018 71 72 make   Alexander David Hellwig committed Aug 12, 2018 73   Michael Günther Beyer committed Oct 26, 2018 74 75 Please note: It is highly recommended, you stick to the exact versions as stated above. Otherwise you might run into trouble regarding the interplay between cmake/make and the Armadillo library. In particular problems have been reported using Cygwin.  Alexander David Hellwig committed Oct 21, 2018 76 ### Projects with roscpp generator  Alexander David Hellwig committed Aug 12, 2018 77 78 79 Only for generated projects that contain a ROS adapter(e.g. -g=cpp,roscpp). ROS Kinetic currently only supports Linux and the installation is described [here](http://wiki.ros.org/kinetic/Installation/Ubuntu).  ahellwig committed Feb 25, 2018 80 ## Usage  Alexander David Hellwig committed Jun 26, 2018 81 82 ### CLI Maven generates the jar embedded-montiarc-math-middleware-generator-{Version}-jar-with-dependencies.jar  Alexander David Hellwig committed Feb 01, 2019 83 and the cli is located in de.monticore.lang.monticar.generator.middleware.cli.DistributedTargetGeneratorCli.  Alexander David Hellwig committed Jun 26, 2018 84   Alexander David Hellwig committed Jan 07, 2019 85 Parameters: ${file path to config json} OR -r \${raw json config string}  Alexander David Hellwig committed Feb 12, 2019 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112  Example: [CliUsage.sh](src/test/resources/CliUsage.sh) An example config file with all clustering algorithms: [config](src/test/resources/config/parameterTest/clusterParamsAllAlgos.json) | Name | Type | Required | Description | |----------------------|--------|----------|-------------------------------------------------------------------------------------------| | modelsDir | String | ✅ | path to directory with EMAM models | | outputDir | String | ✅ | path to output directory for generated files | | rootModel | String | ✅ | fully qualified name of the root model | | generators | List | ✅ | List of generator identfiers