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

Commitcec8394

Browse files
committed
Enable building with Visual Studion 2013.
Backpatch to 9.3.Brar Piening.
1 parent00ba973 commitcec8394

File tree

9 files changed

+140
-25
lines changed

9 files changed

+140
-25
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
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 Express2012
22+
Microsoft tools is to install <productname>Visual Studio Express2013
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, 2008 or 2010</productname>. In some cases
26-
that requires the installation of the <productname>Windows SDK</productname>
27-
in addition to the compiler.
25+
<productname>Microsoft Visual C++ 2005 to 2013</productname>.
26+
In some casesthat requires the installation of the
27+
<productname>Windows SDK</productname>in addition to the compiler.
2828
</para>
2929

3030
<para>
@@ -77,15 +77,15 @@
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 compilersin the<productname>Windows SDK 7.1</productname>
81-
or those from <productname>Visual Studio Express 2012 forWindows
82-
Desktop</productname>, which are both free downloads from Microsoft.
80+
ways are to use the compilersfrom<productname>Visual Studio Express 2013
81+
for Windows Desktop</productname> or those in the <productname>Windows SDK
82+
7.1</productname>, which are both free downloads from Microsoft.
8383
</para>
8484

8585
<para>
8686
PostgreSQL is known to support compilation using the compilers shipped with
8787
<productname>Visual Studio 2005</productname> to
88-
<productname>Visual Studio2012</productname> (including Express editions),
88+
<productname>Visual Studio2013</productname> (including Express editions),
8989
as well as standalone Windows SDK releases 6.0 to 7.1.
9090
64-bit PostgreSQL builds are only supported with
9191
<productname>Microsoft Windows SDK</productname> version 6.0a to 7.1 or

‎src/backend/utils/adt/float.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,24 @@ get_float8_infinity(void)
111111
#endif
112112
}
113113

114+
/*
115+
* The funny placements of the two #pragmas is necessary because of a
116+
* long lived bug in the Microsoft compilers.
117+
* See http://support.microsoft.com/kb/120968/en-us for details
118+
*/
119+
#if (_MSC_VER >=1800)
120+
#pragma warning(disable:4756)
121+
#endif
114122
float
115123
get_float4_infinity(void)
116124
{
117125
#ifdefINFINITY
118126
/* C99 standard way */
119127
return (float)INFINITY;
120128
#else
129+
#if (_MSC_VER >=1800)
130+
#pragma warning(default:4756)
131+
#endif
121132

122133
/*
123134
* On some platforms, HUGE_VAL is an infinity, elsewhere it's just the

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ static void print_msg(const char *msg);
135135
staticvoidadjust_data_dir(void);
136136

137137
#if defined(WIN32)|| defined(__CYGWIN__)
138+
#if (_MSC_VER >=1800)
139+
#include<versionhelpers.h>
140+
#else
141+
staticboolIsWindowsXPOrGreater(void);
142+
staticboolIsWindows7OrGreater(void);
143+
#endif
138144
staticboolpgwin32_IsInstalled(SC_HANDLE);
139145
staticchar*pgwin32_CommandLine(bool);
140146
staticvoidpgwin32_doRegister(void);
@@ -1226,6 +1232,29 @@ do_kill(pgpid_t pid)
12261232

12271233
#if defined(WIN32)|| defined(__CYGWIN__)
12281234

1235+
#if (_MSC_VER<1800)
1236+
staticbool
1237+
IsWindowsXPOrGreater(void)
1238+
{
1239+
OSVERSIONINFOosv;
1240+
osv.dwOSVersionInfoSize=sizeof(osv);
1241+
1242+
/* Windows XP = Version 5.1 */
1243+
return (!GetVersionEx(&osv)||/* could not get version */
1244+
osv.dwMajorVersion>5|| (osv.dwMajorVersion==5&&osv.dwMinorVersion >=1));
1245+
}
1246+
1247+
staticboolIsWindows7OrGreater(void)
1248+
{
1249+
OSVERSIONINFOosv;
1250+
osv.dwOSVersionInfoSize=sizeof(osv);
1251+
1252+
/* Windows 7 = Version 6.0 */
1253+
return (!GetVersionEx(&osv)||/* could not get version */
1254+
osv.dwMajorVersion>6|| (osv.dwMajorVersion==6&&osv.dwMinorVersion >=0));
1255+
}
1256+
#endif
1257+
12291258
staticbool
12301259
pgwin32_IsInstalled(SC_HANDLEhSCM)
12311260
{
@@ -1655,12 +1684,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
16551684
* IsProcessInJob() is not available on < WinXP, so there is no need
16561685
* to log the error every time in that case
16571686
*/
1658-
OSVERSIONINFOosv;
1659-
1660-
osv.dwOSVersionInfoSize=sizeof(osv);
1661-
if (!GetVersionEx(&osv)||/* could not get version */
1662-
(osv.dwMajorVersion==5&&osv.dwMinorVersion>0)||/* 5.1=xp, 5.2=2003, etc */
1663-
osv.dwMajorVersion>5)/* anything newer should have the API */
1687+
if (IsWindowsXPOrGreater())
16641688

16651689
/*
16661690
* Log error if we can't get version, or if we're on WinXP/2003 or
@@ -1692,7 +1716,6 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
16921716
JOBOBJECT_BASIC_LIMIT_INFORMATIONbasicLimit;
16931717
JOBOBJECT_BASIC_UI_RESTRICTIONSuiRestrictions;
16941718
JOBOBJECT_SECURITY_LIMIT_INFORMATIONsecurityLimit;
1695-
OSVERSIONINFOosv;
16961719

16971720
ZeroMemory(&basicLimit,sizeof(basicLimit));
16981721
ZeroMemory(&uiRestrictions,sizeof(uiRestrictions));
@@ -1708,10 +1731,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
17081731

17091732
if (as_service)
17101733
{
1711-
osv.dwOSVersionInfoSize=sizeof(osv);
1712-
if (!GetVersionEx(&osv)||
1713-
osv.dwMajorVersion<6||
1714-
(osv.dwMajorVersion==6&&osv.dwMinorVersion==0))
1734+
if (!IsWindows7OrGreater())
17151735
{
17161736
/*
17171737
* On Windows 7 (and presumably later),

‎src/include/pg_config.h.win32

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,10 @@
295295
/* #undef HAVE_READLINK */
296296

297297
/* Define to 1 if you have the `rint' function. */
298-
/*#define HAVE_RINT 1*/
298+
#if (_MSC_VER >= 1800)
299+
#define HAVE_RINT 1
300+
#endif
301+
299302

300303
/* Define to 1 if you have the global variable
301304
'rl_completion_append_character'. */

‎src/include/port/win32.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,10 @@ typedef unsigned short mode_t;
427427
#defineW_OK 2
428428
#defineR_OK 4
429429

430+
#if (_MSC_VER<1800)
430431
#defineisinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
431432
#defineisnan(x) _isnan(x)
433+
#endif
432434

433435
/* Pulled from Makefile.port in mingw */
434436
#defineDLSUFFIX ".dll"

‎src/tools/msvc/MSBuildProject.pm

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ sub _new
1818
bless($self,$classname);
1919

2020
$self->{filenameExtension} ='.vcxproj';
21+
$self->{ToolsVersion} ='4.0';
2122

2223
return$self;
2324
}
@@ -28,7 +29,7 @@ sub WriteHeader
2829

2930
print$f<<EOF;
3031
<?xml version="1.0" encoding="Windows-1252"?>
31-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
32+
<Project DefaultTargets="Build" ToolsVersion="$self->{ToolsVersion}" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3233
<ItemGroup Label="ProjectConfigurations">
3334
EOF
3435
$self->WriteConfigurationHeader($f,'Debug');
@@ -414,6 +415,7 @@ sub new
414415
bless($self,$classname);
415416

416417
$self->{vcver} ='11.00';
418+
$self->{PlatformToolset} ='v110';
417419

418420
return$self;
419421
}
@@ -434,9 +436,32 @@ sub WriteConfigurationPropertyGroup
434436
<UseOfMfc>false</UseOfMfc>
435437
<CharacterSet>MultiByte</CharacterSet>
436438
<WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization>
437-
<PlatformToolset>v110</PlatformToolset>
439+
<PlatformToolset>$self->{PlatformToolset}</PlatformToolset>
438440
</PropertyGroup>
439441
EOF
440442
}
441443

444+
packageVC2013Project;
445+
446+
#
447+
# Package that encapsulates a Visual C++ 2013 project file
448+
#
449+
450+
use strict;
451+
use warnings;
452+
use baseqw(VC2012Project);
453+
454+
subnew
455+
{
456+
my$classname =shift;
457+
my$self =$classname->SUPER::_new(@_);
458+
bless($self,$classname);
459+
460+
$self->{vcver} ='12.00';
461+
$self->{PlatformToolset} ='v120';
462+
$self->{ToolsVersion} ='12.0';
463+
464+
return$self;
465+
}
466+
442467
1;

‎src/tools/msvc/Mkvcbuild.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ sub mkvcbuild
7070
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
7171
pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c pqsignal.c
7272
qsort.c qsort_arg.c quotes.c
73-
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c
73+
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c
7474
win32env.c win32error.c win32setlocale.c);
7575

76+
push(@pgportfiles,'rint.c')if ($vsVersion <'12.00');
77+
7678
our@pgcommonallfiles =qw(
7779
exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c);
7880

‎src/tools/msvc/Solution.pm

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ sub _new
1919
options=>$options,
2020
numver=>'',
2121
strver=>'',
22+
VisualStudioVersion=>undef,
23+
MinimumVisualStudioVersion=>undef,
2224
vcver=>undef,
2325
platform=>undef, };
2426
bless($self,$classname);
@@ -59,6 +61,11 @@ sub _new
5961
return$self;
6062
}
6163

64+
subGetAdditionalHeaders
65+
{
66+
return'';
67+
}
68+
6269
subDeterminePlatform
6370
{
6471
my$self =shift;
@@ -541,6 +548,8 @@ Microsoft Visual Studio Solution File, Format Version $self->{solutionFileVersio
541548
#$self->{visualStudioName}
542549
EOF
543550

551+
print SLN$self->GetAdditionalHeaders();
552+
544553
foreachmy$fld (keys %{$self->{projects} })
545554
{
546555
foreachmy$proj (@{$self->{projects}->{$fld} })
@@ -723,4 +732,39 @@ sub new
723732
return$self;
724733
}
725734

735+
packageVS2013Solution;
736+
737+
#
738+
# Package that encapsulates a Visual Studio 2013 solution file
739+
#
740+
741+
use Carp;
742+
use strict;
743+
use warnings;
744+
use baseqw(Solution);
745+
746+
subnew
747+
{
748+
my$classname =shift;
749+
my$self =$classname->SUPER::_new(@_);
750+
bless($self,$classname);
751+
752+
$self->{solutionFileVersion} ='12.00';
753+
$self->{vcver} ='12.00';
754+
$self->{visualStudioName} ='Visual Studio 2013';
755+
$self->{VisualStudioVersion} ='12.0.21005.1',
756+
$self->{MinimumVisualStudioVersion} ='10.0.40219.1',
757+
758+
return$self;
759+
}
760+
761+
subGetAdditionalHeaders
762+
{
763+
my ($self,$f) =@_;
764+
765+
returnqq|VisualStudioVersion =$self->{VisualStudioVersion}
766+
MinimumVisualStudioVersion =$self->{MinimumVisualStudioVersion}
767+
|;
768+
}
769+
726770
1;

‎src/tools/msvc/VSObjectFactory.pm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ sub CreateSolution
4545
{
4646
return new VS2012Solution(@_);
4747
}
48+
elsif ($visualStudioVersioneq'12.00')
49+
{
50+
return new VS2013Solution(@_);
51+
}
4852
else
4953
{
5054
croak"The requested Visual Studio version is not supported.";
@@ -76,6 +80,10 @@ sub CreateProject
7680
{
7781
return new VC2012Project(@_);
7882
}
83+
elsif ($visualStudioVersioneq'12.00')
84+
{
85+
return new VC2013Project(@_);
86+
}
7987
else
8088
{
8189
croak"The requested Visual Studio version is not supported.";
@@ -115,11 +123,11 @@ sub DetermineVisualStudioVersion
115123
sub_GetVisualStudioVersion
116124
{
117125
my ($major,$minor) =@_;
118-
if ($major >11)
126+
if ($major >12)
119127
{
120128
carp
121129
"The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
122-
return'11.00';
130+
return'12.00';
123131
}
124132
elsif ($major < 6)
125133
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp