Fix: Dummy Adapter generated files

parent 762dc631
......@@ -23,12 +23,13 @@ public class DummyMiddlewareGenImpl implements GeneratorImpl {
List<File> res = new ArrayList<>();
res.add(FileHelper.generateFile(generationTargetPath, generateCMake(componentInstanceSymbol)));
res.add(FileHelper.generateFile(generationTargetPath, generateAdapter(componentInstanceSymbol)));
res.add(FileHelper.generateFile(generationTargetPath, generateAdapterHeader(componentInstanceSymbol)));
res.add(FileHelper.generateFile(generationTargetPath, generateAdapterCpp(componentInstanceSymbol)));
return res;
}
private FileContent generateAdapter(EMAComponentInstanceSymbol componentInstanceSymbol) {
private FileContent generateAdapterHeader(EMAComponentInstanceSymbol componentInstanceSymbol) {
String name = NameHelper.getNameTargetLanguage(componentInstanceSymbol.getFullName());
String content = TemplateHelper.getDummyAdapterTemplate()
.replace("${compName}", name);
......@@ -39,6 +40,15 @@ public class DummyMiddlewareGenImpl implements GeneratorImpl {
return res;
}
private FileContent generateAdapterCpp(EMAComponentInstanceSymbol componentInstanceSymbol){
String name = NameHelper.getNameTargetLanguage(componentInstanceSymbol.getFullName());
String content = "#include \"" + name +".h\"";
FileContent res = new FileContent();
res.setFileName("DummyAdapter_" + name + ".cpp");
res.setFileContent(content);
return res;
}
@Override
public void setGenerationTargetPath(String path) {
this.generationTargetPath = path;
......
......@@ -4,7 +4,7 @@ project (Coordinator_${compName} CXX)
set (CMAKE_CXX_STANDARD 14)
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_library(IAdapter_${compName} IAdapter_${compName}.cxx)
add_library(IAdapter_${compName} IAdapter_${compName}.cpp)
target_link_libraries(IAdapter_${compName} ${compName})
target_include_directories(IAdapter_${compName} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
......
cmake_minimum_required(VERSION 3.5)
project (DummyAdapter_${compName})
add_library(DummyAdapter_${compName} DummyAdapter_${compName}.h)
add_library(DummyAdapter_${compName} DummyAdapter_${compName}.cpp)
set_target_properties(DummyAdapter_${compName} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(DummyAdapter_${compName} ${compName})
target_link_libraries(DummyAdapter_${compName} ${compName} IAdapter_${compName})
target_include_directories(DummyAdapter_${compName} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
export(TARGETS DummyAdapter_${compName} FILE DummyAdapter_${compName}.cmake)
......@@ -56,12 +56,12 @@ public class GenerationTest extends AbstractSymtabTest {
assertNotNull(componentInstanceSymbol);
TagHelper.resolveTags(taggingResolver, componentInstanceSymbol);
StarBridgeGenerator starBridgeGenerator = new CMakeGenerator();
starBridgeGenerator.setGenerationTargetPath("./target/generated-sources-cmake/CMakeGeneration/src/");
starBridgeGenerator.add(new CPPGenImpl(), "cpp");
starBridgeGenerator.add(new RosCppGenImpl(), "roscpp");
CMakeGenerator cmakeGenerator = new CMakeGenerator();
cmakeGenerator.setGenerationTargetPath("./target/generated-sources-cmake-no-build/CMakeGeneration/src/");
cmakeGenerator.add(new CPPGenImpl(), "cpp");
cmakeGenerator.add(new RosCppGenImpl(), "roscpp");
starBridgeGenerator.generate(componentInstanceSymbol, taggingResolver);
cmakeGenerator.generate(componentInstanceSymbol, taggingResolver);
}
@Test
......
#run from project root!
#make sure all ros packages have been sourced!
function quitOnError {
if [ "$?" -ne 0 ]
then
echo "Failed building $1!"
echo "$1" >> failed.log
exit 1
fi
}
function build() {
echo Trying to build "$1"
echo creating dir "$1"/build
mkdir "$1"/build
quitOnError "$1"
echo CMake
cmake -B"$1"/build/ -H"$1"/src/ -DCMAKE_BUILD_TYPE=DEBUG
quitOnError "$1"
echo make
make -s -C "$1"/build/
quitOnError "$1"
}
cd target/generated-sources-cmake/
quitOnError "cd"
rm "failed.log"
export -f quitOnError
export -f build
projects=`find -maxdepth 1 -type d -not -name .`
parallel --no-notice -N1 --halt soon,fail=1 --eta -m build ::: $projects
if [[ -f "failed.log" ]]
then
echo "Failed!"
exit 1
else
echo "Success!"
exit 0
fi
\ 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