forked from bartvdbraak/blender
Tweaks to the version string formation
Couple of things: - No need to use string streams to format the version string, we can do it at compile time and don't bother with anything at runtime. - Function declaration was wring and would have caused linking conflicts in cases when util_version.h was included from multiple places. We should have an utility function to get Cycles version so applications which are linked to Cycles dynamically can query the version, but that can't be done as an inlined function in header and would need to be a function properly exported to a global symbol table (aka, be implemented in a .cpp file).
This commit is contained in:
parent
ed050753ce
commit
bd7e4d2a3d
@ -409,7 +409,7 @@ static void options_parse(int argc, const char **argv)
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else if(version) {
|
||||
printf("%s\n", cycles_version_number().c_str());
|
||||
printf("%s\n", CYCLES_VERSION_STRING);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else if(help || options.filepath == "") {
|
||||
|
@ -27,18 +27,13 @@ CCL_NAMESPACE_BEGIN
|
||||
#define CYCLES_VERSION_MINOR 7
|
||||
#define CYCLES_VERSION_PATCH 0
|
||||
|
||||
/* Create string number, like "1.7.0" */
|
||||
string cycles_version_number()
|
||||
{
|
||||
stringstream ss;
|
||||
ss << CYCLES_VERSION_MAJOR << "."
|
||||
<< CYCLES_VERSION_MINOR << "."
|
||||
<< CYCLES_VERSION_PATCH;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
#define CYCLES_MAKE_VERSION_STRING2(a,b,c) #a "." #b "." #c
|
||||
#define CYCLES_MAKE_VERSION_STRING(a,b,c) CYCLES_MAKE_VERSION_STRING2(a,b,c)
|
||||
#define CYCLES_VERSION_STRING \
|
||||
CYCLES_MAKE_VERSION_STRING(CYCLES_VERSION_MAJOR, \
|
||||
CYCLES_VERSION_MINOR, \
|
||||
CYCLES_VERSION_PATCH)
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_VERSION_H__ */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user