Commit b2533396 authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

CMake: Updates for msbuild: genereate {component.name}.cpp, use C++ 14,

parent c268d60a
Pipeline #95971 passed with stages
in 35 minutes and 16 seconds
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-generator</artifactId> <artifactId>embedded-montiarc-math-generator</artifactId>
<version>0.1.3-SNAPSHOT</version> <version>0.1.4-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= --> <!-- == PROJECT DEPENDENCIES ============================================= -->
......
...@@ -91,6 +91,8 @@ public class CMakeConfig { ...@@ -91,6 +91,8 @@ public class CMakeConfig {
List<FileContent> files = new ArrayList<FileContent>(); List<FileContent> files = new ArrayList<FileContent>();
// generate CMakeLists.txt // generate CMakeLists.txt
files.add(generateCMakeLists()); files.add(generateCMakeLists());
// generate ${component.name}.cpp
files.add(generateComponentCpp());
// generate FindModule.cmake's // generate FindModule.cmake's
for (CMakeFindModule module : moduleList) { for (CMakeFindModule module : moduleList) {
files.add(generateCMakeFindPackage(module)); files.add(generateCMakeFindPackage(module));
...@@ -98,6 +100,14 @@ public class CMakeConfig { ...@@ -98,6 +100,14 @@ public class CMakeConfig {
return files; return files;
} }
private FileContent generateComponentCpp() {
FileContent result = new FileContent();
String compName = cMakeListsViewModel.getCompName().replace(".", "_");
result.setFileName(compName + ".cpp");
result.setFileContent("#include \""+ compName +".h\"");
return result;
}
private FileContent generateCMakeFindPackage(CMakeFindModule module) { private FileContent generateCMakeFindPackage(CMakeFindModule module) {
FileContent result = null; FileContent result = null;
// map data // map data
......
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 14)
project(${viewModel.compName} LANGUAGES CXX) project(${viewModel.compName} LANGUAGES CXX)
...@@ -20,7 +20,7 @@ ${cmd} ...@@ -20,7 +20,7 @@ ${cmd}
# create static library # create static library
include_directories(${r"${INCLUDE_DIRS}"}) include_directories(${r"${INCLUDE_DIRS}"})
add_library(${viewModel.compName} ${viewModel.compName}.h) add_library(${viewModel.compName} ${viewModel.compName}.cpp)
target_include_directories(${viewModel.compName} PUBLIC ${r"${CMAKE_CURRENT_SOURCE_DIR}"} ${r"${INCLUDE_DIRS}"}) target_include_directories(${viewModel.compName} PUBLIC ${r"${CMAKE_CURRENT_SOURCE_DIR}"} ${r"${INCLUDE_DIRS}"})
target_link_libraries(${viewModel.compName} PUBLIC ${r"${LIBS}"}) target_link_libraries(${viewModel.compName} PUBLIC ${r"${LIBS}"})
set_target_properties(${viewModel.compName} PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(${viewModel.compName} PROPERTIES LINKER_LANGUAGE CXX)
......
...@@ -100,7 +100,7 @@ public class GenerateCMakeTest extends AbstractSymtabTest { ...@@ -100,7 +100,7 @@ public class GenerateCMakeTest extends AbstractSymtabTest {
for (File f : files) { for (File f : files) {
if (f.getName().startsWith("Find")) if (f.getName().startsWith("Find"))
findFiles.add(f); findFiles.add(f);
else if (f.getName().endsWith(".hpp") || f.getName().endsWith(".cpp")) else if (f.getName().endsWith(".hpp") || f.getName().endsWith("tests_main.cpp"))
testFiles.add(f); testFiles.add(f);
else if (f.toPath().getParent().endsWith("reporting")) { else if (f.toPath().getParent().endsWith("reporting")) {
//don't care about reporting files //don't care about reporting files
......
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 14)
project(test_basicConstantAssignment LANGUAGES CXX) project(test_basicConstantAssignment LANGUAGES CXX)
...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES}) ...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library # create static library
include_directories(${INCLUDE_DIRS}) include_directories(${INCLUDE_DIRS})
add_library(test_basicConstantAssignment test_basicConstantAssignment.h) add_library(test_basicConstantAssignment test_basicConstantAssignment.cpp)
target_include_directories(test_basicConstantAssignment PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS}) target_include_directories(test_basicConstantAssignment PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(test_basicConstantAssignment PUBLIC ${LIBS}) target_link_libraries(test_basicConstantAssignment PUBLIC ${LIBS})
set_target_properties(test_basicConstantAssignment PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(test_basicConstantAssignment PROPERTIES LINKER_LANGUAGE CXX)
......
#include "test_basicConstantAssignment.h"
\ No newline at end of file
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 14)
project(test_basicPortsMath LANGUAGES CXX) project(test_basicPortsMath LANGUAGES CXX)
...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES}) ...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library # create static library
include_directories(${INCLUDE_DIRS}) include_directories(${INCLUDE_DIRS})
add_library(test_basicPortsMath test_basicPortsMath.h) add_library(test_basicPortsMath test_basicPortsMath.cpp)
target_include_directories(test_basicPortsMath PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS}) target_include_directories(test_basicPortsMath PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(test_basicPortsMath PUBLIC ${LIBS}) target_link_libraries(test_basicPortsMath PUBLIC ${LIBS})
set_target_properties(test_basicPortsMath PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(test_basicPortsMath PROPERTIES LINKER_LANGUAGE CXX)
......
#include "test_basicPortsMath.h"
\ No newline at end of file
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 14)
project(test_math_floatDivisionTest LANGUAGES CXX) project(test_math_floatDivisionTest LANGUAGES CXX)
...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES}) ...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library # create static library
include_directories(${INCLUDE_DIRS}) include_directories(${INCLUDE_DIRS})
add_library(test_math_floatDivisionTest test_math_floatDivisionTest.h) add_library(test_math_floatDivisionTest test_math_floatDivisionTest.cpp)
target_include_directories(test_math_floatDivisionTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS}) target_include_directories(test_math_floatDivisionTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(test_math_floatDivisionTest PUBLIC ${LIBS}) target_link_libraries(test_math_floatDivisionTest PUBLIC ${LIBS})
set_target_properties(test_math_floatDivisionTest PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(test_math_floatDivisionTest PROPERTIES LINKER_LANGUAGE CXX)
......
#include "test_math_floatDivisionTest.h"
\ No newline at end of file
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 14)
project(testing_model LANGUAGES CXX) project(testing_model LANGUAGES CXX)
...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES}) ...@@ -15,7 +15,7 @@ set(LIBS ${LIBS} ${Armadillo_LIBRARIES})
# create static library # create static library
include_directories(${INCLUDE_DIRS}) include_directories(${INCLUDE_DIRS})
add_library(testing_model testing_model.h) add_library(testing_model testing_model.cpp)
target_include_directories(testing_model PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS}) target_include_directories(testing_model PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIRS})
target_link_libraries(testing_model PUBLIC ${LIBS}) target_link_libraries(testing_model PUBLIC ${LIBS})
set_target_properties(testing_model PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(testing_model PROPERTIES LINKER_LANGUAGE CXX)
......
#include "testing_model.h"
\ 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