Commit 3333f1b1 authored by Jan Philipp Haller's avatar Jan Philipp Haller
Browse files

WIP Bugfix library linkage

parent 16e45ca9
Pipeline #351891 failed with stage
in 4 minutes and 48 seconds
......@@ -128,7 +128,7 @@ public final class GeneratorCppCli {
runGenerator(cliArgs);
}else{
Log.error("Error parsing cli arguments!");
System.exit(1);
//System.exit(1);
}
}
......
......@@ -126,9 +126,10 @@ public class IpoptSolverGeneratorImplementation implements NLPSolverGeneratorImp
protected void addCMakeDependenciesToGenerator(EMAMBluePrintCPP bluePrint) {
Generator gen = bluePrint.getGenerator();
if (gen instanceof GeneratorCPP) {
CMakeConfig cmake = ((GeneratorCPP) gen).getCMakeConfig();
//ToDo: Find bug, why linkage generation isn't executed.
//((GeneratorCPP) gen).getCMakeConfig().addCmakeLibraryLinkage("ipopt");
((GeneratorCPP) gen).getCMakeConfig().addCMakeCommand("set(LIBS ${LIBS} ipopt)");
cmake.addCmakeLibraryLinkage("ipopt");
}
}
......
......@@ -16,8 +16,8 @@ find_package(${var.packageName} <#if var.required>REQUIRED<#else></#if>)
</#list>
# additional library linkage
<#list viewModel.cmakeLibraryLinkageList as cmd>
set(LIBS ${r"${LIBS}"} ${cmd})
<#list viewModel.cmakeLibraryLinkageList as link>
set(LIBS ${r"${LIBS}"} "${link}")
</#list>
# additional commands
......
......@@ -4,6 +4,7 @@ package de.monticore.lang.monticar.generator.cmake;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.AbstractSymtabTest;
import de.monticore.lang.monticar.generator.cpp.GeneratorCPP;
import de.monticore.lang.monticar.generator.cpp.GeneratorCppCli;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import de.se_rwth.commons.logging.Log;
import org.junit.Before;
......@@ -13,8 +14,10 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertNotNull;
/**
......@@ -111,4 +114,18 @@ public class GenerateCMakeTest extends AbstractSymtabTest {
testCMakeFilesEqual(files, restPath);
}
@Test
public void testModelWithIpopt() {
Log.getFindings().clear();
String[] args = {"-m", "src/test/resources", "-r", "ipopt.QuadraticOpt", "-o", "./target/generated-sources-emadl"};
GeneratorCppCli.main(args);
//checkFilesAreEqual(Paths.get("./target/generated-sources-emadl"), Paths.get("./src/test/resources/target_code/ipopt"), Arrays.asList(
// "CMakeLists.txt"
//));
assertTrue(Log.getFindings().isEmpty());
}
}
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