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:
@ -60,10 +60,17 @@ sub DeterminePlatform
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
# Examine CL help output to determine if we are in 32 or 64-bit mode.
|
||||
my $output = `cl /? 2>&1`;
|
||||
$? >> 8 == 0 or die "cl command not found";
|
||||
$self->{platform} = ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32';
|
||||
if ($^O eq "MSWin32")
|
||||
{
|
||||
# Examine CL help output to determine if we are in 32 or 64-bit mode.
|
||||
my $output = `cl /? 2>&1`;
|
||||
$? >> 8 == 0 or die "cl command not found";
|
||||
$self->{platform} = ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32';
|
||||
}
|
||||
else
|
||||
{
|
||||
$self->{platform} = 'FAKE';
|
||||
}
|
||||
print "Detected hardware platform: $self->{platform}\n";
|
||||
return;
|
||||
}
|
||||
@ -1061,7 +1068,7 @@ EOF
|
||||
}
|
||||
if ($fld ne "")
|
||||
{
|
||||
$flduid{$fld} = Win32::GuidGen();
|
||||
$flduid{$fld} = $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE';
|
||||
print $sln <<EOF;
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "$fld", "$fld", "$flduid{$fld}"
|
||||
EndProject
|
||||
|
Reference in New Issue
Block a user