The attached patch makes postgres build with Visual Studio 2012 RC.

As MS finally decided on the name I don't expect any need for changes for the final RTM.

I didn't bother to update the docs for now as I still have some hope that the developer community succeds in pushig M$ to reverse this decision:
http://people.planetpostgresql.org/andrew/index.php?/archives/276-Microsoft-throws-large-developer-communities-under-the-bus.html

Regards,
Brar
diff -Napcdr -x .git postgresql/src/tools/msvc/MSBuildProject.pm 
postgresql_dev/src/tools/msvc/MSBuildProject.pm
*** postgresql/src/tools/msvc/MSBuildProject.pm Tue Jan  3 15:56:06 2012
--- postgresql_dev/src/tools/msvc/MSBuildProject.pm     Wed Mar 14 23:59:07 2012
*************** sub new
*** 385,388 ****
--- 385,428 ----
      return $self;
  }
  
+ package VC2012Project;
+ 
+ #
+ # Package that encapsulates a Visual C++ 2012 project file
+ #
+ 
+ use strict;
+ use warnings;
+ use base qw(MSBuildProject);
+ 
+ sub new
+ {
+     my $classname = shift;
+     my $self = $classname->SUPER::_new(@_);
+     bless($self, $classname);
+ 
+     $self->{vcver} = '11.00';
+ 
+     return $self;
+ }
+ 
+ sub WriteConfigurationPropertyGroup
+ {
+     my ($self, $f, $cfgname, $p) = @_;
+     my $cfgtype =
+       ($self->{type} eq "exe")
+       ?'Application'
+       :($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
+ 
+     print $f <<EOF;
+   <PropertyGroup 
Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'" 
Label="Configuration">
+     <ConfigurationType>$cfgtype</ConfigurationType>
+     <UseOfMfc>false</UseOfMfc>
+     <CharacterSet>MultiByte</CharacterSet>
+     <WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization>
+     <PlatformToolset>v110</PlatformToolset>
+   </PropertyGroup>
+ EOF
+ }
+ 
  1;
diff -Napcdr -x .git postgresql/src/tools/msvc/Solution.pm 
postgresql_dev/src/tools/msvc/Solution.pm
*** postgresql/src/tools/msvc/Solution.pm       Wed Mar 14 23:14:28 2012
--- postgresql_dev/src/tools/msvc/Solution.pm   Wed Mar 14 23:58:58 2012
*************** sub new
*** 645,648 ****
--- 645,672 ----
      return $self;
  }
  
+ package VS2012Solution;
+ 
+ #
+ # Package that encapsulates a Visual Studio 2012 solution file
+ #
+ 
+ use Carp;
+ use strict;
+ use warnings;
+ use base qw(Solution);
+ 
+ sub new
+ {
+     my $classname = shift;
+     my $self = $classname->SUPER::_new(@_);
+     bless($self, $classname);
+ 
+     $self->{solutionFileVersion} = '12.00';
+     $self->{vcver} = '11.00';
+     $self->{visualStudioName} = 'Visual Studio 2012';
+ 
+     return $self;
+ }
+ 
  1;
diff -Napcdr -x .git postgresql/src/tools/msvc/VSObjectFactory.pm 
postgresql_dev/src/tools/msvc/VSObjectFactory.pm
*** postgresql/src/tools/msvc/VSObjectFactory.pm        Tue Jan  3 15:56:06 2012
--- postgresql_dev/src/tools/msvc/VSObjectFactory.pm    Wed Mar 14 23:59:03 2012
*************** sub CreateSolution
*** 41,46 ****
--- 41,50 ----
      {
          return new VS2010Solution(@_);
      }
+     elsif ($visualStudioVersion eq '11.00')
+     {
+         return new VS2012Solution(@_);
+     }
      else
      {
          croak "The requested Visual Studio version is not supported.";
*************** sub CreateProject
*** 68,73 ****
--- 72,81 ----
      {
          return new VC2010Project(@_);
      }
+     elsif ($visualStudioVersion eq '11.00')
+     {
+         return new VC2012Project(@_);
+     }
      else
      {
          croak "The requested Visual Studio version is not supported.";
*************** sub DetermineVisualStudioVersion
*** 105,115 ****
  sub _GetVisualStudioVersion
  {
      my($major, $minor) = @_;
!     if ($major > 10)
      {
          carp
  "The determined version of Visual Studio is newer than the latest supported 
version. Returning the latest supported version instead.";
!         return '10.00';
      }
      elsif ($major < 6)
      {
--- 113,123 ----
  sub _GetVisualStudioVersion
  {
      my($major, $minor) = @_;
!     if ($major > 11)
      {
          carp
  "The determined version of Visual Studio is newer than the latest supported 
version. Returning the latest supported version instead.";
!         return '11.00';
      }
      elsif ($major < 6)
      {
diff -Napcdr -x .git postgresql/src/tools/msvc/build.pl 
postgresql_dev/src/tools/msvc/build.pl
*** postgresql/src/tools/msvc/build.pl  Tue Jan  3 15:56:06 2012
--- postgresql_dev/src/tools/msvc/build.pl      Thu Mar 15 00:12:25 2012
*************** elsif ($ARGV[0] ne "RELEASE")
*** 50,56 ****
  
  # ... and do it
  
! if ($buildwhat and $vcver eq '10.00')
  {
      system("msbuild $buildwhat.vcxproj /verbosity:detailed 
/p:Configuration=$bconf");
  }
--- 50,56 ----
  
  # ... and do it
  
! if ($buildwhat and $vcver >= 10.00)
  {
      system("msbuild $buildwhat.vcxproj /verbosity:detailed 
/p:Configuration=$bconf");
  }
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to