Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 10aafbd

Browse files
committed
Support building with Visual Studio 2017
Haribabu Kommi, reviewed by Takeshi Ideriha and Christian Ullrich Backpatch to 9.6
1 parent a1f30ec commit 10aafbd

File tree

5 files changed

+78
-13
lines changed

5 files changed

+78
-13
lines changed

doc/src/sgml/install-windows.sgml

+9-7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
<para>
2020
There are several different ways of building PostgreSQL on
2121
<productname>Windows</productname>. The simplest way to build with
22-
Microsoft tools is to install <productname>Visual Studio Express 2015
22+
Microsoft tools is to install <productname>Visual Studio Express 2017
2323
for Windows Desktop</productname> and use the included
2424
compiler. It is also possible to build with the full
25-
<productname>Microsoft Visual C++ 2005 to 2015</productname>.
25+
<productname>Microsoft Visual C++ 2005 to 2017</productname>.
2626
In some cases that requires the installation of the
2727
<productname>Windows SDK</productname> in addition to the compiler.
2828
</para>
@@ -77,26 +77,28 @@
7777
<productname>Visual Studio Express</productname> or some versions of the
7878
<productname>Microsoft Windows SDK</productname>. If you do not already have a
7979
<productname>Visual Studio</productname> environment set up, the easiest
80-
ways are to use the compilers from <productname>Visual Studio Express 2015
80+
ways are to use the compilers from <productname>Visual Studio Express 2017
8181
for Windows Desktop</productname> or those in the <productname>Windows SDK
82-
7.1</productname>, which are both free downloads from Microsoft.
82+
8.1</productname>, which are both free downloads from Microsoft.
8383
</para>
8484

8585
<para>
8686
Both 32-bit and 64-bit builds are possible with the Microsoft Compiler suite.
8787
32-bit PostgreSQL builds are possible with
8888
<productname>Visual Studio 2005</productname> to
89-
<productname>Visual Studio 2015</productname> (including Express editions),
90-
as well as standalone Windows SDK releases 6.0 to 7.1.
89+
<productname>Visual Studio 2017</productname> (including Express editions),
90+
as well as standalone Windows SDK releases 6.0 to 8.1.
9191
64-bit PostgreSQL builds are supported with
92-
<productname>Microsoft Windows SDK</productname> version 6.0a to 7.1 or
92+
<productname>Microsoft Windows SDK</productname> version 6.0a to 8.1 or
9393
<productname>Visual Studio 2008</productname> and above. Compilation
9494
is supported down to <productname>Windows XP</productname> and
9595
<productname>Windows Server 2003</> when building with
9696
<productname>Visual Studio 2005</> to
9797
<productname>Visual Studio 2013</productname>. Building with
9898
<productname>Visual Studio 2015</productname> is supported down to
9999
<productname>Windows Vista</> and <productname>Windows Server 2008</>.
100+
Building with <productname>Visual Studio 2017</productname> is supported
101+
down to <productname>Windows 7 SP1</> and <productname>Windows Server 2008 R2 SP1</>.
100102
</para>
101103

102104
<para>

src/tools/msvc/MSBuildProject.pm

+23
Original file line numberDiff line numberDiff line change
@@ -483,4 +483,27 @@ sub new
483483
return $self;
484484
}
485485

486+
package VC2017Project;
487+
488+
#
489+
# Package that encapsulates a Visual C++ 2017 project file
490+
#
491+
492+
use strict;
493+
use warnings;
494+
use base qw(VC2012Project);
495+
496+
sub new
497+
{
498+
my $classname = shift;
499+
my $self = $classname->SUPER::_new(@_);
500+
bless($self, $classname);
501+
502+
$self->{vcver} = '15.00';
503+
$self->{PlatformToolset} = 'v141';
504+
$self->{ToolsVersion} = '15.0';
505+
506+
return $self;
507+
}
508+
486509
1;

src/tools/msvc/README

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MSVC build
44
==========
55

66
This directory contains the tools required to build PostgreSQL using
7-
Microsoft Visual Studio 2005 - 2011. This builds the whole backend, not just
7+
Microsoft Visual Studio 2005 - 2017. This builds the whole backend, not just
88
the libpq frontend library. For more information, see the documentation
99
chapter "Installation on Windows" and the description below.
1010

@@ -92,11 +92,12 @@ These configuration arguments are passed over to Mkvcbuild::mkvcbuild
9292
(Mkvcbuild.pm) which creates the Visual Studio project and solution files.
9393
It does this by using VSObjectFactory::CreateSolution to create an object
9494
implementing the Solution interface (this could be either a VS2005Solution,
95-
a VS2008Solution, a VS2010Solution or a VS2012Solution, all in Solution.pm,
96-
depending on the user's build environment) and adding objects implementing
97-
the corresponding Project interface (VC2005Project or VC2008Project from
98-
VCBuildProject.pm or VC2010Project or VC2012Project from MSBuildProject.pm)
99-
to it.
95+
a VS2008Solution, a VS2010Solution or a VS2012Solution or a VS2013Solution,
96+
or a VS2015Solution or a VS2017Solution, all in Solution.pm, depending on
97+
the user's build environment) and adding objects implementing the corresponding
98+
Project interface (VC2005Project or VC2008Project from VCBuildProject.pm or
99+
VC2010Project or VC2012Project or VC2013Project or VC2015Project or VC2017Project
100+
from MSBuildProject.pm) to it.
100101
When Solution::Save is called, the implementations of Solution and Project
101102
save their content in the appropriate format.
102103
The final step of starting the appropriate build program (msbuild or vcbuild)

src/tools/msvc/Solution.pm

+26
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,32 @@ sub new
827827
return $self;
828828
}
829829

830+
package VS2017Solution;
831+
832+
#
833+
# Package that encapsulates a Visual Studio 2017 solution file
834+
#
835+
836+
use Carp;
837+
use strict;
838+
use warnings;
839+
use base qw(Solution);
840+
841+
sub new
842+
{
843+
my $classname = shift;
844+
my $self = $classname->SUPER::_new(@_);
845+
bless($self, $classname);
846+
847+
$self->{solutionFileVersion} = '12.00';
848+
$self->{vcver} = '15.00';
849+
$self->{visualStudioName} = 'Visual Studio 2017';
850+
$self->{VisualStudioVersion} = '15.0.26730.3';
851+
$self->{MinimumVisualStudioVersion} = '10.0.40219.1';
852+
853+
return $self;
854+
}
855+
830856
sub GetAdditionalHeaders
831857
{
832858
my ($self, $f) = @_;

src/tools/msvc/VSObjectFactory.pm

+13
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ sub CreateSolution
5353
{
5454
return new VS2015Solution(@_);
5555
}
56+
# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it.
57+
elsif (($visualStudioVersion ge '14.10') or ($visualStudioVersion eq '15.00'))
58+
{
59+
return new VS2017Solution(@_);
60+
}
5661
else
5762
{
63+
croak $visualStudioVersion;
5864
croak "The requested Visual Studio version is not supported.";
5965
}
6066
}
@@ -92,8 +98,14 @@ sub CreateProject
9298
{
9399
return new VC2015Project(@_);
94100
}
101+
# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it.
102+
elsif (($visualStudioVersion ge '14.10') or ($visualStudioVersion eq '15.00'))
103+
{
104+
return new VC2017Project(@_);
105+
}
95106
else
96107
{
108+
croak $visualStudioVersion;
97109
croak "The requested Visual Studio version is not supported.";
98110
}
99111
}
@@ -120,6 +132,7 @@ sub DetermineVisualStudioVersion
120132
sub _GetVisualStudioVersion
121133
{
122134
my ($major, $minor) = @_;
135+
# visual 2017 hasn't changed the nmake version to 15, so still using the older version for comparison.
123136
if ($major > 14)
124137
{
125138
carp

0 commit comments

Comments
 (0)