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

Commit2b1394f

Browse files
committed
Add support for Visual Studio 2019 in build scripts
This fixes at the same time a set of inconsistencies in thedocumentation and the scripts related to the versions of Windows SDKsupported.Author: Haribabu KommiReviewed-by: Andrew Dunstan, Juan José Santamaría Flecha, MichaelPaquierDiscussion:https://postgr.es/m/CAJrrPGcfqXhfPyMrny9apoDU7M1t59dzVAvoJ9AeAh5BJi+UzA@mail.gmail.com
1 parent9adda24 commit2b1394f

File tree

5 files changed

+114
-31
lines changed

5 files changed

+114
-31
lines changed

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

Lines changed: 11 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++ 2013 to2017</productname>.
25+
<productname>Microsoft Visual C++ 2013 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,31 +69,33 @@
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 2013</productname> to
81-
<productname>Visual Studio2017</productname> (including Express editions),
82-
as well as standalone Windows SDK releases6.0 to8.1.
81+
<productname>Visual Studio2019</productname> (including Express editions),
82+
as well as standalone Windows SDK releases8.1a to10.
8383
64-bit PostgreSQL builds are supported with
84-
<productname>Microsoft Windows SDK</productname> version6.0a to8.1 or
84+
<productname>Microsoft Windows SDK</productname> version8.1a to10 or
8585
<productname>Visual Studio 2013</productname> and above. Compilation
8686
is supported down to <productname>Windows 7</productname> and
8787
<productname>Windows Server 2008 R2 SP1</productname> when building with
8888
<productname>Visual Studio 2013</productname> to
89-
<productname>Visual Studio2017</productname>.
89+
<productname>Visual Studio2019</productname>.
9090
<!--
9191
For 2013 requirements:
9292
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-sysrequirements-vs
9393
For 2015 requirements:
9494
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2015-sysrequirements-vs
9595
For 2017 requirements:
9696
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2017-system-requirements-vs
97+
For 2019 requirements:
98+
https://docs.microsoft.com/en-us/visualstudio/releases/2019/system-requirements
9799
-->
98100
</para>
99101

@@ -166,7 +168,7 @@ $ENV{MSBFLAGS}="/m";
166168
If your build environment doesn't ship with a supported version of the
167169
<productname>Microsoft Windows SDK</productname> it
168170
is recommended that you upgrade to the latest version (currently
169-
version7.1), available for download from
171+
version10), available for download from
170172
<ulink url="https://www.microsoft.com/download"></ulink>.
171173
</para>
172174
<para>

‎src/tools/msvc/MSBuildProject.pm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,4 +467,29 @@ sub new
467467
return$self;
468468
}
469469

470+
packageVC2019Project;
471+
472+
#
473+
# Package that encapsulates a Visual C++ 2019 project file
474+
#
475+
476+
use strict;
477+
use warnings;
478+
use baseqw(MSBuildProject);
479+
480+
no warningsqw(redefine);## no critic
481+
482+
subnew
483+
{
484+
my$classname =shift;
485+
my$self =$classname->SUPER::_new(@_);
486+
bless($self,$classname);
487+
488+
$self->{vcver} ='16.00';
489+
$self->{PlatformToolset} ='v142';
490+
$self->{ToolsVersion} ='16.0';
491+
492+
return$self;
493+
}
494+
470495
1;

‎src/tools/msvc/README

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

@@ -16,7 +16,7 @@ has to be installed. Since this is not included in the product
1616
originally, extra steps are needed to make it work.
1717

1818
First, download and install a supported version of the Microsoft Windows SDK
19-
from www.microsoft.com (v6.0 or greater).
19+
from www.microsoft.com (v8.1a or greater).
2020

2121
Locate the files vcprojectengine.dll.express.config and
2222
vcprojectengine.dll.config in the vc\vcpackages directory of
@@ -88,11 +88,11 @@ config_default.pl to create the configuration arguments.
8888
These configuration arguments are passed over to Mkvcbuild::mkvcbuild
8989
(Mkvcbuild.pm) which creates the Visual Studio project and solution files.
9090
It does this by using VSObjectFactory::CreateSolution to create an object
91-
implementing the Solution interface (this could be eitheraVS2013Solution,
92-
or aVS2015Solutionora VS2017Solution, all in Solution.pm, depending on
93-
the user's build environment) and adding objects implementing the corresponding
94-
Project interface (VC2013Project orVC2015Project or VC2017Project from
95-
MSBuildProject.pm) to it.
91+
implementing the Solution interface (this could be either VS2013Solution,
92+
VS2015Solution, VS2017SolutionorVS2019Solution, all in Solution.pm,
93+
depending onthe user's build environment) and adding objects implementing
94+
the correspondingProject interface (VC2013Project,VC2015Project,
95+
VC2017Project or VC2019Project fromMSBuildProject.pm) to it.
9696
When Solution::Save is called, the implementations of Solution and Project
9797
save their content in the appropriate format.
9898
The final step of starting the appropriate build program (msbuild) is

‎src/tools/msvc/Solution.pm

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,34 @@ sub new
969969
return$self;
970970
}
971971

972+
packageVS2019Solution;
973+
974+
#
975+
# Package that encapsulates a Visual Studio 2019 solution file
976+
#
977+
978+
use Carp;
979+
use strict;
980+
use warnings;
981+
use baseqw(Solution);
982+
983+
no warningsqw(redefine);## no critic
984+
985+
subnew
986+
{
987+
my$classname =shift;
988+
my$self =$classname->SUPER::_new(@_);
989+
bless($self,$classname);
990+
991+
$self->{solutionFileVersion} ='12.00';
992+
$self->{vcver} ='16.00';
993+
$self->{visualStudioName} ='Visual Studio 2019';
994+
$self->{VisualStudioVersion} ='16.0.28729.10';
995+
$self->{MinimumVisualStudioVersion} ='10.0.40219.1';
996+
997+
return$self;
998+
}
999+
9721000
subGetAdditionalHeaders
9731001
{
9741002
my ($self,$f) =@_;

‎src/tools/msvc/VSObjectFactory.pm

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,29 @@ sub CreateSolution
3939
return new VS2015Solution(@_);
4040
}
4141

42-
# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it.
43-
elsif (($visualStudioVersionge'14.10')
44-
or ($visualStudioVersioneq'15.00'))
42+
# The version of nmake bundled in Visual Studio 2017 is greater
43+
# than 14.10 and less than 14.20. And the version number is
44+
# actually 15.00.
45+
elsif (
46+
($visualStudioVersionge'14.10' &&$visualStudioVersionlt'14.20')
47+
||$visualStudioVersioneq'15.00')
4548
{
4649
return new VS2017Solution(@_);
4750
}
51+
52+
# The version of nmake bundled in Visual Studio 2019 is greater
53+
# than 14.20 and less than 14.30. And the version number is
54+
# actually 16.00.
55+
elsif (
56+
($visualStudioVersionge'14.20' &&$visualStudioVersionlt'14.30')
57+
||$visualStudioVersioneq'16.00')
58+
{
59+
return new VS2019Solution(@_);
60+
}
4861
else
4962
{
50-
croak$visualStudioVersion;
51-
croak"The requested Visual Studio version is not supported.";
63+
croak
64+
"The requested Visual Studio version$visualStudioVersion is not supported.";
5265
}
5366
}
5467

@@ -70,16 +83,29 @@ sub CreateProject
7083
return new VC2015Project(@_);
7184
}
7285

73-
# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it.
74-
elsif (($visualStudioVersionge'14.10')
75-
or ($visualStudioVersioneq'15.00'))
86+
# The version of nmake bundled in Visual Studio 2017 is greater
87+
# than 14.10 and less than 14.20. And the version number is
88+
# actually 15.00.
89+
elsif (
90+
($visualStudioVersionge'14.10' &&$visualStudioVersionlt'14.20')
91+
||$visualStudioVersioneq'15.00')
7692
{
7793
return new VC2017Project(@_);
7894
}
95+
96+
# The version of nmake bundled in Visual Studio 2019 is greater
97+
# than 14.20 and less than 14.30. And the version number is
98+
# actually 16.00.
99+
elsif (
100+
($visualStudioVersionge'14.20' &&$visualStudioVersionlt'14.30')
101+
||$visualStudioVersioneq'16.00')
102+
{
103+
return new VC2019Project(@_);
104+
}
79105
else
80106
{
81-
croak$visualStudioVersion;
82-
croak"The requested Visual Studio version is not supported.";
107+
croak
108+
"The requested Visual Studio version$visualStudioVersion is not supported.";
83109
}
84110
}
85111

@@ -106,17 +132,19 @@ sub _GetVisualStudioVersion
106132
{
107133
my ($major,$minor) =@_;
108134

109-
# visual 2017 hasn't changed the nmake version to 15, so still using the older version for comparison.
110-
if ($major > 14)
135+
# The major visual studio that is supported has nmake
136+
# version <= 14.30, so stick with it as the latest version
137+
# if bumping on something even newer.
138+
if ($major >= 14 &&$minor >= 30)
111139
{
112140
carp
113141
"The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
114-
return'14.00';
142+
return'14.20';
115143
}
116-
elsif ($major <6)
144+
elsif ($major <12)
117145
{
118146
croak
119-
"Unable to determine Visual Studio version: Visual Studio versions before6.0 aren't supported.";
147+
"Unable to determine Visual Studio version: Visual Studio versions before12.0 aren't supported.";
120148
}
121149
return"$major.$minor";
122150
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp