GMatTensor 0.10.6
Loading...
Searching...
No Matches
version.h
Go to the documentation of this file.
1
7#ifndef GMATTENSOR_VERSION_H
8#define GMATTENSOR_VERSION_H
9
10#include "config.h"
11
32#ifndef GMATTENSOR_VERSION
33#define GMATTENSOR_VERSION "@PROJECT_VERSION@"
34#endif
35
36namespace GMatTensor {
37
38namespace detail {
39
40inline std::string unquote(const std::string& arg)
41{
42 std::string ret = arg;
43 ret.erase(std::remove(ret.begin(), ret.end(), '\"'), ret.end());
44 return ret;
45}
46
47inline std::string replace(std::string str, const std::string& from, const std::string& to)
48{
49 size_t start_pos = 0;
50 while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
51 str.replace(start_pos, from.length(), to);
52 start_pos += to.length();
53 }
54 return str;
55}
56
57} // namespace detail
58
63inline std::string version()
64{
65 return detail::unquote(std::string(QUOTE(GMATTENSOR_VERSION)));
66}
67
79inline std::vector<std::string> version_dependencies(bool greedy = true)
80{
81 UNUSED(greedy);
82
83 std::vector<std::string> ret;
84 ret.push_back("gmattensor=" + GMatTensor::version());
85
86 // Goose suite
87
88#ifdef GMATELASTIC_VERSION
89 if (greedy) {
90 ret.push_back("gmatelastic=" + detail::unquote(std::string(QUOTE(GMATELASTIC_VERSION))));
91 }
92#endif
93
94#ifdef GMATELASTOPLASTIC_VERSION
95 if (greedy) {
96 ret.push_back(
97 "gmatelastoplastic=" + detail::unquote(std::string(QUOTE(GMATELASTOPLASTIC_VERSION))));
98 }
99#endif
100
101#ifdef GMATELASTOPLASTICQPOT_VERSION
102 if (greedy) {
103 ret.push_back(
104 "gmatelastoplasticqpot=" +
105 detail::unquote(std::string(QUOTE(GMATELASTOPLASTICQPOT_VERSION))));
106 }
107#endif
108
109#ifdef GMATELASTOPLASTICQPOT3D_VERSION
110 if (greedy) {
111 ret.push_back(
112 "gmatelastoplasticqpot3d=" +
113 detail::unquote(std::string(QUOTE(GMATELASTOPLASTICQPOT3D_VERSION))));
114 }
115#endif
116
117#ifdef GMATELASTOPLASTICFINITESTRAINSIMO_VERSION
118 if (greedy) {
119 ret.push_back(
120 "gmatelastoplasticfinitestrainsimo=" +
121 detail::unquote(std::string(QUOTE(GMATELASTOPLASTICFINITESTRAINSIMO_VERSION))));
122 }
123#endif
124
125#ifdef GMATNONLINEARELASTIC_VERSION
126 if (greedy) {
127 ret.push_back(
128 "gmatnonlinearelastic=" +
129 detail::unquote(std::string(QUOTE(GMATNONLINEARELASTIC_VERSION))));
130 }
131#endif
132
133#ifdef GOOSEFEM_VERSION
134 if (greedy) {
135 ret.push_back("goosefem=" + detail::unquote(std::string(QUOTE(GOOSEFEM_VERSION))));
136 }
137#endif
138
139#ifdef GOOSEEYE_VERSION
140 if (greedy) {
141 ret.push_back("goosefem=" + detail::unquote(std::string(QUOTE(GOOSEEYE_VERSION))));
142 }
143#endif
144
145#ifdef QPOT_VERSION
146 if (greedy) {
147 ret.push_back("qpot=" + detail::unquote(std::string(QUOTE(QPOT_VERSION))));
148 }
149#endif
150
151#ifdef PRRNG_VERSION
152 if (greedy) {
153 ret.push_back("prrng=" + detail::unquote(std::string(QUOTE(PRRNG_VERSION))));
154 }
155#endif
156
157#ifdef FRICTIONQPOTSPRINGBLOCK_VERSION
158 if (greedy) {
159 ret.push_back(
160 "frictionqpotspringblock=" +
161 detail::unquote(std::string(QUOTE(FRICTIONQPOTSPRINGBLOCK_VERSION))));
162 }
163#endif
164
165#ifdef FRICTIONQPOTFEM_VERSION
166 if (greedy) {
167 ret.push_back(
168 "frictionqpotfem=" + detail::unquote(std::string(QUOTE(FRICTIONQPOTFEM_VERSION))));
169 }
170#endif
171
172#ifdef CPPPATH_VERSION
173 if (greedy) {
174 ret.push_back("cpppath=" + detail::unquote(std::string(QUOTE(CPPPATH_VERSION))));
175 }
176#endif
177
178#ifdef CPPCOLORMAP_VERSION
179 if (greedy) {
180 ret.push_back("cppcolormap=" + detail::unquote(std::string(QUOTE(CPPCOLORMAP_VERSION))));
181 }
182#endif
183
184 // Boost
185
186#ifdef BOOST_VERSION
187 if (greedy) {
188 ret.push_back(
189 "boost=" + detail::unquote(std::to_string(BOOST_VERSION / 100000)) + "." +
190 detail::unquote(std::to_string((BOOST_VERSION / 100) % 1000)) + "." +
191 detail::unquote(std::to_string(BOOST_VERSION % 100)));
192 }
193#endif
194
195 // Eigen
196
197#ifdef EIGEN_WORLD_VERSION
198 if (greedy) {
199 ret.push_back(
200 "eigen=" + detail::unquote(std::string(QUOTE(EIGEN_WORLD_VERSION))) + "." +
201 detail::unquote(std::string(QUOTE(EIGEN_MAJOR_VERSION))) + "." +
202 detail::unquote(std::string(QUOTE(EIGEN_MINOR_VERSION))));
203 }
204#endif
205
206 // xtensor suite
207
208#ifdef XTENSOR_VERSION_MAJOR
209 ret.push_back(
210 "xtensor=" + detail::unquote(std::string(QUOTE(XTENSOR_VERSION_MAJOR))) + "." +
211 detail::unquote(std::string(QUOTE(XTENSOR_VERSION_MINOR))) + "." +
212 detail::unquote(std::string(QUOTE(XTENSOR_VERSION_PATCH))));
213#endif
214
215#ifdef XSIMD_VERSION_MAJOR
216 ret.push_back(
217 "xsimd=" + detail::unquote(std::string(QUOTE(XSIMD_VERSION_MAJOR))) + "." +
218 detail::unquote(std::string(QUOTE(XSIMD_VERSION_MINOR))) + "." +
219 detail::unquote(std::string(QUOTE(XSIMD_VERSION_PATCH))));
220#endif
221
222#ifdef XTL_VERSION_MAJOR
223 ret.push_back(
224 "xtl=" + detail::unquote(std::string(QUOTE(XTL_VERSION_MAJOR))) + "." +
225 detail::unquote(std::string(QUOTE(XTL_VERSION_MINOR))) + "." +
226 detail::unquote(std::string(QUOTE(XTL_VERSION_PATCH))));
227#endif
228
229#if defined(XTENSOR_PYTHON_VERSION_MAJOR)
230 ret.push_back(
231 "xtensor-python=" + detail::unquote(std::string(QUOTE(XTENSOR_PYTHON_VERSION_MAJOR))) +
232 "." + detail::unquote(std::string(QUOTE(XTENSOR_PYTHON_VERSION_MINOR))) + "." +
233 detail::unquote(std::string(QUOTE(XTENSOR_PYTHON_VERSION_PATCH))));
234#endif
235
236 std::sort(ret.begin(), ret.end(), std::greater<std::string>());
237
238 return ret;
239}
240
245inline std::vector<std::string> version_compiler()
246{
247 std::vector<std::string> ret;
248
249#ifdef __DATE__
250 std::string date = detail::unquote(std::string(QUOTE(__DATE__)));
251 ret.push_back("date=" + detail::replace(detail::replace(date, " ", "-"), "--", "-"));
252#endif
253
254#ifdef __APPLE__
255 ret.push_back("platform=apple");
256#endif
257
258#ifdef __MINGW32__
259 ret.push_back("platform=mingw");
260#endif
261
262#ifdef __linux__
263 ret.push_back("platform=linux");
264#endif
265
266#ifdef __clang_version__
267 ret.push_back(
268 "clang=" + detail::unquote(std::string(QUOTE(__clang_major__))) + "." +
269 detail::unquote(std::string(QUOTE(__clang_minor__))) + "." +
270 detail::unquote(std::string(QUOTE(__clang_patchlevel__))));
271#endif
272
273#ifdef __GNUC__
274 ret.push_back(
275 "gcc=" + detail::unquote(std::string(QUOTE(__GNUC__))) + "." +
276 detail::unquote(std::string(QUOTE(__GNUC_MINOR__))) + "." +
277 detail::unquote(std::string(QUOTE(__GNUC_PATCHLEVEL__))));
278#endif
279
280#ifdef _MSC_VER
281 ret.push_back("msvc=" + std::to_string(_MSC_VER));
282#endif
283
284 // c++ version
285
286#ifdef __cplusplus
287 ret.push_back("c++=" + detail::unquote(std::string(QUOTE(__cplusplus))));
288#endif
289
290 std::sort(ret.begin(), ret.end(), std::greater<std::string>());
291
292 return ret;
293}
294
295} // namespace GMatTensor
296
297#endif
Macros used in the library.
Tensor products / operations.
Definition: Cartesian2d.h:20
std::string version()
Return version string, e.g.
Definition: version.h:63
std::vector< std::string > version_dependencies(bool greedy=true)
Return versions of this library and of all of its major dependencies.
Definition: version.h:79
std::vector< std::string > version_compiler()
Return information on the compiler, the platform, the C++ standard, and the compilation data.
Definition: version.h:245
#define GMATTENSOR_VERSION
Current version.
Definition: version.h:33