Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
cec8394b
Commit
cec8394b
authored
Jan 26, 2014
by
Andrew Dunstan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable building with Visual Studion 2013.
Backpatch to 9.3. Brar Piening.
parent
00ba9736
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
140 additions
and
25 deletions
+140
-25
doc/src/sgml/install-windows.sgml
doc/src/sgml/install-windows.sgml
+8
-8
src/backend/utils/adt/float.c
src/backend/utils/adt/float.c
+11
-0
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_ctl/pg_ctl.c
+31
-11
src/include/pg_config.h.win32
src/include/pg_config.h.win32
+4
-1
src/include/port/win32.h
src/include/port/win32.h
+2
-0
src/tools/msvc/MSBuildProject.pm
src/tools/msvc/MSBuildProject.pm
+27
-2
src/tools/msvc/Mkvcbuild.pm
src/tools/msvc/Mkvcbuild.pm
+3
-1
src/tools/msvc/Solution.pm
src/tools/msvc/Solution.pm
+44
-0
src/tools/msvc/VSObjectFactory.pm
src/tools/msvc/VSObjectFactory.pm
+10
-2
No files found.
doc/src/sgml/install-windows.sgml
View file @
cec8394b
...
@@ -19,12 +19,12 @@
...
@@ -19,12 +19,12 @@
<para>
<para>
There are several different ways of building PostgreSQL on
There are several different ways of building PostgreSQL on
<productname>Windows</productname>. The simplest way to build with
<productname>Windows</productname>. The simplest way to build with
Microsoft tools is to install <productname>Visual Studio Express 201
2
Microsoft tools is to install <productname>Visual Studio Express 201
3
for Windows Desktop</productname> and use the included
for Windows Desktop</productname> and use the included
compiler. It is also possible to build with the full
compiler. It is also possible to build with the full
<productname>Microsoft Visual C++ 2005
, 2008 or 2010</productname>. In some cases
<productname>Microsoft Visual C++ 2005
to 2013</productname>.
that requires the installation of the <productname>Windows SDK</productname>
In some cases that requires the installation of the
in addition to the compiler.
<productname>Windows SDK</productname>
in addition to the compiler.
</para>
</para>
<para>
<para>
...
@@ -77,15 +77,15 @@
...
@@ -77,15 +77,15 @@
<productname>Visual Studio Express</productname> or some versions of the
<productname>Visual Studio Express</productname> or some versions of the
<productname>Microsoft Windows SDK</productname>. If you do not already have a
<productname>Microsoft Windows SDK</productname>. If you do not already have a
<productname>Visual Studio</productname> environment set up, the easiest
<productname>Visual Studio</productname> environment set up, the easiest
ways are to use the compilers
in the <productname>Windows SDK 7.1</productname>
ways are to use the compilers
from <productname>Visual Studio Express 2013
or those from <productname>Visual Studio Express 2012 for Windows
for Windows Desktop</productname> or those in the <productname>Windows SDK
Desktop
</productname>, which are both free downloads from Microsoft.
7.1
</productname>, which are both free downloads from Microsoft.
</para>
</para>
<para>
<para>
PostgreSQL is known to support compilation using the compilers shipped with
PostgreSQL is known to support compilation using the compilers shipped with
<productname>Visual Studio 2005</productname> to
<productname>Visual Studio 2005</productname> to
<productname>Visual Studio 201
2
</productname> (including Express editions),
<productname>Visual Studio 201
3
</productname> (including Express editions),
as well as standalone Windows SDK releases 6.0 to 7.1.
as well as standalone Windows SDK releases 6.0 to 7.1.
64-bit PostgreSQL builds are only supported with
64-bit PostgreSQL builds are only supported with
<productname>Microsoft Windows SDK</productname> version 6.0a to 7.1 or
<productname>Microsoft Windows SDK</productname> version 6.0a to 7.1 or
...
...
src/backend/utils/adt/float.c
View file @
cec8394b
...
@@ -111,6 +111,14 @@ get_float8_infinity(void)
...
@@ -111,6 +111,14 @@ get_float8_infinity(void)
#endif
#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
float
get_float4_infinity
(
void
)
get_float4_infinity
(
void
)
{
{
...
@@ -118,6 +126,9 @@ get_float4_infinity(void)
...
@@ -118,6 +126,9 @@ get_float4_infinity(void)
/* C99 standard way */
/* C99 standard way */
return
(
float
)
INFINITY
;
return
(
float
)
INFINITY
;
#else
#else
#if (_MSC_VER >= 1800)
#pragma warning(default:4756)
#endif
/*
/*
* On some platforms, HUGE_VAL is an infinity, elsewhere it's just the
* On some platforms, HUGE_VAL is an infinity, elsewhere it's just the
...
...
src/bin/pg_ctl/pg_ctl.c
View file @
cec8394b
...
@@ -135,6 +135,12 @@ static void print_msg(const char *msg);
...
@@ -135,6 +135,12 @@ static void print_msg(const char *msg);
static
void
adjust_data_dir
(
void
);
static
void
adjust_data_dir
(
void
);
#if defined(WIN32) || defined(__CYGWIN__)
#if defined(WIN32) || defined(__CYGWIN__)
#if (_MSC_VER >= 1800)
#include <versionhelpers.h>
#else
static
bool
IsWindowsXPOrGreater
(
void
);
static
bool
IsWindows7OrGreater
(
void
);
#endif
static
bool
pgwin32_IsInstalled
(
SC_HANDLE
);
static
bool
pgwin32_IsInstalled
(
SC_HANDLE
);
static
char
*
pgwin32_CommandLine
(
bool
);
static
char
*
pgwin32_CommandLine
(
bool
);
static
void
pgwin32_doRegister
(
void
);
static
void
pgwin32_doRegister
(
void
);
...
@@ -1226,6 +1232,29 @@ do_kill(pgpid_t pid)
...
@@ -1226,6 +1232,29 @@ do_kill(pgpid_t pid)
#if defined(WIN32) || defined(__CYGWIN__)
#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
static
bool
pgwin32_IsInstalled
(
SC_HANDLE
hSCM
)
pgwin32_IsInstalled
(
SC_HANDLE
hSCM
)
{
{
...
@@ -1655,12 +1684,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
...
@@ -1655,12 +1684,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
* IsProcessInJob() is not available on < WinXP, so there is no need
* IsProcessInJob() is not available on < WinXP, so there is no need
* to log the error every time in that case
* to log the error every time in that case
*/
*/
OSVERSIONINFO
osv
;
if
(
IsWindowsXPOrGreater
())
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 */
/*
/*
* Log error if we can't get version, or if we're on WinXP/2003 or
* 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
...
@@ -1692,7 +1716,6 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
JOBOBJECT_BASIC_LIMIT_INFORMATION
basicLimit
;
JOBOBJECT_BASIC_LIMIT_INFORMATION
basicLimit
;
JOBOBJECT_BASIC_UI_RESTRICTIONS
uiRestrictions
;
JOBOBJECT_BASIC_UI_RESTRICTIONS
uiRestrictions
;
JOBOBJECT_SECURITY_LIMIT_INFORMATION
securityLimit
;
JOBOBJECT_SECURITY_LIMIT_INFORMATION
securityLimit
;
OSVERSIONINFO
osv
;
ZeroMemory
(
&
basicLimit
,
sizeof
(
basicLimit
));
ZeroMemory
(
&
basicLimit
,
sizeof
(
basicLimit
));
ZeroMemory
(
&
uiRestrictions
,
sizeof
(
uiRestrictions
));
ZeroMemory
(
&
uiRestrictions
,
sizeof
(
uiRestrictions
));
...
@@ -1708,10 +1731,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
...
@@ -1708,10 +1731,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
if
(
as_service
)
if
(
as_service
)
{
{
osv
.
dwOSVersionInfoSize
=
sizeof
(
osv
);
if
(
!
IsWindows7OrGreater
())
if
(
!
GetVersionEx
(
&
osv
)
||
osv
.
dwMajorVersion
<
6
||
(
osv
.
dwMajorVersion
==
6
&&
osv
.
dwMinorVersion
==
0
))
{
{
/*
/*
* On Windows 7 (and presumably later),
* On Windows 7 (and presumably later),
...
...
src/include/pg_config.h.win32
View file @
cec8394b
...
@@ -295,7 +295,10 @@
...
@@ -295,7 +295,10 @@
/* #undef HAVE_READLINK */
/* #undef HAVE_READLINK */
/* Define to 1 if you have the `rint' function. */
/* Define to 1 if you have the `rint' function. */
/*#define HAVE_RINT 1*/
#if (_MSC_VER >= 1800)
#define HAVE_RINT 1
#endif
/* Define to 1 if you have the global variable
/* Define to 1 if you have the global variable
'rl_completion_append_character'. */
'rl_completion_append_character'. */
...
...
src/include/port/win32.h
View file @
cec8394b
...
@@ -427,8 +427,10 @@ typedef unsigned short mode_t;
...
@@ -427,8 +427,10 @@ typedef unsigned short mode_t;
#define W_OK 2
#define W_OK 2
#define R_OK 4
#define R_OK 4
#if (_MSC_VER < 1800)
#define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
#define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
#define isnan(x) _isnan(x)
#define isnan(x) _isnan(x)
#endif
/* Pulled from Makefile.port in mingw */
/* Pulled from Makefile.port in mingw */
#define DLSUFFIX ".dll"
#define DLSUFFIX ".dll"
...
...
src/tools/msvc/MSBuildProject.pm
View file @
cec8394b
...
@@ -18,6 +18,7 @@ sub _new
...
@@ -18,6 +18,7 @@ sub _new
bless
(
$self
,
$classname
);
bless
(
$self
,
$classname
);
$self
->
{
filenameExtension
}
=
'
.vcxproj
';
$self
->
{
filenameExtension
}
=
'
.vcxproj
';
$self
->
{
ToolsVersion
}
=
'
4.0
';
return
$self
;
return
$self
;
}
}
...
@@ -28,7 +29,7 @@ sub WriteHeader
...
@@ -28,7 +29,7 @@ sub WriteHeader
print
$f
<<EOF;
print
$f
<<EOF;
<?xml version="1.0" encoding="Windows-1252"?>
<?xml version="1.0" encoding="Windows-1252"?>
<Project DefaultTargets="Build" ToolsVersion="
4.0
" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="
$self->{ToolsVersion}
" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ItemGroup Label="ProjectConfigurations">
EOF
EOF
$self
->
WriteConfigurationHeader
(
$f
,
'
Debug
');
$self
->
WriteConfigurationHeader
(
$f
,
'
Debug
');
...
@@ -414,6 +415,7 @@ sub new
...
@@ -414,6 +415,7 @@ sub new
bless
(
$self
,
$classname
);
bless
(
$self
,
$classname
);
$self
->
{
vcver
}
=
'
11.00
';
$self
->
{
vcver
}
=
'
11.00
';
$self
->
{
PlatformToolset
}
=
'
v110
';
return
$self
;
return
$self
;
}
}
...
@@ -434,9 +436,32 @@ sub WriteConfigurationPropertyGroup
...
@@ -434,9 +436,32 @@ sub WriteConfigurationPropertyGroup
<UseOfMfc>false</UseOfMfc>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization>
<WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization>
<PlatformToolset>
v110
</PlatformToolset>
<PlatformToolset>
$self->{PlatformToolset}
</PlatformToolset>
</PropertyGroup>
</PropertyGroup>
EOF
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
;
1
;
src/tools/msvc/Mkvcbuild.pm
View file @
cec8394b
...
@@ -70,9 +70,11 @@ sub mkvcbuild
...
@@ -70,9 +70,11 @@ sub mkvcbuild
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c pqsignal.c
pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c pqsignal.c
qsort.c qsort_arg.c quotes.c
qsort.c qsort_arg.c quotes.c
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c
rint.c
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c
win32env.c win32error.c win32setlocale.c)
;
win32env.c win32error.c win32setlocale.c)
;
push
(
@pgportfiles
,
'
rint.c
')
if
(
$vsVersion
<
'
12.00
');
our
@pgcommonallfiles
=
qw(
our
@pgcommonallfiles
=
qw(
exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c)
;
exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c)
;
...
...
src/tools/msvc/Solution.pm
View file @
cec8394b
...
@@ -19,6 +19,8 @@ sub _new
...
@@ -19,6 +19,8 @@ sub _new
options
=>
$options
,
options
=>
$options
,
numver
=>
'',
numver
=>
'',
strver
=>
'',
strver
=>
'',
VisualStudioVersion
=>
undef
,
MinimumVisualStudioVersion
=>
undef
,
vcver
=>
undef
,
vcver
=>
undef
,
platform
=>
undef
,
};
platform
=>
undef
,
};
bless
(
$self
,
$classname
);
bless
(
$self
,
$classname
);
...
@@ -59,6 +61,11 @@ sub _new
...
@@ -59,6 +61,11 @@ sub _new
return
$self
;
return
$self
;
}
}
sub
GetAdditionalHeaders
{
return
'';
}
sub
DeterminePlatform
sub
DeterminePlatform
{
{
my
$self
=
shift
;
my
$self
=
shift
;
...
@@ -541,6 +548,8 @@ Microsoft Visual Studio Solution File, Format Version $self->{solutionFileVersio
...
@@ -541,6 +548,8 @@ Microsoft Visual Studio Solution File, Format Version $self->{solutionFileVersio
# $self->{visualStudioName}
# $self->{visualStudioName}
EOF
EOF
print
SLN
$self
->
GetAdditionalHeaders
();
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}
})
foreach
my
$fld
(
keys
%
{
$self
->
{
projects
}
})
{
{
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}
})
foreach
my
$proj
(
@
{
$self
->
{
projects
}
->
{
$fld
}
})
...
@@ -723,4 +732,39 @@ sub new
...
@@ -723,4 +732,39 @@ sub new
return
$self
;
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
;
1
;
src/tools/msvc/VSObjectFactory.pm
View file @
cec8394b
...
@@ -45,6 +45,10 @@ sub CreateSolution
...
@@ -45,6 +45,10 @@ sub CreateSolution
{
{
return
new
VS2012Solution
(
@_
);
return
new
VS2012Solution
(
@_
);
}
}
elsif
(
$visualStudioVersion
eq
'
12.00
')
{
return
new
VS2013Solution
(
@_
);
}
else
else
{
{
croak
"
The requested Visual Studio version is not supported.
";
croak
"
The requested Visual Studio version is not supported.
";
...
@@ -76,6 +80,10 @@ sub CreateProject
...
@@ -76,6 +80,10 @@ sub CreateProject
{
{
return
new
VC2012Project
(
@_
);
return
new
VC2012Project
(
@_
);
}
}
elsif
(
$visualStudioVersion
eq
'
12.00
')
{
return
new
VC2013Project
(
@_
);
}
else
else
{
{
croak
"
The requested Visual Studio version is not supported.
";
croak
"
The requested Visual Studio version is not supported.
";
...
@@ -115,11 +123,11 @@ sub DetermineVisualStudioVersion
...
@@ -115,11 +123,11 @@ sub DetermineVisualStudioVersion
sub
_GetVisualStudioVersion
sub
_GetVisualStudioVersion
{
{
my
(
$major
,
$minor
)
=
@_
;
my
(
$major
,
$minor
)
=
@_
;
if
(
$major
>
1
1
)
if
(
$major
>
1
2
)
{
{
carp
carp
"
The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.
";
"
The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.
";
return
'
1
1
.00
';
return
'
1
2
.00
';
}
}
elsif
(
$major
<
6
)
elsif
(
$major
<
6
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment