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:31:18 UTC

git commit: refs/heads/win_fixes_for_0.4 - Always compile as C++ with MSVC

Repository: lucy
Updated Branches:
  refs/heads/win_fixes_for_0.4 9ad21fcf0 -> 30418016e


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/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/30418016
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/30418016
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/30418016

Branch: refs/heads/win_fixes_for_0.4
Commit: 30418016e9802d769bfeca623aefda50b458930e
Parents: 9ad21fc
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 21 12:29:52 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 21 12:29:52 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/lucy/blob/30418016/perl/buildlib/Lucy/Build.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build.pm b/perl/buildlib/Lucy/Build.pm
index 9eae2ae..0e5a3d5 100644
--- a/perl/buildlib/Lucy/Build.pm
+++ b/perl/buildlib/Lucy/Build.pm
@@ -51,6 +51,17 @@ else {
 sub new {
     my $self = shift->SUPER::new( recursive_test_files => 1, @_ );
 
+    # 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;