CMakeSourceListGenerator.cpp
Go to the documentation of this file.
2 
3 namespace armarx
4 {
5 
7  {
8 
9  }
10 
11  std::string CMakeSourceListGenerator::GenerateCMakeFile(const std::string& groupName, const std::vector<std::string>& stateXMLFiles, const std::vector<std::string>& stateSourceFiles, const std::vector<std::string>& stateHeaderFiles, const std::vector<std::string>& libs)
12  {
13 
14  CMakeWriter writer;
15  writer.line("SET(HEADERS ${HEADERS}");
16  for (auto& file : stateXMLFiles)
17  {
18  writer.line(file, 1);
19  }
20  writer.line(")", 1);
21  writer.line();
22  writer.line("SET(HEADERS ${HEADERS}");
23  for (auto& file : stateHeaderFiles)
24  {
25  writer.line(file, 1);
26  }
27  writer.line(")", 1);
28  writer.line();
29  writer.line("SET(SOURCES ${SOURCES}");
30  for (auto& file : stateSourceFiles)
31  {
32  writer.line(file, 1);
33  }
34  writer.line(")", 1);
35 
36  writer.line();
37  writer.line("SET(COMPONENT_LIBS ${COMPONENT_LIBS}");
38  for (auto& file : libs)
39  {
40  writer.line(file, 1);
41  }
42  writer.line(")", 1);
43 
44 
45  return writer.getString();
46  }
47 
48  std::string CMakeSourceListGenerator::GenerateCMakeFileNextGen(const std::string& groupName, const std::vector<std::string>& stateXMLFiles, const std::vector<std::string>& stateSourceFiles, const std::vector<std::string>& stateHeaderFiles, const std::vector<std::string>& libs)
49  {
50  CMakeWriter writer;
51 
52  writer.line("armarx_add_statechart_library(" + groupName + "_statechart");
53 
54  // headers
55  if(not stateHeaderFiles.empty())
56  {
57  writer.line("HEADERS", 1);
58  //writer.line("# autogenerated headers", 2);
59  for (const auto& file : stateHeaderFiles)
60  {
61  writer.line(file, 2);
62  }
63  }
64 
65  writer.line("STATE_FILES", 1);
66  for (const auto& file : stateXMLFiles)
67  {
68  writer.line(file, 2);
69  }
70 
71  // sources
72  if(not stateSourceFiles.empty())
73  {
74  writer.line("SOURCES", 1);
75  for (const auto& file : stateSourceFiles)
76  {
77  writer.line(file, 2);
78  }
79  }
80 
81  // dependencies
82  writer.line("DEPENDENCIES", 1);
83  for (const auto& file : libs)
84  {
85  writer.line(file, 2);
86  }
87 
88  // if no statechart cpp files are added, generate an interface library with the dependencies attached
89  if(stateSourceFiles.empty())
90  {
91  writer.line("INTERFACE", 1);
92  }
93  // if statechart cpp files are available, generate an object library with the dependencies within the public scope
94  else
95  {
96  writer.line("OBJECT", 1);
97  }
98  writer.line(")", 0);
99 
100  return writer.getString();
101 
102  }
103 
104 } // namespace armarx
armarx::CMakeSourceListGenerator::CMakeSourceListGenerator
CMakeSourceListGenerator()
Definition: CMakeSourceListGenerator.cpp:6
armarx::CMakeWriter::getString
std::string getString()
Definition: CMakeWriter.cpp:52
armarx::CMakeSourceListGenerator::GenerateCMakeFileNextGen
static std::string GenerateCMakeFileNextGen(const std::string &groupName, const std::vector< std::string > &stateXMLFiles, std::vector< std::string > const &stateSourceFiles, std::vector< std::string > const &stateHeaderFiles, const std::vector< std::string > &libs)
Definition: CMakeSourceListGenerator.cpp:48
armarx::CMakeWriter
Definition: CMakeWriter.h:12
armarx::CMakeWriter::line
void line()
Definition: CMakeWriter.cpp:37
armarx::CMakeSourceListGenerator::GenerateCMakeFile
static std::string GenerateCMakeFile(const std::string &groupName, const std::vector< std::string > &stateXMLFiles, std::vector< std::string > const &stateSourceFiles, std::vector< std::string > const &stateHeaderFiles, const std::vector< std::string > &libs)
Definition: CMakeSourceListGenerator.cpp:11
CMakeSourceListGenerator.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28