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

[2/6] git commit: refs/heads/master - 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/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/016d9db9
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/016d9db9
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/016d9db9

Branch: refs/heads/master
Commit: 016d9db9983e1d8dfe700792b7a3b01a12b6b025
Parents: 2bc30cd
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 18:46:03 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/lucy/blob/016d9db9/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;