diff --git a/.travis.yml b/.travis.yml index 531703f60..bcf34ae15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,6 +52,7 @@ matrix: - export SLIC3R_STATIC=1 - export CXX=g++-4.9 - export CC=g++-4.9 + - export SLIC3R_GIT_VERSION=$(git rev-parse HEAD) - source $HOME/perl5/perlbrew/etc/bashrc after_success: - eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 47ed095f3..e1445335c 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -11,6 +11,7 @@ use warnings; require v5.10; our $VERSION = VERSION(); +our $GITVERSION = GITVERSION(); our $debug = 0; sub debugf { diff --git a/lib/Slic3r/GUI/AboutDialog.pm b/lib/Slic3r/GUI/AboutDialog.pm index 85d7a6fda..928682a4e 100644 --- a/lib/Slic3r/GUI/AboutDialog.pm +++ b/lib/Slic3r/GUI/AboutDialog.pm @@ -12,7 +12,7 @@ use base 'Wx::Dialog'; sub new { my $class = shift; my ($parent) = @_; - my $self = $class->SUPER::new($parent, -1, 'About Slic3r', wxDefaultPosition, [600, 340], wxCAPTION); + my $self = $class->SUPER::new($parent, -1, 'About Slic3r', wxDefaultPosition, [600, 440], wxCAPTION); $self->SetBackgroundColour(Wx::wxWHITE); my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL); @@ -20,7 +20,7 @@ sub new { # logo my $logo = Slic3r::GUI::AboutDialog::Logo->new($self, -1, wxDefaultPosition, wxDefaultSize); - $logo->SetBackgroundColour(Wx::wxWHITE); + $logo->SetBackgroundColour(Wx::wxWHITE); $hsizer->Add($logo, 0, wxEXPAND | wxLEFT | wxRIGHT, 30); my $vsizer = Wx::BoxSizer->new(wxVERTICAL); @@ -45,8 +45,10 @@ sub new { # text my $text = '' . - '' . - '' . + '' . + 'Build commit: ' . $Slic3r::GITVERSION . + '

' . + '' . 'Copyright © 2011-2017 Alessandro Ranellucci.
' . 'Slic3r is licensed under the ' . 'GNU Affero General Public License, version 3.' . diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 5726b362a..ef6515473 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -70,7 +70,7 @@ sub export { # Write information on the generator. my @lt = localtime; - printf $fh "; generated by Slic3r $Slic3r::VERSION on %04d-%02d-%02d at %02d:%02d:%02d\n\n", + printf $fh "; generated by Slic3r $Slic3r::VERSION (Build $Slic3r::GITVERSION) on %04d-%02d-%02d at %02d:%02d:%02d\n\n", $lt[5] + 1900, $lt[4]+1, $lt[3], $lt[2], $lt[1], $lt[0]; # Write notes (content of all Settings tabs -> Notes) print $fh $gcodegen->notes; diff --git a/package/win/appveyor_buildscript.ps1 b/package/win/appveyor_buildscript.ps1 index ac1ace9d4..9725bc3c9 100644 --- a/package/win/appveyor_buildscript.ps1 +++ b/package/win/appveyor_buildscript.ps1 @@ -13,6 +13,7 @@ cd C:\projects\slic3r rm -r 'C:\Program Files (x86)\Microsoft Vis*\bin' -Force Add-AppveyorCompilationMessage -Message "Building Slic3r XS" +$env:SLIC3R_GIT_VERSION = $(git rev-parse HEAD) wget "http://www.siusgs.com/slic3r/buildserver/win/Build_PL" -O "Build.PL" perl ./Build.pl diff --git a/xs/Build.PL b/xs/Build.PL index a4d00cd3d..89acbd0bf 100644 --- a/xs/Build.PL +++ b/xs/Build.PL @@ -20,6 +20,8 @@ $ENV{LD_RUN_PATH} //= ""; # NOGDI : prevents inclusion of wingdi.h which defines functions Polygon() and Polyline() in global namespace # BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339 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); +push @cflags, "-DSLIC3R_BUILD_COMMIT=$ENV{SLIC3R_GIT_VERSION}"; + if ($cpp_guess->is_gcc) { # GCC is pedantic with c++11 std, so undefine strict ansi to get M_PI back push @cflags, qw(-U__STRICT_ANSI__); diff --git a/xs/src/libslic3r/libslic3r.h b/xs/src/libslic3r/libslic3r.h index 878af5fec..d178c6c64 100644 --- a/xs/src/libslic3r/libslic3r.h +++ b/xs/src/libslic3r/libslic3r.h @@ -44,14 +44,16 @@ namespace Slic3r { constexpr auto SLIC3R_VERSION = "1.3.1-dev"; -#ifndef SLIC3RXS + #ifndef SLIC3R_BUILD_COMMIT #define SLIC3R_BUILD_COMMIT (Unknown revision) #endif #define VER1_(x) #x #define VER_(x) VER1_(x) #define BUILD_COMMIT VER_(SLIC3R_BUILD_COMMIT) -#endif + +const auto SLIC3R_GIT_STR = std::string(BUILD_COMMIT); +const auto SLIC3R_GIT = SLIC3R_GIT_STR.c_str(); #ifdef _WIN32 typedef int64_t coord_t; diff --git a/xs/xsp/XS.xsp b/xs/xsp/XS.xsp index 1f6c8b610..a17a8416d 100644 --- a/xs/xsp/XS.xsp +++ b/xs/xsp/XS.xsp @@ -16,6 +16,12 @@ VERSION() RETVAL = newSVpv(SLIC3R_VERSION, 0); OUTPUT: RETVAL +SV* +GITVERSION() + CODE: + RETVAL = newSVpv(SLIC3R_GIT, 0); + OUTPUT: RETVAL + void xspp_test_croak_hangs_on_strawberry() CODE: