monostep/Source/BuildInfo.h

53 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include <JuceHeader.h>
#include "BuildStamp.h"
namespace monostep
{
namespace buildinfo
{
inline juce::String gitInfo()
{
#if defined (MONOSTEP_GIT_INFO)
return juce::String (MONOSTEP_GIT_INFO);
#else
return "no-vcs";
#endif
}
inline juce::String buildDateString()
{
#if defined (MONOSTEP_BUILD_DATE)
return juce::String (MONOSTEP_BUILD_DATE);
#else
static const char* months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
const juce::String d (__DATE__);
int month = 1;
for (int i = 0; i < 12; ++i)
if (d.startsWith (months[i]))
{
month = i + 1;
break;
}
const int day = d.substring (4, 6).trim().getIntValue();
const int year = d.substring (7).getIntValue();
return juce::String::formatted ("%04d-%02d-%02d__%s", year, month, day, __TIME__);
#endif
}
inline juce::String footerText()
{
return gitInfo() + " (" + buildDateString() + ")";
}
} // namespace buildinfo
} // namespace monostep