Skip to content

Commit

Permalink
Add a Build::IsRelease and Build::IsNightly (#5777)
Browse files Browse the repository at this point in the history
And trigger the title var version in standalone using it
  • Loading branch information
baconpaul authored Jan 17, 2022
1 parent 89e645f commit eed15b6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmake/versiontools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ else ()
set(lpipeline "local")
endif ()

set(isrelease 0)
if (${GIT_BRANCH} STREQUAL "main")
if (${AZURE_PIPELINE})
set(lverpatch "nightly")
Expand All @@ -91,6 +92,7 @@ else ()
endif ()
set(lverpatch "stable-${lverrel}")
set(fverpatch "${lverrel}")
set(isrelease 1)
else ()
set(lverpatch ${GIT_BRANCH})
set(fverpatch ${lverpatch})
Expand All @@ -105,6 +107,7 @@ set(SURGE_RELEASE_VERSION "${lverpatch}")
set(SURGE_RELEASE_NUMBER "${lverrel}")
set(SURGE_BUILD_HASH "${GIT_COMMIT_HASH}")
set(SURGE_BUILD_LOCATION "${lpipeline}")
set(SURGE_BUILD_IS_RELEASE "${isrelease}")

string(TIMESTAMP SURGE_BUILD_DATE "%Y-%m-%d")
string(TIMESTAMP SURGE_BUILD_YEAR "%Y")
Expand Down
8 changes: 6 additions & 2 deletions src/common/version.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
#include "version.h"

// clang-format off
namespace Surge
{
const char* Build::MajorVersionStr = "@SURGE_MAJOR_VERSION@";
Expand All @@ -15,7 +16,10 @@ namespace Surge

const char* Build::ReleaseNumberStr = "@SURGE_RELEASE_NUMBER@";
const char* Build::ReleaseStr = "@SURGE_RELEASE_VERSION@";


const bool Build::IsRelease = @SURGE_BUILD_IS_RELEASE@;
const bool Build::IsNightly = ! Build::IsRelease;

const char* Build::BuildNumberStr = "@SURGE_BUILD_HASH@"; // Build number to be sure that each result could identified.

const char* Build::FullVersionStr = "@SURGE_FULL_VERSION@";
Expand All @@ -34,4 +38,4 @@ namespace Surge

const char* Build::CMAKE_INSTALL_PREFIX = "@CMAKE_INSTALL_PREFIX@";
}

// clang-format on
3 changes: 3 additions & 0 deletions src/common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ struct Build
static const char *ReleaseNumberStr;
static const char *ReleaseStr;

static const bool IsRelease; // vs nightly
static const bool IsNightly;

static const char *GitHash;
static const char *GitBranch;

Expand Down
5 changes: 4 additions & 1 deletion src/surge-xt/gui/SurgeJUCELookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ void SurgeJUCELookAndFeel::drawDocumentWindowTitleBar(DocumentWindow &window, Gr
surgeVersion += " DEBUG";
#endif

if (Surge::Build::IsRelease)
surgeVersion = "";

if (wt != "Surge XT")
{
surgeLabel = "Surge XT -";
Expand All @@ -187,7 +190,7 @@ void SurgeJUCELookAndFeel::drawDocumentWindowTitleBar(DocumentWindow &window, Gr

// Surge icon is 12 x 14 so draw that in the center
auto titleCenter = w / 2;
auto textMargin = 5;
auto textMargin = Surge::Build::IsRelease ? 0 : 5;
auto titleTextWidth = sw + vw + textMargin;

if (ic)
Expand Down

0 comments on commit eed15b6

Please sign in to comment.