Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-04-28 21:23:29 +0400
committerAlessandro Ranellucci <aar@cpan.org>2014-04-28 21:24:19 +0400
commitd4e97d17d51ad0680f0ff9344606ebe8511fb3d4 (patch)
treeaa5b20c3a4dcd2bcd922daca594fa148e75d393a /xs/Build.PL
parent2738a304e842b08feb65c0e1d99c07a7bfe476f0 (diff)
Use -O1 with GCC 4.7.0-4.7.2. #1965
Diffstat (limited to 'xs/Build.PL')
-rw-r--r--xs/Build.PL21
1 files changed, 17 insertions, 4 deletions
diff --git a/xs/Build.PL b/xs/Build.PL
index ca5b93104..915d6bca9 100644
--- a/xs/Build.PL
+++ b/xs/Build.PL
@@ -3,8 +3,24 @@
use strict;
use warnings;
+use ExtUtils::CppGuess;
use Module::Build::WithXSpp;
+# _GLIBCXX_USE_C99 : to get the long long type for g++
+# HAS_BOOL : stops Perl/lib/CORE/handy.h from doing "# define bool char" for MSVC
+# NOGDI : prevents inclusion of wingdi.h which defines functions Polygon() and Polyline() in global namespace
+my @cflags = qw(-D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DSLIC3RXS);
+if ($ENV{SLIC3R_DEBUG}) {
+ push @cflags, qw(-DSLIC3R_DEBUG -g -ftemplate-backtrace-limit=0);
+}
+if (ExtUtils::CppGuess->new->is_gcc) {
+ # check whether we're dealing with a buggy GCC version
+ # see https://github.com/alexrj/Slic3r/issues/1965
+ if (`cc --version` =~ / 4\.7\.[012]/) {
+ push @cflags, qw(-O1 -fcaller-saves -fcrossjumping -fcse-follow-jumps -fdevirtualize -fexpensive-optimizations -fgcse -findirect-inlining -finline-small-functions -fipa-cp -fipa-sra -foptimize-register-move -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole2 -free -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop -fschedule-insns2 -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftree-builtin-call-dce -ftree-pre -ftree-switch-conversion -ftree-tail-merge -ftree-vrp);
+ }
+}
+
my $build = Module::Build::WithXSpp->new(
module_name => 'Slic3r::XS',
dist_abstract => 'XS code for Slic3r',
@@ -21,10 +37,7 @@ my $build = Module::Build::WithXSpp->new(
Module::Build 0.38
Module::Build::WithXSpp 0.13
)},
- # _GLIBCXX_USE_C99 : to get the long long type for g++
- # HAS_BOOL : stops Perl/lib/CORE/handy.h from doing "# define bool char" for MSVC
- # NOGDI : prevents inclusion of wingdi.h which defines functions Polygon() and Polyline() in global namespace
- extra_compiler_flags => [qw(-D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DSLIC3RXS), ($ENV{SLIC3R_DEBUG} ? ' -DSLIC3R_DEBUG -g -ftemplate-backtrace-limit=0' : '')],
+ extra_compiler_flags => \@cflags,
# Provides extra C typemaps that are auto-merged
extra_typemap_modules => {