Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit721963f

Browse files
committed
Add support for Visual Studio 2019 in build scripts
This adjusts the documentation and the scripts related to the versionsof Windows SDK supported.Author: Haribabu KommiReviewed-by: Andrew Dunstan, Juan José Santamaría Flecha, MichaelPaquierDiscussion:https://postgr.es/m/CAJrrPGcfqXhfPyMrny9apoDU7M1t59dzVAvoJ9AeAh5BJi+UzA@mail.gmail.comBackpatch-through: 9.4
1 parent074add6 commit721963f

File tree

5 files changed

+111
-28
lines changed

5 files changed

+111
-28
lines changed

‎doc/src/sgml/install-windows.sgml

Lines changed: 10 additions & 9 deletions
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 Express2017
22+
Microsoft tools is to install <productname>Visual Studio Express2019
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 to2017</productname>.
25+
<productname>Microsoft Visual C++ 2005 to2019</productname>.
2626
In some cases that requires the installation of the
2727
<productname>Windows SDK</productname> in addition to the compiler.
2828
</para>
@@ -69,27 +69,28 @@
6969
<productname>Visual Studio Express</productname> or some versions of the
7070
<productname>Microsoft Windows SDK</productname>. If you do not already have a
7171
<productname>Visual Studio</productname> environment set up, the easiest
72-
ways are to use the compilers from <productname>Visual Studio Express2017
72+
ways are to use the compilers from <productname>Visual Studio Express2019
7373
for Windows Desktop</productname> or those in the <productname>Windows SDK
74-
8.1</productname>, which are both free downloads from Microsoft.
74+
10</productname>, which are both free downloads from Microsoft.
7575
</para>
7676

7777
<para>
7878
Both 32-bit and 64-bit builds are possible with the Microsoft Compiler suite.
7979
32-bit PostgreSQL builds are possible with
8080
<productname>Visual Studio 2005</productname> to
81-
<productname>Visual Studio2017</productname> (including Express editions),
82-
as well as standalone Windows SDK releases 6.0 to8.1.
81+
<productname>Visual Studio2019</productname> (including Express editions),
82+
as well as standalone Windows SDK releases 6.0 to10.
8383
64-bit PostgreSQL builds are supported with
84-
<productname>Microsoft Windows SDK</productname> version 6.0a to8.1 or
84+
<productname>Microsoft Windows SDK</productname> version 6.0a to10 or
8585
<productname>Visual Studio 2008</productname> and above. Compilation
8686
is supported down to <productname>Windows XP</productname> and
8787
<productname>Windows Server 2003</productname> when building with
8888
<productname>Visual Studio 2005</productname> to
8989
<productname>Visual Studio 2013</productname>. Building with
9090
<productname>Visual Studio 2015</productname> is supported down to
9191
<productname>Windows Vista</productname> and <productname>Windows Server 2008</productname>.
92-
Building with <productname>Visual Studio 2017</productname> is supported
92+
Building with <productname>Visual Studio 2017</productname> to
93+
<productname>Visual Studio 2019</productname> is supported
9394
down to <productname>Windows 7 SP1</productname> and <productname>Windows Server 2008 R2 SP1</productname>.
9495
</para>
9596

@@ -162,7 +163,7 @@ $ENV{MSBFLAGS}="/m";
162163
If your build environment doesn't ship with a supported version of the
163164
<productname>Microsoft Windows SDK</productname> it
164165
is recommended that you upgrade to the latest version (currently
165-
version7.1), available for download from
166+
version10), available for download from
166167
<ulink url="https://www.microsoft.com/download"></ulink>.
167168
</para>
168169
<para>

‎src/tools/msvc/MSBuildProject.pm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,4 +535,29 @@ sub new
535535
return$self;
536536
}
537537

538+
packageVC2019Project;
539+
540+
#
541+
# Package that encapsulates a Visual C++ 2019 project file
542+
#
543+
544+
use strict;
545+
use warnings;
546+
use baseqw(VC2012Project);
547+
548+
no warningsqw(redefine);## no critic
549+
550+
subnew
551+
{
552+
my$classname =shift;
553+
my$self =$classname->SUPER::_new(@_);
554+
bless($self,$classname);
555+
556+
$self->{vcver} ='16.00';
557+
$self->{PlatformToolset} ='v142';
558+
$self->{ToolsVersion} ='16.0';
559+
560+
return$self;
561+
}
562+
538563
1;

‎src/tools/msvc/README

Lines changed: 7 additions & 6 deletions
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 -2017. This builds the whole backend, not just
7+
Microsoft Visual Studio 2005 -2019. 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

@@ -93,11 +93,12 @@ These configuration arguments are passed over to Mkvcbuild::mkvcbuild
9393
It does this by using VSObjectFactory::CreateSolution to create an object
9494
implementing the Solution interface (this could be either a VS2005Solution,
9595
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.
96+
or a VS2015Solution or a VS2017Solution or a VS2019Solution, all in
97+
Solution.pm, depending on the user's build environment) and adding objects
98+
implementing the corresponding Project interface (VC2005Project or
99+
VC2008Project from VCBuildProject.pm or VC2010Project or VC2012Project or
100+
VC2013Project or VC2015Project or VC2017Project or VC2019Project from
101+
MSBuildProject.pm) to it.
101102
When Solution::Save is called, the implementations of Solution and Project
102103
save their content in the appropriate format.
103104
The final step of starting the appropriate build program (msbuild or vcbuild)

‎src/tools/msvc/Solution.pm

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,34 @@ sub new
10371037
return$self;
10381038
}
10391039

1040+
packageVS2019Solution;
1041+
1042+
#
1043+
# Package that encapsulates a Visual Studio 2019 solution file
1044+
#
1045+
1046+
use Carp;
1047+
use strict;
1048+
use warnings;
1049+
use baseqw(Solution);
1050+
1051+
no warningsqw(redefine);## no critic
1052+
1053+
subnew
1054+
{
1055+
my$classname =shift;
1056+
my$self =$classname->SUPER::_new(@_);
1057+
bless($self,$classname);
1058+
1059+
$self->{solutionFileVersion} ='12.00';
1060+
$self->{vcver} ='16.00';
1061+
$self->{visualStudioName} ='Visual Studio 2019';
1062+
$self->{VisualStudioVersion} ='16.0.28729.10';
1063+
$self->{MinimumVisualStudioVersion} ='10.0.40219.1';
1064+
1065+
return$self;
1066+
}
1067+
10401068
subGetAdditionalHeaders
10411069
{
10421070
my ($self,$f) =@_;

‎src/tools/msvc/VSObjectFactory.pm

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,29 @@ sub CreateSolution
5656
return new VS2015Solution(@_);
5757
}
5858

59-
# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it.
60-
elsif (($visualStudioVersionge'14.10')
61-
or ($visualStudioVersioneq'15.00'))
59+
# The version of nmake bundled in Visual Studio 2017 is greater
60+
# than 14.10 and less than 14.20. And the version number is
61+
# actually 15.00.
62+
elsif (
63+
($visualStudioVersionge'14.10' &&$visualStudioVersionlt'14.20')
64+
||$visualStudioVersioneq'15.00')
6265
{
6366
return new VS2017Solution(@_);
6467
}
68+
69+
# The version of nmake bundled in Visual Studio 2019 is greater
70+
# than 14.20 and less than 14.30. And the version number is
71+
# actually 16.00.
72+
elsif (
73+
($visualStudioVersionge'14.20' &&$visualStudioVersionlt'14.30')
74+
||$visualStudioVersioneq'16.00')
75+
{
76+
return new VS2019Solution(@_);
77+
}
6578
else
6679
{
67-
croak$visualStudioVersion;
68-
croak"The requested Visual Studio version is not supported.";
80+
croak
81+
"The requested Visual Studio version$visualStudioVersion is not supported.";
6982
}
7083
}
7184

@@ -103,16 +116,29 @@ sub CreateProject
103116
return new VC2015Project(@_);
104117
}
105118

106-
# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it.
107-
elsif (($visualStudioVersionge'14.10')
108-
or ($visualStudioVersioneq'15.00'))
119+
# The version of nmake bundled in Visual Studio 2017 is greater
120+
# than 14.10 and less than 14.20. And the version number is
121+
# actually 15.00.
122+
elsif (
123+
($visualStudioVersionge'14.10' &&$visualStudioVersionlt'14.20')
124+
||$visualStudioVersioneq'15.00')
109125
{
110126
return new VC2017Project(@_);
111127
}
128+
129+
# The version of nmake bundled in Visual Studio 2019 is greater
130+
# than 14.20 and less than 14.30. And the version number is
131+
# actually 16.00.
132+
elsif (
133+
($visualStudioVersionge'14.20' &&$visualStudioVersionlt'14.30')
134+
||$visualStudioVersioneq'16.00')
135+
{
136+
return new VC2019Project(@_);
137+
}
112138
else
113139
{
114-
croak$visualStudioVersion;
115-
croak"The requested Visual Studio version is not supported.";
140+
croak
141+
"The requested Visual Studio version$visualStudioVersion is not supported.";
116142
}
117143
}
118144

@@ -139,12 +165,14 @@ sub _GetVisualStudioVersion
139165
{
140166
my ($major,$minor) =@_;
141167

142-
# visual 2017 hasn't changed the nmake version to 15, so still using the older version for comparison.
143-
if ($major > 14)
168+
# The major visual studio that is supported has nmake
169+
# version <= 14.30, so stick with it as the latest version
170+
# if bumping on something even newer.
171+
if ($major >= 14 &&$minor >= 30)
144172
{
145173
carp
146174
"The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
147-
return'14.00';
175+
return'14.20';
148176
}
149177
elsif ($major < 6)
150178
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp