Commit 11306f7c authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Fix: ros1 include dir for struct_msgs

parent 68f78782
Pipeline #118280 failed with stages
in 44 seconds
......@@ -122,11 +122,12 @@ public class GeneratorRosCpp {
.map(RosConnectionSymbol::getTopicType)
.map(Optional::get)
.map(n -> n.split("/")[0])
//dont add struct_msgs if we are in ros1 mode
.filter(s -> ros2Mode || !s.equals("struct_msgs"))
.forEach(allPackages::add);
allPackages.forEach(model::addPackage);
if(!ros2Mode){
model.addExcludeFindPackage("struct_msgs");
}
List<FileContent> result = new ArrayList<>();
result.add(new FileContent("CMakeLists.txt", RosCppTemplates.generateRosCMakeLists(model)));
......
......@@ -9,6 +9,7 @@ public class RosCppCMakeListsModel {
private String name;
private String compName;
private List<String> packages = new ArrayList<>();
private List<String> excludeFindPackages = new ArrayList<>();
public String getName() {
return name;
......@@ -25,6 +26,14 @@ public class RosCppCMakeListsModel {
.collect(Collectors.toList());
}
public List<String> getExcludeFindPackages() {
return excludeFindPackages;
}
public void addExcludeFindPackage(String excludeFindPackage) {
this.excludeFindPackages.add(excludeFindPackage);
}
public RosCppCMakeListsModel(String name, String compName) {
this.name = name;
this.compName = compName;
......
......@@ -4,7 +4,9 @@ set (CMAKE_CXX_STANDARD 14)
set (AMENT_CMAKE_UNINSTALL_TARGET FALSE)
<#list model.getPackages() as pack>
<#if !model.getExcludeFindPackages()?seq_contains(pack)>
find_package(${pack} REQUIRED)
</#if>
</#list>
add_library(${model.name} ${model.name}.cpp)
......@@ -12,13 +14,13 @@ add_library(${model.name} ${model.name}.cpp)
list(APPEND LIBRARIES ${model.compName})
list(APPEND LIBRARIES IAdapter_${model.compName})
<#list model.getPackages() as lib>
list(APPEND LIBRARIES ${r"${"}${lib}_LIBRARIES})
list(APPEND LIBRARIES ${r"${"}${lib}_LIBRARIES})
</#list>
target_link_libraries(${model.name} <#noparse>${LIBRARIES}</#noparse>)
list(APPEND INCLUDE_DIRS <#noparse>${CMAKE_CURRENT_SOURCE_DIR}</#noparse>)
<#list model.getPackages() as incl>
list(APPEND INCLUDE_DIRS ${r"${"}${incl}_INCLUDE_DIRS})
list(APPEND INCLUDE_DIRS ${r"${"}${incl}_INCLUDE_DIRS})
</#list>
target_include_directories(${model.name} PUBLIC <#noparse>${INCLUDE_DIRS}</#noparse>)
......
Supports Markdown
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