Aufgrund einer Wartung wird GitLab am 29.10. zwischen 9:00 und 10:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 29.10. between 9:00 and 10:00 am.

Commit 0006b0de authored by Alexander David Hellwig's avatar Alexander David Hellwig

Merge branch 'master' into experiments_lab

# Conflicts:
#	src/test/java/de/monticore/lang/monticar/generator/middleware/GenerationTest.java
parents 351f67a2 8f93198c
# EMAM2Middleware
![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)
## 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)
## 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)
......@@ -13,7 +19,7 @@ Example install of all needed packages for ubuntu:
```bash
sudo apt install gcc cmake make
```
Then download Armadillo from here: [Linux](https://rwth-aachen.sciebo.de/s/igDWzLpdO5zYHBj/download?path=%2Fubuntu%2F18.06.20-armadillo-linux&files=armadillo-8.500.1-linux.zip) and set the environment variable `Armadillo_HOME` to the base dir of your installation.
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.
To check everything is installed correctly use whereis/ls:
```bash
......@@ -35,12 +41,14 @@ make
```
#### Windows
Mingw gcc is recommended as the C++ compiler. See http://www.mingw.org/wiki/howto_install_the_mingw_gcc_compiler_suite for installation details.
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).
CMake for Windows: https://cmake.org/download/
Make for Windows: http://gnuwin32.sourceforge.net/packages/make.htm
Add the bin directories of all 3 to your PATH variable.
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:
```batch
......@@ -50,7 +58,7 @@ C:\mingw64\bin\g++.exe
C:\Program Files\CMake\bin\cmake.exe
> where make
C:\Program Files\make-3.81-bin\bin\make.exe
> dir /b "$Armadillo_HOME\include"
> dir /b "%Armadillo_HOME%\include"
armadillo
armadillo.h
...
......
......@@ -9,7 +9,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>0.0.8-SNAPSHOT</version>
<version>0.0.10-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......@@ -17,7 +17,7 @@
<!-- .. SE-Libraries .................................................. -->
<se-commons.version>1.7.7</se-commons.version>
<Embedded-montiarc-math-generator.version>0.0.25-SNAPSHOT</Embedded-montiarc-math-generator.version>
<Embedded-montiarc-math-generator.version>0.0.26-SNAPSHOT</Embedded-montiarc-math-generator.version>
<Embedded-montiarc-math-roscpp-generator.version>0.0.4-SNAPSHOT</Embedded-montiarc-math-roscpp-generator.version>
<Embedded-montiarc-math-rosmsg-generator.version>0.0.3-SNAPSHOT</Embedded-montiarc-math-rosmsg-generator.version>
<EMADL.version>0.2.2-SNAPSHOT</EMADL.version>
......
......@@ -48,14 +48,16 @@ public class DistributedTargetGenerator extends CMakeGenerator {
subDirs.add(NameHelper.getNameTargetLanguage(comp.getFullName()));
}
subDirs.add("rosMsg");
files.add(generateCMake(componentInstanceSymbol));
files.add(generateRosMsgGen());
//generate rosMsg CMake iff a .msg file was generated
if(files.stream().anyMatch(f -> f.getName().endsWith(".msg"))){
subDirs.add("rosMsg");
files.add(generateRosMsgGen());
}
files.add(generateCMake(componentInstanceSymbol));
return files;
}
//TODO:refactor, dont always generate
private File generateRosMsgGen() throws IOException {
File file = new File(generationTargetPath + "rosMsg/CMakeLists.txt");
FileUtils.write(file, TemplateHelper.getStruct_msgsCmakeTemplate());
......
......@@ -24,6 +24,7 @@ import java.util.stream.Collectors;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
public class GenerationTest extends AbstractSymtabTest {
......@@ -320,6 +321,27 @@ public class GenerationTest extends AbstractSymtabTest {
}
@Test
public void testNoRosMsg() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
ExpandedComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<ExpandedComponentInstanceSymbol>resolve("tests.a.addComp", ExpandedComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
TagHelper.resolveTags(taggingResolver, componentInstanceSymbol);
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();
distributedTargetGenerator.setGenerationTargetPath("./target/generated-sources-cmake/noRosMsg/");
distributedTargetGenerator.add(new CPPGenImpl(),"cpp");
List<File> files = distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
List<String> filenames = files.stream().map(File::getAbsolutePath).map(name -> name.replace('\\','/')).collect(Collectors.toList());
assertFalse(filenames.stream().anyMatch(fn -> fn.endsWith("rosMsg/CMakeLists.txt")));
}
@Test
public void testLabComp() throws IOException{
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
......
......@@ -16,7 +16,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library
include_directories(${INCLUDE_DIRS})
add_library(tests_a_addComp tests_a_addComp.h)
target_include_directories(tests_a_addComp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(tests_a_addComp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(tests_a_addComp PUBLIC ${LIBS})
set_target_properties(tests_a_addComp PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -16,7 +16,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library
include_directories(${INCLUDE_DIRS})
add_library(ba_system_collisionDetection ba_system_collisionDetection.h)
target_include_directories(ba_system_collisionDetection PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ba_system_collisionDetection PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(ba_system_collisionDetection PUBLIC ${LIBS})
set_target_properties(ba_system_collisionDetection PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -16,7 +16,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library
include_directories(${INCLUDE_DIRS})
add_library(ba_system_intersectionController ba_system_intersectionController.h)
target_include_directories(ba_system_intersectionController PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ba_system_intersectionController PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(ba_system_intersectionController PUBLIC ${LIBS})
set_target_properties(ba_system_intersectionController PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -16,7 +16,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library
include_directories(${INCLUDE_DIRS})
add_library(ba_system_stopCommQuality_1_ ba_system_stopCommQuality_1_.h)
target_include_directories(ba_system_stopCommQuality_1_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ba_system_stopCommQuality_1_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(ba_system_stopCommQuality_1_ PUBLIC ${LIBS})
set_target_properties(ba_system_stopCommQuality_1_ PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -16,7 +16,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library
include_directories(${INCLUDE_DIRS})
add_library(ba_system_stopCommQuality_2_ ba_system_stopCommQuality_2_.h)
target_include_directories(ba_system_stopCommQuality_2_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ba_system_stopCommQuality_2_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(ba_system_stopCommQuality_2_ PUBLIC ${LIBS})
set_target_properties(ba_system_stopCommQuality_2_ PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -16,7 +16,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library
include_directories(${INCLUDE_DIRS})
add_library(ba_system_velocityController_1_ ba_system_velocityController_1_.h)
target_include_directories(ba_system_velocityController_1_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ba_system_velocityController_1_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(ba_system_velocityController_1_ PUBLIC ${LIBS})
set_target_properties(ba_system_velocityController_1_ PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -16,7 +16,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library
include_directories(${INCLUDE_DIRS})
add_library(ba_system_velocityController_2_ ba_system_velocityController_2_.h)
target_include_directories(ba_system_velocityController_2_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(ba_system_velocityController_2_ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(ba_system_velocityController_2_ PUBLIC ${LIBS})
set_target_properties(ba_system_velocityController_2_ PROPERTIES LINKER_LANGUAGE CXX)
......
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