1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Allow running src/tools/msvc/mkvcbuild.pl under not Windows

This to allow verifying the MSVC build file generation without having
to have Windows.

To do this, we avoid Windows-specific Perl modules and don't run the
"cl" compiler or "nmake".  The resulting build files won't actually be
completely correct, but it's useful enough.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/d73b2c7b-f081-8357-8422-7564d55f1aac%402ndquadrant.com
This commit is contained in:
Peter Eisentraut
2020-02-21 20:50:56 +01:00
parent f4d59369d2
commit 73c8596488
4 changed files with 37 additions and 21 deletions

View File

@ -111,21 +111,28 @@ sub CreateProject
sub DetermineVisualStudioVersion
{
# To determine version of Visual Studio we use nmake as it has
# existed for a long time and still exists in current Visual
# Studio versions.
my $output = `nmake /? 2>&1`;
$? >> 8 == 0
or croak
"Unable to determine Visual Studio version: The nmake command wasn't found.";
if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/m)
if ($^O eq "MSWin32")
{
return _GetVisualStudioVersion($1, $2);
}
# To determine version of Visual Studio we use nmake as it has
# existed for a long time and still exists in current Visual
# Studio versions.
my $output = `nmake /? 2>&1`;
$? >> 8 == 0
or croak
"Unable to determine Visual Studio version: The nmake command wasn't found.";
if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/m)
{
return _GetVisualStudioVersion($1, $2);
}
croak
"Unable to determine Visual Studio version: The nmake version could not be determined.";
croak
"Unable to determine Visual Studio version: The nmake version could not be determined.";
}
else
{
# fake version
return '16.00';
}
}
sub _GetVisualStudioVersion