Commit 48b98881 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'CMakeUpdate' into 'master'

CMake update

See merge request !13
parents 0c204286 894ce02c
Pipeline #68032 passed with stages
in 10 minutes and 11 seconds
......@@ -4,6 +4,27 @@
## 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)
## Dependencies needed to compile the generated projects
### CMake
CMake and Make are required to compile the generated projects.
Usage: Navigate to your build directory and run `cmake $srcPath`, where `$srcPath` is the path to the generated project to be compiled. Next run `make`
### Cpp
Armadillo version 8 or higher.
The version used in EMAStudio can be downloaded from:
* [Windows](https://github.com/EmbeddedMontiArc/EMAStudioBuilder/releases/download/libraries/armadillo-8.200.2.zip)
* [Linux](https://rwth-aachen.sciebo.de/s/igDWzLpdO5zYHBj/download?path=%2Fubuntu%2F18.06.20-armadillo-linux&files=armadillo-8.500.1-linux.zip)
WARNING: Both linked versions contain a copy of the file `armadillo` called `armadillo.h`, which is not contained in standard armadillo distributions.
It is required by the code generated by EMAM2Cpp.
The environment variable `Armadillo_HOME` needs to be set to the base directory of your armadillo installation.
### Roscpp
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).
## Usage
### CLI
Maven generates the jar `embedded-montiarc-math-middleware-generator-{Version}-jar-with-dependencies.jar`
......@@ -14,6 +35,9 @@ CLI Options:
* -r/--root-model: fully qualified name of the root model
* -o/--output-dir: full path to output directory for generated files
* -g/--generators: identifiers for the generators that should be used
* currently supported:
* cpp
* roscpp
* seperated by ','
* example: cpp,roscpp
......
......@@ -9,7 +9,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>0.0.6-SNAPSHOT</version>
<version>0.0.7-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.18-SNAPSHOT</Embedded-montiarc-math-generator.version>
<Embedded-montiarc-math-generator.version>0.0.25-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>
<!--TODO: remove with update to new emam version-->
......
......@@ -52,7 +52,4 @@ public class TemplateHelper {
return getTemplate("coordinatorCmakeListsTemplate.ftl");
}
public static String getCmakeCppTemplate() {
return getTemplate("cmakeCppTemplate.ftl");
}
}
......@@ -2,6 +2,7 @@ package de.monticore.lang.monticar.generator.middleware.impls;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.cmake.CMakeConfig;
import de.monticore.lang.monticar.generator.cpp.GeneratorCPP;
import de.monticore.lang.monticar.generator.middleware.helpers.NameHelper;
import de.monticore.lang.monticar.generator.middleware.helpers.TemplateHelper;
......@@ -19,6 +20,7 @@ public class CPPGenImpl implements GeneratorImpl {
public CPPGenImpl(){
generatorCPP = new GeneratorCPP();
generatorCPP.useArmadilloBackend();
generatorCPP.setGenerateCMake(true);
}
public void setGeneratorCPP(GeneratorCPP generatorCPP){
......@@ -30,7 +32,6 @@ public class CPPGenImpl implements GeneratorImpl {
List<File> files = new ArrayList<>();
generatorCPP.setGenerationTargetPath(generationTargetPath);
files.add(generatorCPP.generateFile(generateCMake(componentInstanceSymbol)));
files.addAll(generatorCPP.generateFiles(componentInstanceSymbol, taggingResolver));
return files;
......@@ -41,11 +42,4 @@ public class CPPGenImpl implements GeneratorImpl {
this.generationTargetPath = path;
}
private FileContent generateCMake(ExpandedComponentInstanceSymbol componentInstanceSymbol) {
FileContent cmake = new FileContent();
cmake.setFileName("CMakeLists.txt");
String name = NameHelper.getNameTargetLanguage(componentInstanceSymbol.getFullName());
cmake.setFileContent(TemplateHelper.getCmakeCppTemplate().replace("${compName}", name));
return cmake;
}
}
cmake_minimum_required(VERSION 3.5)
project(${compName} LANGUAGES CXX)
add_library(${compName} ${compName}.h)
target_include_directories(${compName} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${compName} PROPERTIES LINKER_LANGUAGE CXX)
export(TARGETS ${compName} FILE ${compName}.cmake)
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(tests_a_addComp LANGUAGES CXX)
#set cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add dependencies
find_package(Armadillo REQUIRED)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Armadillo_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# additional commands
# 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_link_libraries(tests_a_addComp PUBLIC ${LIBS})
set_target_properties(tests_a_addComp PROPERTIES LINKER_LANGUAGE CXX)
# export cmake project
export(TARGETS tests_a_addComp FILE tests_a_addComp.cmake)
# additional commands end
# Automatically generated file
#
# - Try to find Armadillo
# Once done this will define
# Armadillo_FOUND - System has Armadillo
# Armadillo_INCLUDE_DIRS - The Armadillo include directories
# Armadillo_LIBRARY_DIRS - The library directories needed to use Armadillo
# Armadillo_LIBRARIES - The libraries needed to use Armadillo
find_path(Armadillo_INCLUDE_DIR
NAMES armadillo
PATH_SUFFIXES "include"
PATHS
HINTS $ENV{Armadillo_HOME}
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
find_package_handle_standard_args(
Armadillo
DEFAULT_MSG
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
mark_as_advanced(
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(ba_system_collisionDetection LANGUAGES CXX)
#set cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add dependencies
find_package(Armadillo REQUIRED)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Armadillo_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# additional commands
# 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_link_libraries(ba_system_collisionDetection PUBLIC ${LIBS})
set_target_properties(ba_system_collisionDetection PROPERTIES LINKER_LANGUAGE CXX)
# export cmake project
export(TARGETS ba_system_collisionDetection FILE ba_system_collisionDetection.cmake)
# additional commands end
# Automatically generated file
#
# - Try to find Armadillo
# Once done this will define
# Armadillo_FOUND - System has Armadillo
# Armadillo_INCLUDE_DIRS - The Armadillo include directories
# Armadillo_LIBRARY_DIRS - The library directories needed to use Armadillo
# Armadillo_LIBRARIES - The libraries needed to use Armadillo
find_path(Armadillo_INCLUDE_DIR
NAMES armadillo
PATH_SUFFIXES "include"
PATHS
HINTS $ENV{Armadillo_HOME}
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
find_package_handle_standard_args(
Armadillo
DEFAULT_MSG
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
mark_as_advanced(
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(ba_system_intersectionController LANGUAGES CXX)
#set cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add dependencies
find_package(Armadillo REQUIRED)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Armadillo_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# additional commands
# 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_link_libraries(ba_system_intersectionController PUBLIC ${LIBS})
set_target_properties(ba_system_intersectionController PROPERTIES LINKER_LANGUAGE CXX)
# export cmake project
export(TARGETS ba_system_intersectionController FILE ba_system_intersectionController.cmake)
# additional commands end
# Automatically generated file
#
# - Try to find Armadillo
# Once done this will define
# Armadillo_FOUND - System has Armadillo
# Armadillo_INCLUDE_DIRS - The Armadillo include directories
# Armadillo_LIBRARY_DIRS - The library directories needed to use Armadillo
# Armadillo_LIBRARIES - The libraries needed to use Armadillo
find_path(Armadillo_INCLUDE_DIR
NAMES armadillo
PATH_SUFFIXES "include"
PATHS
HINTS $ENV{Armadillo_HOME}
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
find_package_handle_standard_args(
Armadillo
DEFAULT_MSG
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
mark_as_advanced(
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(ba_system_stopCommQuality_1_ LANGUAGES CXX)
#set cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add dependencies
find_package(Armadillo REQUIRED)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Armadillo_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# additional commands
# 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_link_libraries(ba_system_stopCommQuality_1_ PUBLIC ${LIBS})
set_target_properties(ba_system_stopCommQuality_1_ PROPERTIES LINKER_LANGUAGE CXX)
# export cmake project
export(TARGETS ba_system_stopCommQuality_1_ FILE ba_system_stopCommQuality_1_.cmake)
# additional commands end
# Automatically generated file
#
# - Try to find Armadillo
# Once done this will define
# Armadillo_FOUND - System has Armadillo
# Armadillo_INCLUDE_DIRS - The Armadillo include directories
# Armadillo_LIBRARY_DIRS - The library directories needed to use Armadillo
# Armadillo_LIBRARIES - The libraries needed to use Armadillo
find_path(Armadillo_INCLUDE_DIR
NAMES armadillo
PATH_SUFFIXES "include"
PATHS
HINTS $ENV{Armadillo_HOME}
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
find_package_handle_standard_args(
Armadillo
DEFAULT_MSG
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
mark_as_advanced(
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(ba_system_stopCommQuality_2_ LANGUAGES CXX)
#set cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add dependencies
find_package(Armadillo REQUIRED)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Armadillo_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# additional commands
# 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_link_libraries(ba_system_stopCommQuality_2_ PUBLIC ${LIBS})
set_target_properties(ba_system_stopCommQuality_2_ PROPERTIES LINKER_LANGUAGE CXX)
# export cmake project
export(TARGETS ba_system_stopCommQuality_2_ FILE ba_system_stopCommQuality_2_.cmake)
# additional commands end
# Automatically generated file
#
# - Try to find Armadillo
# Once done this will define
# Armadillo_FOUND - System has Armadillo
# Armadillo_INCLUDE_DIRS - The Armadillo include directories
# Armadillo_LIBRARY_DIRS - The library directories needed to use Armadillo
# Armadillo_LIBRARIES - The libraries needed to use Armadillo
find_path(Armadillo_INCLUDE_DIR
NAMES armadillo
PATH_SUFFIXES "include"
PATHS
HINTS $ENV{Armadillo_HOME}
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
find_package_handle_standard_args(
Armadillo
DEFAULT_MSG
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
mark_as_advanced(
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(ba_system_velocityController_1_ LANGUAGES CXX)
#set cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add dependencies
find_package(Armadillo REQUIRED)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Armadillo_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# additional commands
# 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_link_libraries(ba_system_velocityController_1_ PUBLIC ${LIBS})
set_target_properties(ba_system_velocityController_1_ PROPERTIES LINKER_LANGUAGE CXX)
# export cmake project
export(TARGETS ba_system_velocityController_1_ FILE ba_system_velocityController_1_.cmake)
# additional commands end
# Automatically generated file
#
# - Try to find Armadillo
# Once done this will define
# Armadillo_FOUND - System has Armadillo
# Armadillo_INCLUDE_DIRS - The Armadillo include directories
# Armadillo_LIBRARY_DIRS - The library directories needed to use Armadillo
# Armadillo_LIBRARIES - The libraries needed to use Armadillo
find_path(Armadillo_INCLUDE_DIR
NAMES armadillo
PATH_SUFFIXES "include"
PATHS
HINTS $ENV{Armadillo_HOME}
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
find_package_handle_standard_args(
Armadillo
DEFAULT_MSG
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
mark_as_advanced(
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(ba_system_velocityController_2_ LANGUAGES CXX)
#set cmake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# add dependencies
find_package(Armadillo REQUIRED)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Armadillo_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# additional commands
# 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_link_libraries(ba_system_velocityController_2_ PUBLIC ${LIBS})
set_target_properties(ba_system_velocityController_2_ PROPERTIES LINKER_LANGUAGE CXX)
# export cmake project
export(TARGETS ba_system_velocityController_2_ FILE ba_system_velocityController_2_.cmake)
# additional commands end
# Automatically generated file
#
# - Try to find Armadillo
# Once done this will define
# Armadillo_FOUND - System has Armadillo
# Armadillo_INCLUDE_DIRS - The Armadillo include directories
# Armadillo_LIBRARY_DIRS - The library directories needed to use Armadillo
# Armadillo_LIBRARIES - The libraries needed to use Armadillo
find_path(Armadillo_INCLUDE_DIR
NAMES armadillo
PATH_SUFFIXES "include"
PATHS
HINTS $ENV{Armadillo_HOME}
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
find_package_handle_standard_args(
Armadillo
DEFAULT_MSG
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
mark_as_advanced(
Armadillo_INCLUDE_DIR
Armadillo_LIBRARY
)
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
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