Skip to content

Commit

Permalink
Dynamically check for snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectricalBoy committed Aug 20, 2024
1 parent cddc517 commit 0e8cf86
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
15 changes: 10 additions & 5 deletions src/slic3r/GUI/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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));
Expand Down

0 comments on commit 0e8cf86

Please sign in to comment.