]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Allow older branches to be built with Visual Studio 2008. This is a backport of commi...
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 4 Jan 2011 21:07:05 +0000 (16:07 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 4 Jan 2011 21:07:05 +0000 (16:07 -0500)
src/tools/msvc/Project.pm
src/tools/msvc/Solution.pm

index fa466c798827a62d02a90fe0d1ff99c3e85161ab..3d09e6433020de32d1548780fe615c38f63ec7c0 100644 (file)
@@ -24,6 +24,7 @@ sub new {
         defines         => ';',
                solution        => $solution,
         disablewarnings => '4018;4244',
+               vcver           => $solution->{vcver}
     };
 
        bless $self;
@@ -337,7 +338,7 @@ sub WriteHeader {
 
        print $f <<EOF;
 <?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject ProjectType="Visual C++" Version="8.00" Name="$self->{name}" ProjectGUID="$self->{guid}">
+<VisualStudioProject ProjectType="Visual C++" Version="$self->{vcver}" Name="$self->{name}" ProjectGUID="$self->{guid}">
  <Platforms><Platform Name="Win32"/></Platforms>
  <Configurations>
 EOF
index 3431ca2e6df7d8b0edaa0363062e1e507f8aa145..6a30253ab2e41481652277fa5975f4bf23b8db7b 100644 (file)
@@ -12,11 +12,34 @@ sub new {
         options  => $options,
         numver   => '',
         strver   => '',
+        vcver    => undef,
     };
        bless $self;
-       return $self;
+
+       $self->DetermineToolVersions();
+
+     return $self;
+ }
+sub DetermineToolVersions
+{
+    my $self = shift;
+
+       # Determine version of vcbuild command, to set proper verison of visual studio
+    open(P,"vcbuild /? |") || die "vcbuild command not found";
+    my $line = <P>;
+    close(P);
+    if ($line !~ /^Microsoft \(R\) Visual C\+\+ Project Builder - Command Line Version (\d+)\.00\.\d+/) 
+       {
+       die "Unable to determine vcbuild version from first line of output!";
+    }
+    if ($1 == 8) { $self->{vcver} = '8.00' }
+    elsif ($1 == 9) { $self->{vcver} = '9.00' }
+    else { die "Unsupported version of Visual Studio: $1" }
+    print "Detected Visual Studio version $self->{vcver}\n";
 }
 
+
 # Return 1 if $oldfile is newer than $newfile, or if $newfile doesn't exist.
 # Special case - if config.pl has changed, always return 1
 sub IsNewer {