Commit 84271562 authored by Alexander David Hellwig's avatar Alexander David Hellwig

Merge branch 'RosWindowsSupport' into 'master'

Add compile script for Ros Melodic + Windows

See merge request !37
parents ebb31d40 d309c402
Pipeline #162120 canceled with stages
# Dependencies needed to compile the generated projects # Dependencies needed to compile the generated projects
## Note ## Note
The generator creates compile scripts for all supported compilers. A project with ROS Middleware contains `compile.sh`, as only Linux is supported by ROS. A project with ROS2 contains `compile.sh` and `compileMsbuild.bat` as Linux and Windows(with Msbuild) are supported. The generator creates compile scripts for all supported compilers. A project with ROS or ROS2 contains `compile.sh` and `compileMsbuild.bat` as Linux and Windows(with Msbuild) are supported.
If you are having problems compiling on Windows because of the path length limit, use `substCompileMsbuild.bat` or `substCompileMingw.bat`. If you are having problems compiling on Windows because of the path length limit, use `substCompileMsbuild.bat` or `substCompileMingw.bat`.
## All generated projects ## All generated projects
CMake, Make, a C++ compiler, and Armadillo are required to compile the generated projects. CMake, Make, a C++ compiler, and Armadillo are required to compile the generated projects.
...@@ -80,6 +80,18 @@ Please note: It is highly recommended, you stick to the exact versions as stated ...@@ -80,6 +80,18 @@ Please note: It is highly recommended, you stick to the exact versions as stated
## Projects with roscpp generator ## Projects with roscpp generator
Only for generated projects that contain a ROS adapter(e.g. "generators":["cpp","roscpp"]). Only for generated projects that contain a ROS adapter(e.g. "generators":["cpp","roscpp"]).
ROS Kinetic currently only supports Linux and the installation is described [here](http://wiki.ros.org/kinetic/Installation/Ubuntu). ROS Kinetic currently only supports Linux and the installation is described [here](http://wiki.ros.org/kinetic/Installation/Ubuntu).
ROS Melodic is also supported on Windows and the installation is described [here](http://wiki.ros.org/Installation/Windows). You might need to patch the file `${ROS_HOME}\ros\console.h` like this:
```C++
extern ROSCONSOLE_DECL bool g_initialized;
=>
//extern ROSCONSOLE_DECL bool g_initialized;
...
if (ROS_UNLIKELY(!::ros::console::g_initialized)) \
=>
/*if (ROS_UNLIKELY(!::ros::console::g_initialized))*/ \
```
Set the environment varialble `ROS_HOME` to the base of your ROS installation. Set the environment varialble `ROS_HOME` to the base of your ROS installation.
## Projects with ros2cpp/rclcpp generator ## Projects with ros2cpp/rclcpp generator
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-middleware-generator</artifactId> <artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>0.0.23-SNAPSHOT</version> <version>0.0.24-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= --> <!-- == PROJECT DEPENDENCIES ============================================= -->
......
...@@ -18,6 +18,11 @@ public class MingwCompilationGenerator extends WindowsCompilationGenerator { ...@@ -18,6 +18,11 @@ public class MingwCompilationGenerator extends WindowsCompilationGenerator {
return WinGenKind.MINGW; return WinGenKind.MINGW;
} }
@Override
public boolean supportsRos() {
return false;
}
@Override @Override
public boolean supportsRos2() { public boolean supportsRos2() {
return false; return false;
......
...@@ -13,6 +13,12 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator { ...@@ -13,6 +13,12 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator {
return MiddlewareTemplates.generateCompileMsbuild(this); return MiddlewareTemplates.generateCompileMsbuild(this);
} }
@Override
public boolean supportsRos() {
return true;
}
@Override @Override
public boolean supportsRos2() { public boolean supportsRos2() {
return true; return true;
...@@ -21,7 +27,12 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator { ...@@ -21,7 +27,12 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator {
@Override @Override
public List<String> getAdditionalPathDirs() { public List<String> getAdditionalPathDirs() {
setAdditionalErrorMsg("vcvars64.bat", defaultErrorMsg("msbuild")); setAdditionalErrorMsg("vcvars64.bat", defaultErrorMsg("msbuild"));
setAdditionalErrorMsg("ros2", defaultErrorMsg("ROS2")); if(useRos()){
setAdditionalErrorMsg("ros", defaultErrorMsg("ROS"));
}
if(useRos2()) {
setAdditionalErrorMsg("ros2", defaultErrorMsg("ROS2"));
}
return Arrays.asList("cmake","msbuild"); return Arrays.asList("cmake","msbuild");
} }
...@@ -35,6 +46,9 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator { ...@@ -35,6 +46,9 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator {
public List<String> getPostSourceExecutables() { public List<String> getPostSourceExecutables() {
List<String> res = new ArrayList<>(); List<String> res = new ArrayList<>();
res.add("msbuild"); res.add("msbuild");
if(useRos()){
res.add("roscore");
}
if(useRos2()){ if(useRos2()){
res.add("ros2"); res.add("ros2");
} }
...@@ -45,6 +59,9 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator { ...@@ -45,6 +59,9 @@ public class MsbuildCompilationGenerator extends WindowsCompilationGenerator {
public List<String> getEnvironmentFiles() { public List<String> getEnvironmentFiles() {
List<String> res = new ArrayList<>(); List<String> res = new ArrayList<>();
res.add("vcvars64.bat"); res.add("vcvars64.bat");
if(useRos()){
res.add("%ROS_HOME%\\setup.bat");
}
if(useRos2()){ if(useRos2()){
res.add("%ROS2_HOME%\\local_setup.bat"); res.add("%ROS2_HOME%\\local_setup.bat");
} }
......
...@@ -12,11 +12,6 @@ public abstract class WindowsCompilationGenerator extends CompilationGenerator { ...@@ -12,11 +12,6 @@ public abstract class WindowsCompilationGenerator extends CompilationGenerator {
return "\r\n"; return "\r\n";
} }
@Override
public boolean supportsRos() {
return false;
}
@Override @Override
public List<FileContent> getCompilationScripts() { public List<FileContent> getCompilationScripts() {
ArrayList<FileContent> fileContents = new ArrayList<>(); ArrayList<FileContent> fileContents = new ArrayList<>();
......
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