There are several different ways of building PostgreSQL on
Windows. The simplest way to build with
- Microsoft tools is to install
Visual Studio Express 2012
+ Microsoft tools is to install
Visual Studio Express 2013
for Windows Desktop and use the included
compiler. It is also possible to build with the full
-
Microsoft Visual C++ 2005, 2008 or 2010. In some cases
- that requires the installation of the
Windows SDK
- in addition to the compiler.
+
Microsoft Visual C++ 2005 to 2013.
+ In some cases that requires the installation of the
+
Windows SDK in addition to the compiler.
Visual Studio Express or some versions of the
Microsoft Windows SDK. If you do not already have a
Visual Studio environment set up, the easiest
- ways are to use the compilers
in the Windows SDK 7.1
- or those from
Visual Studio Express 2012 for Windows
- Desktop, which are both free downloads from Microsoft.
+ ways are to use the compilers
from Visual Studio Express 2013
+ for Windows Desktop or those in the
Windows SDK
+ 7.1, which are both free downloads from Microsoft.
PostgreSQL is known to support compilation using the compilers shipped with
-
Visual Studio 2012 (including Express editions),
+
Visual Studio 2013 (including Express editions),
as well as standalone Windows SDK releases 6.0 to 7.1.
64-bit PostgreSQL builds are only supported with
Microsoft Windows SDK version 6.0a to 7.1 or
#endif
}
+/*
+* The funny placements of the two #pragmas is necessary because of a
+* long lived bug in the Microsoft compilers.
+* See http://support.microsoft.com/kb/120968/en-us for details
+*/
+#if (_MSC_VER >= 1800)
+#pragma warning(disable:4756)
+#endif
float
get_float4_infinity(void)
{
/* C99 standard way */
return (float) INFINITY;
#else
+#if (_MSC_VER >= 1800)
+#pragma warning(default:4756)
+#endif
/*
* On some platforms, HUGE_VAL is an infinity, elsewhere it's just the
static void adjust_data_dir(void);
#if defined(WIN32) || defined(__CYGWIN__)
+#if (_MSC_VER >= 1800)
+#include
+#else
+static bool IsWindowsXPOrGreater(void);
+static bool IsWindows7OrGreater(void);
+#endif
static bool pgwin32_IsInstalled(SC_HANDLE);
static char *pgwin32_CommandLine(bool);
static void pgwin32_doRegister(void);
#if defined(WIN32) || defined(__CYGWIN__)
+#if (_MSC_VER < 1800)
+static bool
+IsWindowsXPOrGreater(void)
+{
+ OSVERSIONINFO osv;
+ osv.dwOSVersionInfoSize = sizeof(osv);
+
+ /* Windows XP = Version 5.1 */
+ return (!GetVersionEx(&osv) || /* could not get version */
+ osv.dwMajorVersion > 5 || (osv.dwMajorVersion == 5 && osv.dwMinorVersion >= 1));
+}
+
+static bool IsWindows7OrGreater(void)
+{
+ OSVERSIONINFO osv;
+ osv.dwOSVersionInfoSize = sizeof(osv);
+
+ /* Windows 7 = Version 6.0 */
+ return (!GetVersionEx(&osv) || /* could not get version */
+ osv.dwMajorVersion > 6 || (osv.dwMajorVersion == 6 && osv.dwMinorVersion >= 0));
+}
+#endif
+
static bool
pgwin32_IsInstalled(SC_HANDLE hSCM)
{
* IsProcessInJob() is not available on < WinXP, so there is no need
* to log the error every time in that case
*/
- OSVERSIONINFO osv;
-
- osv.dwOSVersionInfoSize = sizeof(osv);
- if (!GetVersionEx(&osv) || /* could not get version */
- (osv.dwMajorVersion == 5 && osv.dwMinorVersion > 0) || /* 5.1=xp, 5.2=2003, etc */
- osv.dwMajorVersion > 5) /* anything newer should have the API */
+ if (IsWindowsXPOrGreater())
/*
* Log error if we can't get version, or if we're on WinXP/2003 or
JOBOBJECT_BASIC_LIMIT_INFORMATION basicLimit;
JOBOBJECT_BASIC_UI_RESTRICTIONS uiRestrictions;
JOBOBJECT_SECURITY_LIMIT_INFORMATION securityLimit;
- OSVERSIONINFO osv;
ZeroMemory(&basicLimit, sizeof(basicLimit));
ZeroMemory(&uiRestrictions, sizeof(uiRestrictions));
if (as_service)
{
- osv.dwOSVersionInfoSize = sizeof(osv);
- if (!GetVersionEx(&osv) ||
- osv.dwMajorVersion < 6 ||
- (osv.dwMajorVersion == 6 && osv.dwMinorVersion == 0))
+ if (!IsWindows7OrGreater())
{
/*
* On Windows 7 (and presumably later),
bless($self, $classname);
$self->{filenameExtension} = '.vcxproj';
+ $self->{ToolsVersion} = '4.0';
return $self;
}
print $f <
-
4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
$self->{ToolsVersion}" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
EOF
$self->WriteConfigurationHeader($f, 'Debug');
bless($self, $classname);
$self->{vcver} = '11.00';
+ $self->{PlatformToolset} = 'v110';
return $self;
}
false
MultiByte
$p->{wholeopt}
+
$self->{PlatformToolset}
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;
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c exec.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 wait_error.c getopt.c getopt_long.c dirent.c rint.c win32env.c
- win32error.c win32setlocale.c);
+ sprompt.c tar.c thread.c wait_error.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(
relpath.c);
options => $options,
numver => '',
strver => '',
+ VisualStudioVersion => undef,
+ MinimumVisualStudioVersion => undef,
vcver => undef,
platform => undef, };
bless($self, $classname);
return $self;
}
+sub GetAdditionalHeaders
+{
+ return '';
+}
+
sub DeterminePlatform
{
my $self = shift;
# $self->{visualStudioName}
EOF
+ print SLN $self->GetAdditionalHeaders();
+
foreach my $fld (keys %{ $self->{projects} })
{
foreach my $proj (@{ $self->{projects}->{$fld} })
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;
{
return new VS2012Solution(@_);
}
+ elsif ($visualStudioVersion eq '12.00')
+ {
+ return new VS2013Solution(@_);
+ }
else
{
croak "The requested Visual Studio version is not supported.";
{
return new VC2012Project(@_);
}
+ elsif ($visualStudioVersion eq '12.00')
+ {
+ return new VC2013Project(@_);
+ }
else
{
croak "The requested Visual Studio version is not supported.";
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)
{