Add --version

This commit is contained in:
Michael Hansen
2023-07-10 15:09:58 -05:00
parent 42d14ef21f
commit daf6e7fcf7
6 changed files with 77 additions and 25 deletions

View File

@@ -16,11 +16,24 @@
namespace piper {
#ifdef _PIPER_VERSION
// https://stackoverflow.com/questions/47346133/how-to-use-a-define-inside-a-format-string
#define _STR(x) #x
#define STR(x) _STR(x)
const std::string VERSION = STR(_PIPER_VERSION);
#else
const std::string VERSION = "";
#endif
// Maximum value for 16-bit signed WAV sample
const float MAX_WAV_VALUE = 32767.0f;
const std::string instanceName{"piper"};
std::string getVersion() {
return VERSION;
}
// True if the string is a single UTF-8 codepoint
bool isSingleCodepoint(std::string s) {
return utf8::distance(s.begin(), s.end()) == 1;