1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Enable building with Visual Studion 2013.

Backpatch to 9.3.

Brar Piening.
This commit is contained in:
Andrew Dunstan
2014-01-26 09:49:10 -05:00
parent 00ba97365d
commit cec8394b5c
9 changed files with 140 additions and 25 deletions

View File

@@ -18,6 +18,7 @@ sub _new
bless($self, $classname);
$self->{filenameExtension} = '.vcxproj';
$self->{ToolsVersion} = '4.0';
return $self;
}
@@ -28,7 +29,7 @@ sub WriteHeader
print $f <<EOF;
<?xml version="1.0" encoding="Windows-1252"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="$self->{ToolsVersion}" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
EOF
$self->WriteConfigurationHeader($f, 'Debug');
@@ -414,6 +415,7 @@ sub new
bless($self, $classname);
$self->{vcver} = '11.00';
$self->{PlatformToolset} = 'v110';
return $self;
}
@@ -434,9 +436,32 @@ sub WriteConfigurationPropertyGroup
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>$self->{PlatformToolset}</PlatformToolset>
</PropertyGroup>
EOF
}
package VC2013Project;
#
# Package that encapsulates a Visual C++ 2013 project file
#
use strict;
use warnings;
use base qw(VC2012Project);
sub new
{
my $classname = shift;
my $self = $classname->SUPER::_new(@_);
bless($self, $classname);
$self->{vcver} = '12.00';
$self->{PlatformToolset} = 'v120';
$self->{ToolsVersion} = '12.0';
return $self;
}
1;

View File

@@ -70,9 +70,11 @@ sub mkvcbuild
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c pqsignal.c
qsort.c qsort_arg.c quotes.c
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c
win32env.c win32error.c win32setlocale.c);
push(@pgportfiles, 'rint.c') if ($vsVersion < '12.00');
our @pgcommonallfiles = qw(
exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c);

View File

@@ -19,6 +19,8 @@ sub _new
options => $options,
numver => '',
strver => '',
VisualStudioVersion => undef,
MinimumVisualStudioVersion => undef,
vcver => undef,
platform => undef, };
bless($self, $classname);
@@ -59,6 +61,11 @@ sub _new
return $self;
}
sub GetAdditionalHeaders
{
return '';
}
sub DeterminePlatform
{
my $self = shift;
@@ -541,6 +548,8 @@ Microsoft Visual Studio Solution File, Format Version $self->{solutionFileVersio
# $self->{visualStudioName}
EOF
print SLN $self->GetAdditionalHeaders();
foreach my $fld (keys %{ $self->{projects} })
{
foreach my $proj (@{ $self->{projects}->{$fld} })
@@ -723,4 +732,39 @@ sub new
return $self;
}
package VS2013Solution;
#
# Package that encapsulates a Visual Studio 2013 solution file
#
use Carp;
use strict;
use warnings;
use base qw(Solution);
sub new
{
my $classname = shift;
my $self = $classname->SUPER::_new(@_);
bless($self, $classname);
$self->{solutionFileVersion} = '12.00';
$self->{vcver} = '12.00';
$self->{visualStudioName} = 'Visual Studio 2013';
$self->{VisualStudioVersion} = '12.0.21005.1',
$self->{MinimumVisualStudioVersion} = '10.0.40219.1',
return $self;
}
sub GetAdditionalHeaders
{
my ($self, $f) = @_;
return qq|VisualStudioVersion = $self->{VisualStudioVersion}
MinimumVisualStudioVersion = $self->{MinimumVisualStudioVersion}
|;
}
1;

View File

@@ -45,6 +45,10 @@ sub CreateSolution
{
return new VS2012Solution(@_);
}
elsif ($visualStudioVersion eq '12.00')
{
return new VS2013Solution(@_);
}
else
{
croak "The requested Visual Studio version is not supported.";
@@ -76,6 +80,10 @@ sub CreateProject
{
return new VC2012Project(@_);
}
elsif ($visualStudioVersion eq '12.00')
{
return new VC2013Project(@_);
}
else
{
croak "The requested Visual Studio version is not supported.";
@@ -115,11 +123,11 @@ sub DetermineVisualStudioVersion
sub _GetVisualStudioVersion
{
my ($major, $minor) = @_;
if ($major > 11)
if ($major > 12)
{
carp
"The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
return '11.00';
return '12.00';
}
elsif ($major < 6)
{