Skip to content

Commit d17659b

Browse files
committed
Add GIT commit version to About dialog and to exported GCode.
Implements #4532
1 parent 880e9a5 commit d17659b

File tree

8 files changed

+22
-7
lines changed

8 files changed

+22
-7
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ matrix:
5252
- export SLIC3R_STATIC=1
5353
- export CXX=g++-4.9
5454
- export CC=g++-4.9
55+
- export SLIC3R_GIT_VERSION=$(git rev-parse HEAD)
5556
- source $HOME/perl5/perlbrew/etc/bashrc
5657
after_success:
5758
- eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib)

lib/Slic3r.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use warnings;
1111
require v5.10;
1212

1313
our $VERSION = VERSION();
14+
our $GITVERSION = GITVERSION();
1415

1516
our $debug = 0;
1617
sub debugf {

lib/Slic3r/GUI/AboutDialog.pm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ use base 'Wx::Dialog';
1212
sub new {
1313
my $class = shift;
1414
my ($parent) = @_;
15-
my $self = $class->SUPER::new($parent, -1, 'About Slic3r', wxDefaultPosition, [600, 340], wxCAPTION);
15+
my $self = $class->SUPER::new($parent, -1, 'About Slic3r', wxDefaultPosition, [600, 440], wxCAPTION);
1616

1717
$self->SetBackgroundColour(Wx::wxWHITE);
1818
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL);
1919
$self->SetSizer($hsizer);
2020

2121
# logo
2222
my $logo = Slic3r::GUI::AboutDialog::Logo->new($self, -1, wxDefaultPosition, wxDefaultSize);
23-
$logo->SetBackgroundColour(Wx::wxWHITE);
23+
$logo->SetBackgroundColour(Wx::wxWHITE);
2424
$hsizer->Add($logo, 0, wxEXPAND | wxLEFT | wxRIGHT, 30);
2525

2626
my $vsizer = Wx::BoxSizer->new(wxVERTICAL);
@@ -45,8 +45,10 @@ sub new {
4545
# text
4646
my $text =
4747
'<html>' .
48-
'<body bgcolor="#ffffff" link="#808080">' .
49-
'<font color="#808080">' .
48+
'<body link="#808080">' .
49+
'Build commit: ' . $Slic3r::GITVERSION .
50+
'<br /><br />' .
51+
'<font>' .
5052
'Copyright &copy; 2011-2017 Alessandro Ranellucci. <br />' .
5153
'<a href="http://slic3r.org/">Slic3r</a> is licensed under the ' .
5254
'<a href="http://www.gnu.org/licenses/agpl-3.0.html">GNU Affero General Public License, version 3</a>.' .

lib/Slic3r/Print/GCode.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ sub export {
7070

7171
# Write information on the generator.
7272
my @lt = localtime;
73-
printf $fh "; generated by Slic3r $Slic3r::VERSION on %04d-%02d-%02d at %02d:%02d:%02d\n\n",
73+
printf $fh "; generated by Slic3r $Slic3r::VERSION (Build $Slic3r::GITVERSION) on %04d-%02d-%02d at %02d:%02d:%02d\n\n",
7474
$lt[5] + 1900, $lt[4]+1, $lt[3], $lt[2], $lt[1], $lt[0];
7575
# Write notes (content of all Settings tabs -> Notes)
7676
print $fh $gcodegen->notes;

package/win/appveyor_buildscript.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cd C:\projects\slic3r
1313
rm -r 'C:\Program Files (x86)\Microsoft Vis*\bin' -Force
1414

1515
Add-AppveyorCompilationMessage -Message "Building Slic3r XS"
16+
$env:SLIC3R_GIT_VERSION = $(git rev-parse HEAD)
1617
wget "http://www.siusgs.com/slic3r/buildserver/win/Build_PL" -O "Build.PL"
1718
perl ./Build.pl
1819

xs/Build.PL

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ $ENV{LD_RUN_PATH} //= "";
2020
# NOGDI : prevents inclusion of wingdi.h which defines functions Polygon() and Polyline() in global namespace
2121
# BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339
2222
my @cflags = qw(-D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DSLIC3RXS -DBOOST_ASIO_DISABLE_KQUEUE -Dexprtk_disable_rtl_io_file -Dexprtk_disable_return_statement -Dexprtk_disable_rtl_vecops -Dexprtk_disable_string_capabilities -Dexprtk_disable_enhanced_features);
23+
push @cflags, "-DSLIC3R_BUILD_COMMIT=$ENV{SLIC3R_GIT_VERSION}";
24+
2325
if ($cpp_guess->is_gcc) {
2426
# GCC is pedantic with c++11 std, so undefine strict ansi to get M_PI back
2527
push @cflags, qw(-U__STRICT_ANSI__);

xs/src/libslic3r/libslic3r.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ namespace Slic3r {
4444

4545
constexpr auto SLIC3R_VERSION = "1.3.1-dev";
4646

47-
#ifndef SLIC3RXS
47+
4848
#ifndef SLIC3R_BUILD_COMMIT
4949
#define SLIC3R_BUILD_COMMIT (Unknown revision)
5050
#endif
5151
#define VER1_(x) #x
5252
#define VER_(x) VER1_(x)
5353
#define BUILD_COMMIT VER_(SLIC3R_BUILD_COMMIT)
54-
#endif
54+
55+
const auto SLIC3R_GIT_STR = std::string(BUILD_COMMIT);
56+
const auto SLIC3R_GIT = SLIC3R_GIT_STR.c_str();
5557

5658
#ifdef _WIN32
5759
typedef int64_t coord_t;

xs/xsp/XS.xsp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ VERSION()
1616
RETVAL = newSVpv(SLIC3R_VERSION, 0);
1717
OUTPUT: RETVAL
1818

19+
SV*
20+
GITVERSION()
21+
CODE:
22+
RETVAL = newSVpv(SLIC3R_GIT, 0);
23+
OUTPUT: RETVAL
24+
1925
void
2026
xspp_test_croak_hangs_on_strawberry()
2127
CODE:

0 commit comments

Comments
 (0)