6
use ExtUtils::CppGuess;
7
use Module::Build::WithXSpp;
9
# _GLIBCXX_USE_C99 : to get the long long type for g++
10
# HAS_BOOL : stops Perl/lib/CORE/handy.h from doing "# define bool char" for MSVC
11
# NOGDI : prevents inclusion of wingdi.h which defines functions Polygon() and Polyline() in global namespace
12
my @cflags = qw(-D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DSLIC3RXS);
13
if ($ENV{SLIC3R_DEBUG}) {
14
# only on newer GCCs: -ftemplate-backtrace-limit=0
15
push @cflags, qw(-DSLIC3R_DEBUG -g);
17
if (ExtUtils::CppGuess->new->is_gcc) {
18
# check whether we're dealing with a buggy GCC version
19
# see https://github.com/alexrj/Slic3r/issues/1965
20
if (`cc --version` =~ / 4\.7\.[012]/) {
21
# Workaround suggested by Boost devs:
22
# https://svn.boost.org/trac/boost/ticket/8695
23
push @cflags, qw(-fno-inline-small-functions);
27
my $build = Module::Build::WithXSpp->new(
28
module_name => 'Slic3r::XS',
29
dist_abstract => 'XS code for Slic3r',
30
build_requires => {qw(
31
ExtUtils::ParseXS 3.18
32
ExtUtils::Typemap 1.00
33
ExtUtils::Typemaps::Default 1.03
38
configure_requires => {qw(
39
ExtUtils::CppGuess 0.07
41
Module::Build::WithXSpp 0.13
43
extra_compiler_flags => \@cflags,
45
# Provides extra C typemaps that are auto-merged
46
extra_typemap_modules => {
47
'ExtUtils::Typemaps::Default' => '1.03',
51
early_includes => [qw(
59
$build->create_build_script;