You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/07/21 12:20:50 UTC

[2/2] git commit: Always compile as C++ with MSVC

Always compile as C++ with MSVC

Although the generated XS is C89-compliant now, it must be compiled in
C++ mode like the rest of the code due to a mismatch between the sizes
of the C++ bool type and the emulated bool type.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/bd045a8a
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/bd045a8a
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/bd045a8a

Branch: refs/heads/master
Commit: bd045a8afefda3ea26c37fdc4928225cded046a1
Parents: 64cac46
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 21 12:15:56 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 21 12:15:56 2014 +0200

----------------------------------------------------------------------
 runtime/perl/buildlib/Clownfish/Build.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bd045a8a/runtime/perl/buildlib/Clownfish/Build.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build.pm b/runtime/perl/buildlib/Clownfish/Build.pm
index 85de0b2..481ab25 100644
--- a/runtime/perl/buildlib/Clownfish/Build.pm
+++ b/runtime/perl/buildlib/Clownfish/Build.pm
@@ -69,6 +69,17 @@ sub new {
     };
     my $self = $class->SUPER::new( recursive_test_files => 1, %args );
 
+    # Fix for MSVC: Although the generated XS should be C89-compliant, it
+    # must be compiled in C++ mode like the rest of the code due to a
+    # mismatch between the sizes of the C++ bool type and the emulated bool
+    # type. (The XS code is compiled with Module::Build's extra compiler
+    # flags, not the Clownfish cflags.)
+    if ($Config{cc} =~ /^cl\b/) {
+        my $extra_cflags = $self->extra_compiler_flags;
+        push @$extra_cflags, '/TP';
+        $self->extra_compiler_flags(@$extra_cflags);
+    }
+
     if ( $ENV{LUCY_VALGRIND} ) {
         my $optimize = $self->config('optimize') || '';
         $optimize =~ s/\-O\d+/-O1/g;