mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Detect a 64-bit build environment on Windows, and generate the appropriate
project files. Based on the work of Tsutomu Yamada, but much refactored.
This commit is contained in:
@ -3,7 +3,7 @@ package Project;
|
||||
#
|
||||
# Package that encapsulates a Visual C++ project file generation
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/tools/msvc/Project.pm,v 1.22 2009/12/23 13:27:04 mha Exp $
|
||||
# $PostgreSQL: pgsql/src/tools/msvc/Project.pm,v 1.23 2010/01/01 17:34:25 mha Exp $
|
||||
#
|
||||
use Carp;
|
||||
use strict;
|
||||
@ -33,7 +33,8 @@ sub new
|
||||
solution => $solution,
|
||||
disablewarnings => '4018;4244;4273;4102;4090',
|
||||
disablelinkerwarnings => '',
|
||||
vcver => $solution->{vcver}
|
||||
vcver => $solution->{vcver},
|
||||
platform => $solution->{platform},
|
||||
};
|
||||
|
||||
bless $self;
|
||||
@ -391,7 +392,7 @@ EOF
|
||||
$of =~ s/\.y$/.c/;
|
||||
$of =~ s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
|
||||
print F '>'
|
||||
. GenerateCustomTool('Running bison on ' . $f,
|
||||
. $self->GenerateCustomTool('Running bison on ' . $f,
|
||||
'cmd /V:ON /c src\tools\msvc\pgbison.bat ' . $f, $of)
|
||||
. '</File>' . "\n";
|
||||
}
|
||||
@ -400,7 +401,7 @@ EOF
|
||||
my $of = $f;
|
||||
$of =~ s/\.l$/.c/;
|
||||
print F '>'
|
||||
. GenerateCustomTool('Running flex on ' . $f, 'src\tools\msvc\pgflex.bat ' . $f,$of)
|
||||
. $self->GenerateCustomTool('Running flex on ' . $f, 'src\tools\msvc\pgflex.bat ' . $f,$of)
|
||||
. '</File>' . "\n";
|
||||
}
|
||||
elsif (defined($uniquefiles{$file}))
|
||||
@ -410,8 +411,8 @@ EOF
|
||||
my $obj = $dir;
|
||||
$obj =~ s/\\/_/g;
|
||||
print F
|
||||
"><FileConfiguration Name=\"Debug|Win32\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
|
||||
. "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|Win32\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
|
||||
"><FileConfiguration Name=\"Debug|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
|
||||
. "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
|
||||
. "_$file.obj\" /></FileConfiguration></File>\n";
|
||||
}
|
||||
else
|
||||
@ -431,14 +432,14 @@ EOF
|
||||
|
||||
sub GenerateCustomTool
|
||||
{
|
||||
my ($desc, $tool, $output, $cfg) = @_;
|
||||
my ($self, $desc, $tool, $output, $cfg) = @_;
|
||||
if (!defined($cfg))
|
||||
{
|
||||
return GenerateCustomTool($desc, $tool, $output, 'Debug')
|
||||
.GenerateCustomTool($desc, $tool, $output, 'Release');
|
||||
return $self->GenerateCustomTool($desc, $tool, $output, 'Debug') .
|
||||
$self->GenerateCustomTool($desc, $tool, $output, 'Release');
|
||||
}
|
||||
return
|
||||
"<FileConfiguration Name=\"$cfg|Win32\"><Tool Name=\"VCCustomBuildTool\" Description=\"$desc\" CommandLine=\"$tool\" AdditionalDependencies=\"\" Outputs=\"$output\" /></FileConfiguration>";
|
||||
"<FileConfiguration Name=\"$cfg|$self->{platform}\"><Tool Name=\"VCCustomBuildTool\" Description=\"$desc\" CommandLine=\"$tool\" AdditionalDependencies=\"\" Outputs=\"$output\" /></FileConfiguration>";
|
||||
}
|
||||
|
||||
sub WriteReferences
|
||||
@ -460,7 +461,7 @@ sub WriteHeader
|
||||
print $f <<EOF;
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject ProjectType="Visual C++" Version="$self->{vcver}" Name="$self->{name}" ProjectGUID="$self->{guid}">
|
||||
<Platforms><Platform Name="Win32"/></Platforms>
|
||||
<Platforms><Platform Name="$self->{platform}"/></Platforms>
|
||||
<Configurations>
|
||||
EOF
|
||||
$self->WriteConfiguration($f, 'Debug',
|
||||
@ -493,8 +494,9 @@ sub WriteConfiguration
|
||||
}
|
||||
$libs =~ s/ $//;
|
||||
$libs =~ s/__CFGNAME__/$cfgname/g;
|
||||
my $targetmachine = $self->{platform} eq 'Win32' ? 1 : 17;
|
||||
print $f <<EOF;
|
||||
<Configuration Name="$cfgname|Win32" OutputDirectory=".\\$cfgname\\$self->{name}" IntermediateDirectory=".\\$cfgname\\$self->{name}"
|
||||
<Configuration Name="$cfgname|$self->{platform}" OutputDirectory=".\\$cfgname\\$self->{name}" IntermediateDirectory=".\\$cfgname\\$self->{name}"
|
||||
ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2" WholeProgramOptimization="$p->{wholeopt}">
|
||||
<Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"
|
||||
AdditionalIncludeDirectories="$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{includes}"
|
||||
@ -513,7 +515,7 @@ EOF
|
||||
StackReserveSize="4194304" DisableSpecificWarnings="$self->{disablewarnings}"
|
||||
GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\\$cfgname\\$self->{name}\\$self->{name}.pdb"
|
||||
GenerateMapFile="FALSE" MapFileName=".\\$cfgname\\$self->{name}\\$self->{name}.map"
|
||||
SubSystem="1" TargetMachine="1"
|
||||
SubSystem="1" TargetMachine="$targetmachine"
|
||||
EOF
|
||||
if ($self->{disablelinkerwarnings})
|
||||
{
|
||||
@ -540,7 +542,7 @@ EOF
|
||||
if ($self->{builddef})
|
||||
{
|
||||
print $f
|
||||
"\t<Tool Name=\"VCPreLinkEventTool\" Description=\"Generate DEF file\" CommandLine=\"perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name}\" />\n";
|
||||
"\t<Tool Name=\"VCPreLinkEventTool\" Description=\"Generate DEF file\" CommandLine=\"perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}\" />\n";
|
||||
}
|
||||
print $f <<EOF;
|
||||
</Configuration>
|
||||
|
Reference in New Issue
Block a user