Commit 4bc5a628 authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Update Generator Interface

parent a6e85af0
......@@ -5,7 +5,7 @@ call variables.bat
set STREAM_TESTING=%PROJECT_ROOT%\target\generated-sources-cpp\streamtest
set AUTOPILOT_TESTS=%STREAM_TESTING%\target\generated-sources-cpp\streamtest\autopilot
set STREAM_TEST_EXEC_DIR=%STREAM_TESTING%\exec
g++ -version
g++ --version
g++ -std=c++11 ^
-I"%JAVA_HOME%\include_win" ^
......
......@@ -3,6 +3,7 @@ package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.lang.monticar.generator.cmake.CMakeConfig;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import de.monticore.symboltable.Scope;
......@@ -16,6 +17,13 @@ import java.util.List;
*/
public interface Generator {
// Cmake
CMakeConfig getCmakeConfig();
boolean isGenerateCMake();
void setGenerateCMake(boolean generateCMake);
String getGenerationTargetPath();
void setGenerationTargetPath(String newPath);
......
......@@ -55,6 +55,8 @@ public class CMakeConfig {
private List<String> cmakeCommandListEnd = new ArrayList<>();
private List<String> cmakeLibraryLinkage = new ArrayList<>();
// constructor
public CMakeConfig(String compName) {
cMakeListsViewModel.setCompName(compName);
......@@ -63,6 +65,7 @@ public class CMakeConfig {
// methods
protected void configureCMakeListsViewModel() {
cMakeListsViewModel.setCmakeLibraryLinkageList(cmakeLibraryLinkage);
cMakeListsViewModel.setCmakeCommandList(cmakeCommandList);
cMakeListsViewModel.setCmakeCommandListEnd(cmakeCommandListEnd);
}
......@@ -146,4 +149,7 @@ public class CMakeConfig {
}
public void addCmakeLibraryLinkage(String cmakeLibraryLinkage) {
this.cmakeLibraryLinkage.add(cmakeLibraryLinkage);
}
}
......@@ -25,6 +25,8 @@ public class CMakeListsCPPViewModel extends ViewModelBase {
private List<String> cmakeCommandListEnd = new ArrayList<>();
private List<String> cmakeLibraryLinkageList = new ArrayList<>();
// methods
public String getCompName() {
......@@ -58,4 +60,12 @@ public class CMakeListsCPPViewModel extends ViewModelBase {
public void setCmakeCommandListEnd(List<String> cmakeCommandListEnd) {
this.cmakeCommandListEnd = cmakeCommandListEnd;
}
public List<String> getCmakeLibraryLinkageList() {
return cmakeLibraryLinkageList;
}
public void setCmakeLibraryLinkageList(List<String> cmakeLibraryLinkageList) {
this.cmakeLibraryLinkageList = cmakeLibraryLinkageList;
}
}
......@@ -127,6 +127,18 @@ public class GeneratorCPP implements Generator {
return generateString(taggingResolver, componentInstanceSymbol, mathSymbol);
}
@Override
public CMakeConfig getCmakeConfig() {
if (cMakeConfig == null)
setupCMake();
return cMakeConfig;
}
@Override
public boolean isGenerateCMake() {
return generateCMake;
}
@Override
public String getGenerationTargetPath() {
return generationTargetPath;
......@@ -486,6 +498,7 @@ public class GeneratorCPP implements Generator {
String fileContents = AllTemplates.generateAutopilotAdapterH(dm);
return new FileContent(fileContents, "AutopilotAdapter.h");
}
private static FileContent generateAutopilotAdapterCpp(AutopilotAdapterDataModel dm) {
String fileContents = AllTemplates.generateAutopilotAdapterCpp(dm);
if (currentInstance.generateCMake)
......
......@@ -15,9 +15,14 @@ find_package(${var.packageName} <#if var.required>REQUIRED<#else></#if>)
<#if var.fortranQuadMath>set(LIBS ${r"${LIBS}"} "quadmath")</#if>
</#list>
# additional library linkage
<#list viewModel.cmakeLibraryLinkageList as cmd>
set(LIBS "${LIBS}" ${cmd})
</#list>
# additional commands
<#list viewModel.cmakeCommandList as cmd>
${cmd}
${cmd}
</#list>
# create static library
......
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