Commit 204e9b2d authored by Jan Philipp Haller's avatar Jan Philipp Haller
Browse files

Merge branch 'master' into Haller

# Conflicts:
#	pom.xml
#	src/main/java/de/monticore/lang/monticar/generator/cpp/mathopt/optimizationSolver/problem/ProblemAssignmentHandler.java
#	src/main/java/de/monticore/lang/monticar/generator/cpp/mathopt/optimizationSolver/solver/ipopt/IpoptSolverGeneratorImplementation.java
#	src/main/resources/template/cmake/CMakeListsCppTemplate.ftl
parents f520cbef 156ed959
......@@ -26,3 +26,4 @@ buildNumber.properties
.vscode/
.settings/
temp/
\ No newline at end of file
{
"configurations": [
{
"type": "java",
"name": "JAR EMAM2CPP",
"request": "launch",
"mainClass": "de.monticore.lang.monticar.generator.cpp.GeneratorCppCli",
"cwd": "${workspaceFolder}",
"classPaths": [
"${workspaceFolder}/target/embedded-montiarc-math-generator-0.4.5-jar-with-dependencies.jar"
],
"args": [
"--models-dir=temp/model",
"--root-model=de.rwth.armin.modeling.autopilot.autopilot",
"--output-dir=temp/target/cpp",
"--output-name=test1",
"--flag-use-armadillo-backend",
"--tcp-adapter",
"--flag-generate-cmake"
]
}
]
}
\ No newline at end of file
......@@ -38,5 +38,36 @@ Create a environment variable called _Armadillo_Home_ with the path to the base
* For conversion between _Armadillo_-matrix/cube and _OpenCV_-matrix/cube it exists a helper-header _ConvHelper.h_. This is generated automatically if at least one CV-command is used.
* For more information about how to use CV-Command, see the _BallTracking_-project in the application repository.
## Install Loop Solver Code Generation
### [Odeint](http://headmyshoulder.github.io/odeint-v2/)
* Download the header only library Boost [here](https://www.boost.org/)
* Extract the library to a destination of your choice (e.g. `C:\lib`)
* Add the environment variable `BOOST_HOME` with the library as value (e.g. `C:\lib\boost`)
### [DAECPP](https://github.com/ikorotkin/dae-cpp)
* Follow the steps described [here](https://github.com/ikorotkin/dae-cpp#installation) to install the
[Intel Math Kernel Library](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html)
version `2019.3`
* Add the environment variable `MKL_HOME` (e.g. `C:\lib\mkl\compilers_and_libraries_2019.3.203\windows\mkl`)
* Clone the project dae-cpp from git to a destination of your choice (e.g. `C:\lib\install`)
* `git clone https://github.com/ikorotkin/dae-cpp.git`
* Navigate to this directory and replace the CMakeLists with the one found in `native/daecpp/CMakeLists.txt`
(e.g. `C:\lib\install\daecpp\CMakeLists.txt`)
* Create a build subdirectory and navigate to it (e.g. `C:\lib\install\build`)
* Run this cmake command. For `$installDir` enter the destination directory
* `cmake .. -DCMAKE_INSTALL_PREFIX=$installDir`
* e.g. `cmake .. -DCMAKE_INSTALL_PREFIX=C:/lib/dae-cpp/`
* Add the environment variable `DAECPP_HOME` with value `$installDir` (e.g. `C:\lib\daecpp`)
### Use DAECPP
* To use this library the MKL variables need to be set first
* Open command line
* Include the variables
* Win `"%MKL_HOME%\bin\mklvars.bat" intel64`
* Linux `source $MKL_HOME/bin/mklvars.sh intel64`
* In generated code directory:
* create build dir
* In build dir:
* cmake ..
* cmake --build . --config release
\ No newline at end of file
cmake_minimum_required(VERSION 3.0)
project(dae-cpp)
enable_language(CXX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE)
endif(NOT CMAKE_BUILD_TYPE)
option(DAE_FORTRAN_STYLE "Matrices will be defined using FORTRAN style (one-based indexing of columns and rows)" OFF)
option(DAE_LONG_INT "Use long integer representation for huge systems (more than ~10^7 equations)" OFF)
option(DAE_SINGLE "Use single precision in the solver)" OFF)
option(DAE_TEST "Build automatic solver test" ON)
if(DAE_TEST)
unset(DAE_BUILD_EXAMPLES CACHE)
endif(DAE_TEST)
option(DAE_BUILD_EXAMPLES "Build all examples" ON)
#### Locate Intel MKL ####
if(DEFINED ENV{MKL_HOME})
message(STATUS "Found MKL_HOME environment variable...")
set(MKL_ROOT_DIR $ENV{MKL_HOME})
else(DEFINED ENV{MKL_HOME})
message(STATUS "MKL_HOME environment variable not found. Will use default MKL paths...")
if(WIN32)
set(MKL_ROOT_DIR "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl")
else(WIN32)
set(MKL_ROOT_DIR "/opt/intel/mkl")
endif(WIN32)
endif(DEFINED ENV{MKL_HOME})
set(DAE_MKL_DIR "${MKL_ROOT_DIR}" CACHE STRING "Path to Intel MKL root directory")
find_path(DAE_MKL_INCLUDE NAMES mkl.h HINTS ${MKL_ROOT_DIR}/include)
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64 bits
set(DAE_MKL_LIB "${DAE_MKL_DIR}/lib/intel64_win")
set(DAE_INTEL_LIB "${DAE_MKL_DIR}/../compiler/lib/intel64_win")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
# 32 bits
set(DAE_MKL_LIB "${DAE_MKL_DIR}/lib/ia32_win")
set(DAE_INTEL_LIB "${DAE_MKL_DIR}/../compiler/lib/ia32_win")
endif()
else(WIN32)
if(EXISTS ${DAE_MKL_DIR}/lib/intel64)
set(DAE_MKL_LIB "${DAE_MKL_DIR}/lib/intel64")
set(DAE_INTEL_LIB "${DAE_MKL_DIR}/../lib/intel64")
else(EXISTS ${DAE_MKL_DIR}/lib/intel64)
set(DAE_MKL_LIB "${DAE_MKL_DIR}/lib")
set(DAE_INTEL_LIB "${DAE_MKL_DIR}/../lib")
endif(EXISTS ${DAE_MKL_DIR}/lib/intel64)
endif(WIN32)
#### Locate Python if needed ####
option(PLOTTING "Use Python interface (matplotlib) for plotting" OFF)
if(PLOTTING)
find_package(PythonLibs)
if(PYTHONLIBS_FOUND)
set(PYTHON_INCLUDE ${PYTHON_INCLUDE_DIRS} CACHE STRING "Path to Python include file (Python.h) for plotting")
set(PYTHON_LIB ${PYTHON_LIBRARIES} CACHE STRING "Python library for plotting")
else(PYTHONLIBS_FOUND)
set(PYTHON_INCLUDE "" CACHE STRING "Path to Python include file (Python.h) for plotting")
set(PYTHON_LIB "" CACHE STRING "Python library for plotting")
endif(PYTHONLIBS_FOUND)
find_path(PYTHON_NUMPY_INCLUDE numpy/arrayobject.h PATHS
/usr/local/lib/python3.5/dist-packages/numpy/core/include
/usr/local/lib/python3.6/dist-packages/numpy/core/include
/usr/local/lib/python3.7/dist-packages/numpy/core/include
/usr/local/lib/python3.5/site-packages/numpy/core/include
/usr/local/lib/python3.6/site-packages/numpy/core/include
/usr/local/lib/python3.7/site-packages/numpy/core/include
${PYTHON_INCLUDE}/../Lib/site-packages/numpy/core/include
${PYTHON_LIB}/../Lib/site-packages/numpy/core/include
DOC "Path to Python numpy include file (numpy/arrayobject.h) for plotting")
include_directories(${PYTHON_INCLUDE} ${PYTHON_NUMPY_INCLUDE})
endif(PLOTTING)
#### Set compiler options ####
unset(CMAKE_CXX_FLAGS CACHE)
if(UNIX AND NOT APPLE)
message(STATUS "Unix (not Apple) OS detected...")
if(DAE_LONG_INT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DMKL_ILP64 -m64 -fopenmp -Wall -Wl,--no-as-needed")
else(DAE_LONG_INT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m64 -fopenmp -Wall -Wl,--no-as-needed")
endif(DAE_LONG_INT)
elseif(APPLE)
message(STATUS "Apple OS detected...")
if(DAE_LONG_INT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DMKL_ILP64 -m64 -fopenmp -Wall -Wl,-rpath,${DAE_MKL_LIB}")
else(DAE_LONG_INT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -m64 -fopenmp -Wall -Wl,-rpath,${DAE_MKL_LIB}")
endif(DAE_LONG_INT)
elseif(WIN32)
message(STATUS "Windows OS detected...")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp /EHsc")
else(UNIX AND NOT APPLE)
message(STATUS "Unknown OS detected... Cannot set up compiler options.")
endif(UNIX AND NOT APPLE)
#### Add include and library paths ####
configure_file(${PROJECT_SOURCE_DIR}/src/cmake_config.h.in ${PROJECT_SOURCE_DIR}/src/cmake_config.h)
set(EXT_INCLUDE "${PROJECT_SOURCE_DIR}/src/external")
include_directories(${DAE_MKL_INCLUDE} ${EXT_INCLUDE})
include_directories("${PROJECT_SOURCE_DIR}/src")
link_directories(${DAE_MKL_LIB})
link_directories(${DAE_INTEL_LIB})
add_subdirectory(src)
#### Build examples if needed ####
if(DAE_BUILD_EXAMPLES)
set(EXAMPLE_LIST "perovskite" "diffusion_2d" "robertson")
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64 bits
find_library(LIB_MKL_INTEL_LP64 mkl_intel_lp64.lib HINTS ${DAE_MKL_LIB})
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
# 32 bits
find_library(LIB_MKL_INTEL_LP64 mkl_intel_c.lib HINTS ${DAE_MKL_LIB})
endif()
find_library(LIB_MKL_THREAD mkl_intel_thread.lib HINTS ${DAE_MKL_LIB})
find_library(LIB_MKL_CORE mkl_core.lib HINTS ${DAE_MKL_LIB})
find_library(LIB_INTEL_OPENMP libiomp5md.lib HINTS ${DAE_INTEL_LIB})
set(LIB_PTHREAD "")
set(LIB_MATH "")
set(LIB_DL "")
else(WIN32)
if(DAE_LONG_INT)
unset(LIB_MKL_INTEL_LP64 CACHE)
find_library(LIB_MKL_INTEL_LP64 mkl_intel_ilp64 HINTS ${DAE_MKL_LIB})
else(DAE_LONG_INT)
find_library(LIB_MKL_INTEL_LP64 mkl_intel_lp64 HINTS ${DAE_MKL_LIB})
endif(DAE_LONG_INT)
find_library(LIB_MKL_THREAD mkl_intel_thread HINTS ${DAE_MKL_LIB})
find_library(LIB_MKL_CORE mkl_core HINTS ${DAE_MKL_LIB})
find_library(LIB_INTEL_OPENMP iomp5 HINTS ${DAE_INTEL_LIB})
find_library(LIB_PTHREAD pthread)
find_library(LIB_MATH m)
find_library(LIB_DL dl)
endif(WIN32)
foreach(EXAMPLE_NAME ${EXAMPLE_LIST})
FILE(GLOB SOURCES ${PROJECT_SOURCE_DIR}/examples/${EXAMPLE_NAME}/*.cpp)
add_executable(${EXAMPLE_NAME} ${SOURCES})
target_link_libraries(${EXAMPLE_NAME} daecpp_static)
target_link_libraries(${EXAMPLE_NAME} ${LIB_MKL_INTEL_LP64} ${LIB_MKL_THREAD} ${LIB_MKL_CORE} ${LIB_INTEL_OPENMP} ${LIB_PTHREAD} ${LIB_MATH} ${LIB_DL})
if(PLOTTING)
target_link_libraries(${EXAMPLE_NAME} ${PYTHON_LIB})
endif(PLOTTING)
install(TARGETS ${EXAMPLE_NAME} DESTINATION bin)
endforeach()
if(DAE_TEST)
include(CTest)
foreach(EXAMPLE_NAME ${EXAMPLE_LIST})
add_test(${EXAMPLE_NAME}_TEST ${EXAMPLE_NAME})
endforeach()
endif(DAE_TEST)
endif(DAE_BUILD_EXAMPLES)
......@@ -10,18 +10,18 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-generator</artifactId>
<version>0.4.1-SNAPSHOT</version>
<version>0.4.5</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. EMA-Libraries ................................................. -->
<Embedded-MontiArc-Math.version>0.2.13-SNAPSHOT</Embedded-MontiArc-Math.version>
<EmbeddedMontiArc-executionSemantics.version>0.4.4-SNAPSHOT</EmbeddedMontiArc-executionSemantics.version>
<!-- .. Libraries .................................................. -->
<guava.version>25.1-jre</guava.version>
<junit.version>4.12</junit.version>
<junit.version>4.13.1</junit.version>
<logback.version>1.1.2</logback.version>
<jscience.version>4.3.1</jscience.version>
......@@ -55,29 +55,21 @@
<!-- MontiCore Dependencies -->
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math</artifactId>
<version>${Embedded-MontiArc-Math.version}</version>
<artifactId>executionSemantics</artifactId>
<version>${EmbeddedMontiArc-executionSemantics.version}</version>
</dependency>
<!-- MontiSim Dependency for the DynamicInterface generation -->
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math</artifactId>
<version>${Embedded-MontiArc-Math.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>montiarc.verification</groupId>
<artifactId>montiarc-execution-order</artifactId>
<version>4.0.1-SNAPSHOT</version>
<groupId>montisim</groupId>
<artifactId>commons</artifactId>
<version>2.0.14</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
<version>2.3.29</version>
</dependency>
<dependency>
......
# Default Intel MKL library path
source $MKL_HOME/bin/mklvars.sh intel64
REM ==== 64 bit ====
"%MKL_HOME%\bin\mklvars.bat" intel64
REM ==== 32 bit ====
REM "%MKL_HOME%\bin\mklvars.bat" ia32
\ No newline at end of file
......@@ -6,7 +6,9 @@ import de.monticore.lang.monticar.generator.cpp.GeneralHelperMethods;
/**
*/
public class ExecuteInstruction implements Instruction {
protected String EXECUTE_COMMAND = "execute";
String componentName;
String targetComponentName;
EMAMBluePrint bluePrint;
String threadName = null;
boolean canBeThreaded = false;
......@@ -21,6 +23,7 @@ public class ExecuteInstruction implements Instruction {
componentName = componentName.replaceFirst("\\_", "]");
}
this.componentName = GeneralHelperMethods.getTargetLanguageVariableInstanceName(componentName);
// this.targetComponentName = GeneralHelperMethods.getTargetLanguageQualifiedComponentName(this.componentName);
if (canBeThreaded)
this.threadName = "thread" + ++threadCounter;
}
......@@ -29,18 +32,10 @@ public class ExecuteInstruction implements Instruction {
return componentName;
}
public void setComponentName(String componentName) {
this.componentName = componentName;
}
public boolean isCanBeThreaded() {
public boolean canBeThreaded() {
return canBeThreaded;
}
public void setCanBeThreaded(boolean canBeThreaded) {
this.canBeThreaded = canBeThreaded;
}
public String getThreadName() {
return threadName;
}
......@@ -53,7 +48,7 @@ public class ExecuteInstruction implements Instruction {
String inst = componentName.substring(0, componentName.indexOf("["));
String id = componentName.substring(componentName.indexOf("[")+1, componentName.lastIndexOf("]"));
return String.format("if(__%s_connected[%s]){ executeDynamicConnects(&(%s)); %s}", inst, id,componentName, exec);
return String.format("if(__%s_connected[%s]){ " + EXECUTE_COMMAND + "DynamicConnects(&(%s)); %s}", inst, id,componentName, exec);
}
return exec;
......@@ -69,13 +64,13 @@ public class ExecuteInstruction implements Instruction {
//++threadCounter;
//OLD: result += "this->" + componentName + ".execute();});\n";
result += addConditionIfDynamic("this->"+componentName+".execute();");
result += addConditionIfDynamic("this->"+componentName+ "." + EXECUTE_COMMAND + "();");
result += "});\n";
return result;
}
return addConditionIfDynamic(componentName + ".execute();")+"\n";
return addConditionIfDynamic(componentName + "." + EXECUTE_COMMAND + "();")+"\n";
}
@Override
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator;
import de.ma2cfg.helper.Names;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAComponentSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.symboltable.Scope;
import de.se_rwth.commons.logging.Log;
import org.apache.commons.lang3.StringUtils;
/**
*/
public class Helper {
public static MathStatementsSymbol getMathStatementsSymbolFor(EMAComponentInstanceSymbol instanceSymbol, Scope symtab) {
String resolveName = instanceSymbol.getPackageName() + "." + Names.FirstUpperCase(instanceSymbol.getName()) + ".MathStatements";
MathStatementsSymbol mathSymbol = symtab.<MathStatementsSymbol>resolve(resolveName, MathStatementsSymbol.KIND).orElse(null);
String resolveName = "MathStatements";
MathStatementsSymbol mathSymbol = instanceSymbol.getSpannedScope().<MathStatementsSymbol>resolve(resolveName, MathStatementsSymbol.KIND).orElse(null);
if (mathSymbol == null) {
resolveName = instanceSymbol.getPackageName() + "." + StringUtils.capitalize(instanceSymbol.getName()) + ".MathStatements";
mathSymbol = symtab.<MathStatementsSymbol>resolve(resolveName, MathStatementsSymbol.KIND).orElse(null);
}
if (mathSymbol == null && instanceSymbol.getComponentType() != null) {
EMAComponentSymbol symbol = instanceSymbol.getComponentType().getReferencedSymbol();
resolveName = symbol.getPackageName() + "." + symbol.getName() + ".MathStatements";
mathSymbol = symtab.<MathStatementsSymbol>resolve(resolveName, MathStatementsSymbol.KIND).orElse(null);
......
......@@ -10,8 +10,12 @@ import de.monticore.lang.math._symboltable.matrix.MathMatrixVectorExpressionSymb
public interface MathBackend {
String getMatrixTypeName();
String getMatrixTypeUnsignedCharName();
String getCubeTypeName();
String getCubeUnsignedCharName();
String getMatrixInitString(int sizeN, int sizeM);
String getRowVectorTypeName();
......
......@@ -85,6 +85,10 @@ public class Method {
instructions.add(instruction);
}
public void addInstructions(List<Instruction> instructions) {
this.instructions.addAll(instructions);
}
public void setInstructions(List<Instruction> instructions) {
this.instructions = instructions;
}
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator;
public class OutputInstruction extends ExecuteInstruction {
public OutputInstruction(String componentName, EMAMBluePrint bluePrint, boolean canBeThreaded) {
super(componentName, bluePrint, canBeThreaded);
EXECUTE_COMMAND = "output";
}
public OutputInstruction(ExecuteInstruction executeInstruction) {
this(executeInstruction.componentName, executeInstruction.bluePrint, executeInstruction.canBeThreaded);
}
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator;
public class UpdateInstruction extends ExecuteInstruction {
public UpdateInstruction(String componentName, EMAMBluePrint bluePrint, boolean canBeThreaded) {
super(componentName, bluePrint, canBeThreaded);
EXECUTE_COMMAND = "update";
}
public UpdateInstruction(ExecuteInstruction executeInstruction) {
this(executeInstruction.componentName, executeInstruction.bluePrint, executeInstruction.canBeThreaded);
}
}
......@@ -17,10 +17,13 @@ import java.util.Optional;
public class Variable {
public static final String INCOMING = "Incoming";
public static final String OUTGOING = "outgoing";
public static final String COMPONENT = "component";
public static String FORLOOPINFO = "ForLoopVariable";
public static String VARIABLE = "Variable";
public static String ORIGINPORT = "OriginPort";
public static String STATIC = "Static";
public static String FROMMATH = "fromMath";
public static String CROSSCOMPONENT = "CrossComponent";
String name = "";
VariableType type = new VariableType();
......@@ -194,11 +197,14 @@ public class Variable {
}
public boolean isCrossComponentVariable() {
return name.contains(".");
return additionalInformation.contains(CROSSCOMPONENT);
}
public String getComponentName() {
return name.split("\\.")[0];
String[] split = name.split("\\.");
if (split.length >= 2)
return split[split.length - 2];
return "";
}
public void addDimensionalInformation(String dimension) {
......
......@@ -12,17 +12,13 @@ import freemarker.template.TemplateExceptionHandler;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* Class to configure cmake file generation.
* Is responsible for generating the cmake files from freemarker templates.
* CMake dependencies to other modules can be added as Find Package file.
* See also https://cmake.org/cmake/help/v3.8/command/find_package.html?highlight=i
*
*/
public class CMakeConfig {
......@@ -35,6 +31,8 @@ public class CMakeConfig {
conf.setTemplateExceptionHandler(TemplateExceptionHandler.DEBUG_HANDLER);
conf.setLogTemplateExceptions(false);
conf.setClassForTemplateLoading(AllTemplates.class, "/template/cmake/");
conf.setNumberFormat("#.################");
conf.setLocale(Locale.ENGLISH);
try {
CMAKE_LISTS_CPP = conf.getTemplate("CMakeListsCppTemplate.ftl");
CMAKE_FIND_PACKAGE = conf.getTemplate("CMakeFindPackageTemplate.ftl");
......@@ -55,17 +53,18 @@ public class CMakeConfig {
private List<String> cmakeCommandListEnd = new ArrayList<>();
private List<String> cmakeLibraryLinkage = new ArrayList<>();
private List<String> cmakeLibraryLinkageList = new ArrayList<>();
// constructor
public CMakeConfig(String compName) {
cMakeListsViewModel.setCompName(compName);
cMakeListsViewModel.setModuleDependencies(moduleList);
configureCMakeListsViewModel();
}
// methods
protected void configureCMakeListsViewModel() {
cMakeListsViewModel.setCmakeLibraryLinkageList(cmakeLibraryLinkage);
cMakeListsViewModel.setCmakeLibraryLinkageList(cmakeLibraryLinkageList);
cMakeListsViewModel.setCmakeCommandList(cmakeCommandList);
cMakeListsViewModel.setCmakeCommandListEnd(cmakeCommandListEnd);
}
......@@ -87,7 +86,7 @@ public class CMakeConfig {
FileContent result = new FileContent();
String compName = cMakeListsViewModel.getCompName().replace(".", "_");
result.setFileName(compName + ".cpp");
result.setFileContent("#include \""+ compName +".h\"");
result.setFileContent("#include \"" + compName + ".h\"");
return result;
}
......@@ -108,7 +107,7 @@ public class CMakeConfig {
public FileContent generateCMakeLists() {
FileContent result = null;
configureCMakeListsViewModel();
//configureCMakeListsViewModel();
// map data
Map<String, Object> dataForTemplate = TemplateHelper.getDataForTemplate(cMakeListsViewModel);
// try generate file content
......@@ -123,7 +122,8 @@ public class CMakeConfig {
}
public void addModuleDependency(CMakeFindModule module) {
moduleList.add(module);
if (!moduleList.contains(module))
moduleList.add(module);
}
public CMakeListsCPPViewModel getCMakeListsViewModel() {
......@@ -136,7 +136,8 @@ public class CMakeConfig {
* @param cmd some valid cmake command as string
*/
public void addCMakeCommand(String cmd) {
cmakeCommandList.add(cmd);
if (!cmakeCommandList.contains(cmd))
cmakeCommandList.add(cmd);
}