aboutsummaryrefslogtreecommitdiff
path: root/src/tools/msvc/VSObjectFactory.pm
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-02-21 20:50:56 +0100
committerPeter Eisentraut <peter@eisentraut.org>2020-02-21 20:57:43 +0100
commit73c8596488fd5fd619991f56dae5d22f551b06d9 (patch)
tree5769a86820cac42dcc79687d6b75fe463580b417 /src/tools/msvc/VSObjectFactory.pm
parentf4d59369d2ddf0ad7850112752ec42fd115825d4 (diff)
downloadpostgresql-73c8596488fd5fd619991f56dae5d22f551b06d9.tar.gz
postgresql-73c8596488fd5fd619991f56dae5d22f551b06d9.zip
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
Diffstat (limited to 'src/tools/msvc/VSObjectFactory.pm')
-rw-r--r--src/tools/msvc/VSObjectFactory.pm31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/tools/msvc/VSObjectFactory.pm b/src/tools/msvc/VSObjectFactory.pm
index 610dc612866..e6983b241fb 100644
--- a/src/tools/msvc/VSObjectFactory.pm
+++ b/src/tools/msvc/VSObjectFactory.pm
@@ -111,21 +111,28 @@ sub CreateProject
sub DetermineVisualStudioVersion
{
+ if ($^O eq "MSWin32")
+ {
+ # 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);
+ }
- # 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)
+ croak
+ "Unable to determine Visual Studio version: The nmake version could not be determined.";
+ }
+ else
{
- return _GetVisualStudioVersion($1, $2);
+ # fake version
+ return '16.00';
}
-
- croak
- "Unable to determine Visual Studio version: The nmake version could not be determined.";
}
sub _GetVisualStudioVersion