Allow older branches to be built with Visual Studio 2008. This is a backport of commi...
authorAndrew Dunstan <[email protected]>
Tue, 4 Jan 2011 21:06:51 +0000 (16:06 -0500)
committerAndrew Dunstan <[email protected]>
Tue, 4 Jan 2011 21:06:51 +0000 (16:06 -0500)
src/tools/msvc/Project.pm
src/tools/msvc/Solution.pm

index 27ac3caf04062a45fc5acc6eb87acafd7c93f409..f2e3f5fdb92275103ead6c86c481df00ac6cbd2e 100644 (file)
@@ -32,7 +32,8 @@ sub new
         defines         => ';',
         solution        => $solution,
         disablewarnings => '4018;4244;4273;4102;4090',
-        disablelinkerwarnings => ''
+        disablelinkerwarnings => '',
+        vcver           => $solution->{vcver}
     };
 
     bless $self;
@@ -456,7 +457,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 a4681aff69f4183249dd83ec1e2f2e3b50bfa145..52bb9f826f7377bc28fe49f90f7c7176c5db99a6 100644 (file)
@@ -20,6 +20,7 @@ sub new
         options  => $options,
         numver   => '',
         strver   => '',
+        vcver    => undef,
     };
     bless $self;
     if ($options->{xml})
@@ -29,9 +30,31 @@ sub new
             die "XML requires both XSLT and ICONV\n";
         }
     }
+
+       $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