diff --git a/CMakeLists.txt b/CMakeLists.txt index 87e4b37c61c..cf23c9704a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,17 @@ endif() find_package(Git) if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") - # git commit hash macro + # Check if Orca is on a tag + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --exact-match --tags + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE GIT_TAG_CHECK + ) + if(NOT GIT_TAG_CHECK EQUAL 0) + add_definitions("-DSNAPSHOT_BUILD=1") + endif() + + # Check current Git commit hash execute_process( COMMAND ${GIT_EXECUTABLE} log -1 --format=%h WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 3d09ff1079a..e7ff3caa3f7 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -243,11 +243,8 @@ AboutDialog::AboutDialog() { vesizer->Add(0, FromDIP(165), 1, wxEXPAND, FromDIP(5)); auto version_string = _L("Orca Slicer ") + " " + std::string(SoftFever_VERSION); - auto build_string = _L("build") + " " + std::string(GIT_COMMIT_HASH); wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize); - wxStaticText* version_build = new wxStaticText(this, wxID_ANY, build_string.c_str(), wxDefaultPosition, wxDefaultSize); wxStaticText* bs_version = new wxStaticText(this, wxID_ANY, wxString::Format("Based on PrusaSlicer and BambuStudio"), wxDefaultPosition, wxDefaultSize); - version_build->SetFont(Label::Body_12); bs_version->SetFont(Label::Body_12); wxFont version_font = GetFont(); #ifdef __WXMSW__ @@ -258,15 +255,23 @@ AboutDialog::AboutDialog() version_font.SetPointSize(FromDIP(16)); version->SetFont(version_font); version->SetForegroundColour(wxColour("#FFFFFD")); - version_build->SetForegroundColour(wxColour("#FFFFFD")); bs_version->SetForegroundColour(wxColour("#FFFFFD")); version->SetBackgroundColour(wxColour("#4d4d4d")); - version_build->SetBackgroundColour(wxColour("#4d4d4d")); bs_version->SetBackgroundColour(wxColour("#4d4d4d")); + #ifdef SNAPSHOT_BUILD + auto build_string = _L("build") + " " + std::string(GIT_COMMIT_HASH); + wxStaticText* version_build = new wxStaticText(this, wxID_ANY, build_string.c_str(), wxDefaultPosition, wxDefaultSize); + version_build->SetFont(Label::Body_12); + + version_build->SetForegroundColour(wxColour("#FFFFFD")); + version_build->SetBackgroundColour(wxColour("#4d4d4d")); + #endif vesizer->Add(version, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, FromDIP(5)); + #ifdef SNAPSHOT_BUILD vesizer->Add(version_build, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, FromDIP(5)); + #endif vesizer->Add(bs_version, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, FromDIP(5)); // #if BBL_INTERNAL_TESTING // wxString build_time = wxString::Format("Build Time: %s", std::string(SLIC3R_BUILD_TIME));