Commit a92b298e authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Revert "Merge branch 'OpenCV' into 'master'"

This reverts merge request !44
parent 6ad1bed8
Pipeline #357967 passed with stage
in 11 minutes and 6 seconds
......@@ -22,6 +22,7 @@ import java.util.Map;
* 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 {
......@@ -54,7 +55,7 @@ public class CMakeConfig {
private List<String> cmakeCommandListEnd = new ArrayList<>();
private List<String> cmakeLibraryLinkageList = new ArrayList<>();
private List<String> cmakeLibraryLinkage = new ArrayList<>();
// constructor
public CMakeConfig(String compName) {
......@@ -64,7 +65,7 @@ public class CMakeConfig {
// methods
protected void configureCMakeListsViewModel() {
cMakeListsViewModel.setCmakeLibraryLinkageList(cmakeLibraryLinkageList);
cMakeListsViewModel.setCmakeLibraryLinkageList(cmakeLibraryLinkage);
cMakeListsViewModel.setCmakeCommandList(cmakeCommandList);
cMakeListsViewModel.setCmakeCommandListEnd(cmakeCommandListEnd);
}
......@@ -86,7 +87,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;
}
......@@ -122,8 +123,7 @@ public class CMakeConfig {
}
public void addModuleDependency(CMakeFindModule module) {
if (!moduleList.contains(module))
moduleList.add(module);
moduleList.add(module);
}
public CMakeListsCPPViewModel getCMakeListsViewModel() {
......@@ -136,8 +136,7 @@ public class CMakeConfig {
* @param cmd some valid cmake command as string
*/
public void addCMakeCommand(String cmd) {
if (!cmakeCommandList.contains(cmd))
cmakeCommandList.add(cmd);
cmakeCommandList.add(cmd);
}
/**
......@@ -146,15 +145,11 @@ public class CMakeConfig {
* @param cmd some valid cmake command as string
*/
public void addCMakeCommandEnd(String cmd) {
if (!cmakeCommandListEnd.contains(cmd))
cmakeCommandListEnd.add(cmd);
cmakeCommandListEnd.add(cmd);
}
public void addCmakeLibraryLinkage(String cmakeLibraryLinkage) {
if (!cmakeLibraryLinkageList.contains(cmakeLibraryLinkage))
this.cmakeLibraryLinkageList.add(cmakeLibraryLinkage);
this.cmakeLibraryLinkage.add(cmakeLibraryLinkage);
}
}
......@@ -5,7 +5,6 @@ import de.monticore.lang.monticar.generator.cpp.viewmodel.ViewModelBase;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Representation of CMake Find files as Java class.
......@@ -23,7 +22,6 @@ public class CMakeFindModule extends ViewModelBase {
private Boolean findPath;
private Boolean findLibrary;
private Boolean fortranQuadMath = false;
private Boolean findAsPackage = false;
private boolean required;
......@@ -52,15 +50,6 @@ public class CMakeFindModule extends ViewModelBase {
// methods
public CMakeFindModule asFindAsPackage() {
this.findLibrary = false;
this.findPath = false;
this.findAsPackage = true;
return this;
}
// getters and setters
public String getPackageName() {
return packageName;
}
......@@ -137,35 +126,4 @@ public class CMakeFindModule extends ViewModelBase {
this.fortranQuadMath = fortranQuadMath;
}
public Boolean getFindAsPackage() {
return findAsPackage;
}
public void setFindAsPackage(Boolean findAsPackage) {
this.findAsPackage = findAsPackage;
}
// equals and hashcode
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof CMakeFindModule)) return false;
CMakeFindModule that = (CMakeFindModule) o;
return isRequired() == that.isRequired() &&
Objects.equals(getPackageName(), that.getPackageName()) &&
Objects.equals(getIncludeName(), that.getIncludeName()) &&
Objects.equals(getLibName(), that.getLibName()) &&
Objects.equals(getIncludePaths(), that.getIncludePaths()) &&
Objects.equals(getLibPaths(), that.getLibPaths()) &&
Objects.equals(getFindPath(), that.getFindPath()) &&
Objects.equals(getFindLibrary(), that.getFindLibrary()) &&
Objects.equals(getFortranQuadMath(), that.getFortranQuadMath()) &&
Objects.equals(getFindAsPackage(), that.getFindAsPackage());
}
@Override
public int hashCode() {
return Objects.hash(getPackageName(), getIncludeName(), getLibName(), getIncludePaths(), getLibPaths(), getFindPath(), getFindLibrary(), getFortranQuadMath(), getFindAsPackage(), isRequired());
}
}
......@@ -5,7 +5,6 @@ import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.EMAMBluePrint;
import de.monticore.lang.monticar.generator.MathCommand;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.converter.ComponentConverter;
......@@ -65,8 +64,6 @@ public class BoundingRectCommand extends MathCommand{
mathMatrixNameExpressionSymbol.getMathMatrixAccessOperatorSymbol().setMathMatrixAccessSymbols(newMatrixAccessSymbols);
bluePrintCPP.addCVIncludeString("opencv2/imgproc/imgproc");
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
}
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathExpressionProperties;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
......@@ -67,8 +66,6 @@ public class CvtColorCommand extends ArgumentNoReturnMathCommand{
bluePrint.addMethod(cvtColorHelperMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
......
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathExpressionProperties;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
......@@ -67,8 +66,7 @@ public class DilateCommand extends ArgumentNoReturnMathCommand{
bluePrint.addMethod(dilateHelperMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
private Method getDilateHelperMethod(MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol, EMAMBluePrintCPP bluePrintCPP, MathExpressionProperties properties){
......
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathExpressionProperties;
import de.monticore.lang.monticar.generator.cpp.converter.ComponentConverter;
......@@ -69,8 +68,6 @@ public class ErodeCommand extends ArgumentNoReturnMathCommand{
bluePrint.addMethod(erodeHelperMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
......
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathExpressionProperties;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
......@@ -68,8 +67,6 @@ public class FindContoursCommand extends ArgumentNoReturnMathCommand{
bluePrint.addMethod(findContoursHelperMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
......
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathExpressionProperties;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
......@@ -67,8 +66,6 @@ public class GaussianBlurCommand extends ArgumentNoReturnMathCommand{
bluePrint.addMethod(gaussianBlurHelperMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
private Method getGaussianBlurHelperMethod(MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol, EMAMBluePrintCPP bluePrintCPP, MathExpressionProperties properties){
......
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathExpressionProperties;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
......@@ -67,8 +66,6 @@ public class InRangeCommand extends ArgumentNoReturnMathCommand{
bluePrint.addMethod(inRangeHelperMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
......
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.converter.ExecuteMethodGenerator;
......@@ -66,8 +65,6 @@ public class LargestContourCommand extends MathCommand {
bluePrint.addMethod(largestContourMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
......
......@@ -4,7 +4,6 @@ import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.EMAMBluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathExpressionProperties;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
......@@ -71,8 +70,6 @@ public class RectangleCommand extends MathCommand{
bluePrint.addMethod(rectangleHelperMethod);
redefineArmaMat(bluePrintCPP);
redefineInit(bluePrintCPP);
bluePrintCPP.getGenerator().getCmakeConfig()
.addModuleDependency(new CMakeFindModule("OpenCV", true).asFindAsPackage());
}
......
......@@ -22,7 +22,7 @@ find_path(${viewModel.packageName}_INCLUDE_DIR
<#if viewModel.findLibrary>
find_library(${viewModel.packageName}_LIBRARY
NAMES ${viewModel.libName}
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release" "x64" "x86"
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
<#list viewModel.libPaths as var>
"${var}"
......@@ -33,33 +33,17 @@ find_library(${viewModel.packageName}_LIBRARY
include(FindPackageHandleStandardArgs)
# if all listed variables are TRUE
<#if viewModel.findAsPackage>
find_package(${viewModel.packageName}
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release" "x64" "x86"
HINTS $ENV{${viewModel.packageName}_HOME}
REQUIRED
)
<#else>
find_package_handle_standard_args(
${viewModel.packageName}
DEFAULT_MSG
<#if viewModel.findPath>${viewModel.packageName}_INCLUDE_DIR</#if>
<#if viewModel.findLibrary>${viewModel.packageName}_LIBRARY</#if>
)
</#if>
mark_as_advanced(
<#if viewModel.findPath || viewModel.findAsPackage>${viewModel.packageName}_INCLUDE_DIR</#if>
<#if viewModel.findLibrary>
${viewModel.packageName}_LIBRARY
<#elseif viewModel.findAsPackage>
${viewModel.packageName}_LIBS
</#if>
<#if viewModel.findPath>${viewModel.packageName}_INCLUDE_DIR</#if>
<#if viewModel.findLibrary>${viewModel.packageName}_LIBRARY</#if>
)
<#if viewModel.findPath || viewModel.findAsPackage>set(${viewModel.packageName}_INCLUDE_DIRS ${r"${"}${viewModel.packageName}${r"_INCLUDE_DIR}"})</#if>
<#if viewModel.findLibrary>
set(${viewModel.packageName}_LIBRARIES ${r"${"}${viewModel.packageName}${r"_LIBRARY}"})
<#elseif viewModel.findAsPackage>
set(${viewModel.packageName}_LIBRARIES ${r"${"}${viewModel.packageName}${r"_LIBS}"})
</#if>
<#if viewModel.findPath>set(${viewModel.packageName}_INCLUDE_DIRS ${r"${"}${viewModel.packageName}${r"_INCLUDE_DIR}"})</#if>
<#if viewModel.findLibrary>set(${viewModel.packageName}_LIBRARIES ${r"${"}${viewModel.packageName}${r"_LIBRARY}"})</#if>
......@@ -10,14 +10,14 @@ set(CMAKE_MODULE_PATH ${r"${CMAKE_MODULE_PATH}"} ${r"${CMAKE_CURRENT_SOURCE_DIR}
# add dependencies
<#list viewModel.moduleDependencies as var>
find_package(${var.packageName} <#if var.required>REQUIRED<#else></#if>)
<#if var.findPath || var.findAsPackage>set(INCLUDE_DIRS ${r"${INCLUDE_DIRS}"} ${r"${"}${var.packageName}${r"_INCLUDE_DIRS}"})</#if>
<#if var.findLibrary || var.findAsPackage>set(LIBS ${r"${LIBS}"} ${r"${"}${var.packageName}${r"_LIBRARIES}"})</#if>
<#if var.findPath>set(INCLUDE_DIRS ${r"${INCLUDE_DIRS}"} ${r"${"}${var.packageName}${r"_INCLUDE_DIRS}"})</#if>
<#if var.findLibrary>set(LIBS ${r"${LIBS}"} ${r"${"}${var.packageName}${r"_LIBRARIES}"})</#if>
<#if var.fortranQuadMath>set(LIBS ${r"${LIBS}"} "quadmath")</#if>
</#list>
# additional library linkage
<#list viewModel.cmakeLibraryLinkageList as lib>
set(LIBS ${r"${LIBS}"} ${lib})
<#list viewModel.cmakeLibraryLinkageList as cmd>
set(LIBS ${r"${LIBS}"} ${cmd})
</#list>
# additional commands
......
......@@ -16,7 +16,7 @@ find_path(Armadillo_INCLUDE_DIR
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release" "x64" "x86"
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
......
......@@ -16,7 +16,7 @@ find_path(Armadillo_INCLUDE_DIR
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release" "x64" "x86"
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
......
......@@ -16,7 +16,7 @@ find_path(Armadillo_INCLUDE_DIR
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release" "x64" "x86"
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
......
......@@ -16,7 +16,7 @@ find_path(Armadillo_INCLUDE_DIR
)
find_library(Armadillo_LIBRARY
NAMES armadillo
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release" "x64" "x86"
PATH_SUFFIXES "lib" "lib64" "lib/x86_64-linux-gnu" "examples/lib_win64" "build" "Release"
PATHS
HINTS $ENV{Armadillo_HOME}
)
......
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