Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
WareSrcContainer.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
5
6
7 == GNU General Public License Usage ==
8
9 OpenFLUID is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OpenFLUID is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21
22
23 == Other Usage ==
24
25 Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26 license, and requires a written agreement between You and INRA.
27 Licensees for Other Usage of OpenFLUID may use this file in accordance
28 with the terms contained in the written agreement between You and INRA.
29
30 */
31
32
33/**
34 @file WareSrcContainer.hpp
35
36 @author Aline LIBRES <aline.libres@gmail.com>
37 @author Jean-Christophe Fabre <jean-christophe.fabre@inrae.fr>
38 */
39
40
41#ifndef __OPENFLUID_WARESDEV_WARESRCCONTAINER_HPP__
42#define __OPENFLUID_WARESDEV_WARESRCCONTAINER_HPP__
43
44
45#include <openfluid/ware/TypeDefs.hpp>
47
48
49// TODO review relevance of attributes and methods of WareSrcContainer
50
51
52namespace openfluid { namespace waresdev {
53
54
56{
57
58 public:
59
60 enum class ConfigMode
61 {
62 CONFIG_DEBUG, CONFIG_RELEASE
63 };
64
65 enum class BuildMode
66 {
67 BUILD_WITHINSTALL, BUILD_NOINSTALL
68 };
69
70
71 protected:
72
73 std::string m_AbsolutePath;
74
76
78
79 /**
80 Absolute path of the main .cpp as set in the CMake config file, if this .cpp file exists,
81 otherwise an empty string
82 */
84
85 /**
86 Absolute path of the ui-parameterization .cpp as set in the CMake config file, if this .cpp file exists,
87 otherwise an empty string
88 */
90
91 /**
92 Absolute path of the CMake config file if it exists, otherwise an empty string
93 */
95
96 /**
97 Absolute path of the openfluid-ware.json file if it exists, otherwise an empty string
98 */
99 std::string m_AbsoluteJsonPath;
100
101
103
105
106 unsigned int m_BuildJobs;
107
108 std::string m_BuildDirPath;
109
110 std::string m_OFVersion;
111
112 /**
113 @throw openfluid::base::FrameworkException
114 */
115 void findCMake();
116
117
118 public:
119
120 WareSrcContainer(const std::string& AbsolutePath, openfluid::ware::WareType Type, const std::string& WareID);
121
123
124 void update();
125
126 std::string getAbsolutePath() const
127 {
128 return m_AbsolutePath;
129 }
130
132 {
133 return m_Type;
134 }
135
137 {
138 return m_ID;
139 }
140
141 std::string searchMainCppFileName(const std::string& CMakeConfigContent);
142
143 /**
144 Return the absolute paths of:
145 - the CMake config file if it exists on disk,
146 - the main .cpp file as set in the CMakeLists.txt, if this .cpp exists on disk.
147 If no .cpp file was found (because it doesn't exists, it wasn't found in CMake file,
148 or CMake file doesn't exist):
149 - the first .cpp file found in this ware directory (not recursive).
150 @return a list of existing absolute paths into this ware directory. It can be empty.
151 */
152 std::vector<std::string> getDefaultFilesPaths();
153
154 std::string getBuildDirPath() const;
155
156 /**
157 Returns the absolute path of the main .cpp as set in the CMake config file, if this .cpp file exists,
158 otherwise an empty string
159 */
160 std::string getMainCppPath() const;
161
162 /**
163 Returns the absolute path of the ui-parameterization .cpp as set in the CMake config file,
164 if this .cpp file exists, otherwise an empty string
165 */
166 std::string getUiParamCppPath() const;
167
168 /**
169 Returns the absolute path of the CMakeLists.txt file, if this file exists,
170 otherwise an empty string
171 */
172 std::string getCMakeListsPath() const;
173
174 /**
175 Returns the absolute path of the openfluid-ware.json file, if this file exists,
176 otherwise an empty string
177 */
178 std::string getJsonPath() const;
179
180 std::map<std::string,std::string> getConfigureVariables() const;
181
182 std::string getConfigureGenerator() const;
183
184 std::string getConfigureExtraOptions() const;
185
186 std::string getBuildTarget() const;
187
188 std::string getGenerateDocTarget() const;
189
190 unsigned int getBuildJobs() const;
191
193
195
197
198 void setBuildJobs(unsigned int Jobs);
199
200};
201
202
203} } // namespaces
204
205
206#endif /* __OPENFLUID_WARESDEV_WARESRCCONTAINER_HPP__ */
Definition WareSrcContainer.hpp:56
std::string searchMainCppFileName(const std::string &CMakeConfigContent)
std::string m_AbsoluteUiParamCppPath
Definition WareSrcContainer.hpp:89
std::string getConfigureExtraOptions() const
std::string m_AbsolutePath
Definition WareSrcContainer.hpp:73
std::string getConfigureGenerator() const
WareSrcContainer(const std::string &AbsolutePath, openfluid::ware::WareType Type, const std::string &WareID)
unsigned int m_BuildJobs
Definition WareSrcContainer.hpp:106
BuildMode m_BuildMode
Definition WareSrcContainer.hpp:104
BuildMode
Definition WareSrcContainer.hpp:66
std::string m_OFVersion
Definition WareSrcContainer.hpp:110
void setConfigMode(ConfigMode Mode)
std::string m_AbsoluteMainCppPath
Definition WareSrcContainer.hpp:83
std::map< std::string, std::string > getConfigureVariables() const
ConfigMode
Definition WareSrcContainer.hpp:61
std::vector< std::string > getDefaultFilesPaths()
openfluid::ware::WareID_t getID() const
Definition WareSrcContainer.hpp:136
std::string m_BuildDirPath
Definition WareSrcContainer.hpp:108
void setBuildJobs(unsigned int Jobs)
std::string getAbsolutePath() const
Definition WareSrcContainer.hpp:126
std::string m_AbsoluteJsonPath
Definition WareSrcContainer.hpp:99
ConfigMode m_ConfigMode
Definition WareSrcContainer.hpp:102
openfluid::ware::WareType m_Type
Definition WareSrcContainer.hpp:75
std::string m_AbsoluteCMakeMainPath
Definition WareSrcContainer.hpp:94
openfluid::ware::WareType getType() const
Definition WareSrcContainer.hpp:131
openfluid::ware::WareID_t m_ID
Definition WareSrcContainer.hpp:77
std::string getGenerateDocTarget() const
#define OPENFLUID_API
Definition dllexport.hpp:86
WareType
Definition TypeDefs.hpp:61
std::string WareID_t
Definition TypeDefs.hpp:49
Definition ApplicationException.hpp:47