diff --git a/src/main/java/com/eprosima/fastdds/fastddsgen.java b/src/main/java/com/eprosima/fastdds/fastddsgen.java index b2d10686..11320609 100644 --- a/src/main/java/com/eprosima/fastdds/fastddsgen.java +++ b/src/main/java/com/eprosima/fastdds/fastddsgen.java @@ -875,7 +875,7 @@ private Project parseIDL( returnedValue = Utils.writeFile(fileNameH, maintemplates.getTemplate("SerializationHeader"), m_replace); project.addCommonTestingFile(relative_dir + ctx.getFilename() + "PubSubTypes.cxx"); - + for (String element : project.getFullDependencies()) { String trimmedElement = element.substring(0, element.length() - 4);// Remove .idl @@ -884,29 +884,28 @@ private Project parseIDL( } // TODO: Uncomment following lines and create templates + System.out.println("Generating TopicDataTypes files..."); + returnedValue &= + Utils.writeFile(output_dir + ctx.getFilename() + "PubSubTypes.h", + maintemplates.getTemplate("DDSPubSubTypeHeader"), m_replace); + if (ctx.existsLastStructure()) { m_atLeastOneStructure = true; project.setHasStruct(true); - System.out.println("Generating TopicDataTypes files..."); if (returnedValue = - Utils.writeFile(output_dir + ctx.getFilename() + "PubSubTypes.h", - maintemplates.getTemplate("DDSPubSubTypeHeader"), m_replace)) + Utils.writeFile(output_dir + ctx.getFilename() + "PubSubTypes.cxx", + maintemplates.getTemplate("DDSPubSubTypeSource"), m_replace)) { - if (returnedValue = - Utils.writeFile(output_dir + ctx.getFilename() + "PubSubTypes.cxx", - maintemplates.getTemplate("DDSPubSubTypeSource"), m_replace)) + project.addProjectIncludeFile(relative_dir + ctx.getFilename() + "PubSubTypes.h"); + project.addProjectSrcFile(relative_dir + ctx.getFilename() + "PubSubTypes.cxx"); + if (m_python) { - project.addProjectIncludeFile(relative_dir + ctx.getFilename() + "PubSubTypes.h"); - project.addProjectSrcFile(relative_dir + ctx.getFilename() + "PubSubTypes.cxx"); - if (m_python) - { - System.out.println("Generating Swig interface files..."); - returnedValue = Utils.writeFile( - output_dir + ctx.getFilename() + "PubSubTypes.i", - maintemplates.getTemplate("DDSPubSubTypeSwigInterface"), m_replace); - } + System.out.println("Generating Swig interface files..."); + returnedValue = Utils.writeFile( + output_dir + ctx.getFilename() + "PubSubTypes.i", + maintemplates.getTemplate("DDSPubSubTypeSwigInterface"), m_replace); } } diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/CMakeLists.stg b/src/main/java/com/eprosima/fastdds/idl/templates/CMakeLists.stg index 844ec0e6..8fc06de8 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/CMakeLists.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/CMakeLists.stg @@ -37,9 +37,11 @@ message(STATUS "Configuring $project.name$...") add_library($project.name$_lib $project.commonSrcFiles : {$it$}; separator=" "$) target_link_libraries($project.name$_lib $solution.libraries : {$it$}; separator=" "$) +$if(!project.projectSrcFiles.empty)$ add_executable($project.name$ $project.projectSrcFiles : {$it$}; separator=" "$) target_link_libraries($project.name$ $solution.libraries : {$it$}; separator=" "$ $project.name$_lib $project.dependencies : {$it$_lib}; separator=" "$) +$endif$ $if(test)$