instead of the nl_langinfo() result
! *
! * Visual Studio 2012 expanded the set of valid LC_CTYPE values, so have its
! * locale machinery determine the code page. See comments at IsoLocaleName().
! * For other compilers, follow the locale's predictable format.
! *
! * Returns a malloc()'d string for the caller to free.
*/
static char *
win32_langinfo(const char *ctype)
{
! char *r = NULL;
!
! #if (_MSC_VER >= 1700)
! _locale_t loct = NULL;
!
! loct = _create_locale(LC_CTYPE, ctype);
! if (loct != NULL)
! {
! r = malloc(16); /* excess */
! if (r != NULL)
! sprintf(r, "CP%u", loct->locinfo->lc_codepage);
! _free_locale(loct);
! }
! #else
char *codepage;
/*
* Locale format on Win32 is _. . For
! * example, English_United States.1252.
*/
codepage = strrchr(ctype, '.');
! if (codepage != NULL)
! {
! int ln;
!
! codepage++;
! ln = strlen(codepage);
! r = malloc(ln + 3);
! if (r != NULL)
! sprintf(r, "CP%s", codepage);
! }
! #endif
return r;
}
*** a/src/port/win32env.c
--- b/src/port/win32env.c
***************
*** 61,66 **** pgwin32_putenv(const char *envval)
--- 61,72 ----
"msvcr90", 0, NULL
}, /* Visual Studio 2008 */
{
+ "msvcr100", 0, NULL
+ }, /* Visual Studio 2010 */
+ {
+ "msvcr110", 0, NULL
+ }, /* Visual Studio 2012 */
+ {
NULL, 0, NULL
}
};
*** a/src/tools/msvc/MSBuildProject.pm
--- b/src/tools/msvc/MSBuildProject.pm
***************
*** 1,7 ****
package MSBuildProject;
#
! # Package that encapsulates a MSBuild (Visual C++ 2010) project file
#
# src/tools/msvc/MSBuildProject.pm
#
--- 1,7 ----
package MSBuildProject;
#
! # Package that encapsulates a MSBuild project file (Visual C++ 2010 or greater)
#
# src/tools/msvc/MSBuildProject.pm
#
***************
*** 397,400 **** sub new
--- 397,442 ----
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;
+ }
+
+ # This override adds the element
+ # to the PropertyGroup labeled "Configuration"
+ sub WriteConfigurationPropertyGroup
+ {
+ my ($self, $f, $cfgname, $p) = @_;
+ my $cfgtype =
+ ($self->{type} eq "exe")
+ ?'Application'
+ :($self->{type} eq "dll"?'DynamicLibrary':'StaticLibrary');
+
+ print $f <
+ $cfgtype
+ false
+ MultiByte
+ $p->{wholeopt}
+ v110
+
+ EOF
+ }
+
1;
*** a/src/tools/msvc/README
--- b/src/tools/msvc/README
***************
*** 92,101 **** These configuration arguments are passed over to Mkvcbuild::mkvcbuild
(Mkvcbuild.pm) which creates the Visual Studio project and solution files.
It does this by using VSObjectFactory::CreateSolution to create an object
implementing the Solution interface (this could be either a VS2005Solution,
! a VS2008Solution or a VS2010Solution, all in Solution.pm, depending on the
! user's build environment) and adding objects implementing the corresponding
! Project interface (VC2005Project or VC2008Project from VCBuildProject.pm or
! VC2010Project from MSBuildProject.pm) to it.
When Solution::Save is called, the implementations of Solution and Project
save their content in the appropriate format.
The final step of starting the appropriate build program (msbuild or vcbuild)
--- 92,102 ----
(Mkvcbuild.pm) which creates the Visual Studio project and solution files.
It does this by using VSObjectFactory::CreateSolution to create an object
implementing the Solution interface (this could be either a VS2005Solution,
! a VS2008Solution, a VS2010Solution or a VS2012Solution, all in Solution.pm,
! depending on the user's build environment) and adding objects implementing
! the corresponding Project interface (VC2005Project or VC2008Project from
! VCBuildProject.pm or VC2010Project or VC2012Project from MSBuildProject.pm)
! to it.
When Solution::Save is called, the implementations of Solution and Project
save their content in the appropriate format.
The final step of starting the appropriate build program (msbuild or vcbuild)
*** a/src/tools/msvc/Solution.pm
--- b/src/tools/msvc/Solution.pm
***************
*** 63,75 **** sub DeterminePlatform
{
my $self = shift;
! # Determine if we are in 32 or 64-bit mode. Do this by seeing if CL has
! # 64-bit only parameters.
$self->{platform} = 'Win32';
! open(P, "cl /? 2>NUL|") || die "cl command not found";
while ()
{
! if (/^\/favor:)
{
$self->{platform} = 'x64';
last;
--- 63,74 ----
{
my $self = shift;
! # Examine CL help output to determine if we are in 32 or 64-bit mode.
$self->{platform} = 'Win32';
! open(P, "cl /? 2>&1 |") || die "cl command not found";
while (
)
{
! if (/^\/favor:<.+AMD64/)
{
$self->{platform} = 'x64';
last;
***************
*** 700,703 **** sub new
--- 699,726 ----
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;
*** a/src/tools/msvc/VSObjectFactory.pm
--- b/src/tools/msvc/VSObjectFactory.pm
***************
*** 41,46 **** sub CreateSolution
--- 41,50 ----
{
return new VS2010Solution(@_);
}
+ elsif ($visualStudioVersion eq '11.00')
+ {
+ return new VS2012Solution(@_);
+ }
else
{
croak "The requested Visual Studio version is not supported.";
***************
*** 68,73 **** sub CreateProject
--- 72,81 ----
{
return new VC2010Project(@_);
}
+ elsif ($visualStudioVersion eq '11.00')
+ {
+ return new VC2012Project(@_);
+ }
else
{
croak "The requested Visual Studio version is not supported.";
***************
*** 82,88 **** sub DetermineVisualStudioVersion
{
# Determine version of nmake command, to set proper version of visual studio
! # we use nmake as it has existed for a long time and still exists in visual studio 2010
open(P, "nmake /? 2>&1 |")
|| croak
"Unable to determine Visual Studio version: The nmake command wasn't found.";
--- 90,96 ----
{
# Determine version of nmake command, to set proper version of visual studio
! # we use nmake as it has existed for a long time and still exists in current visual studio versions
open(P, "nmake /? 2>&1 |")
|| croak
"Unable to determine Visual Studio version: The nmake command wasn't found.";
***************
*** 107,117 **** sub DetermineVisualStudioVersion
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)
{
--- 115,125 ----
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)
{
*** a/src/tools/msvc/build.pl
--- b/src/tools/msvc/build.pl
***************
*** 50,56 **** elsif ($ARGV[0] ne "RELEASE")
# ... 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");
*** a/src/tools/msvc/gendef.pl
--- b/src/tools/msvc/gendef.pl
***************
*** 40,45 **** while (<$ARGV[0]/*.obj>)
--- 40,46 ----
next if $pieces[6] =~ /^\(/;
next if $pieces[6] =~ /^__real/;
next if $pieces[6] =~ /^__imp/;
+ next if $pieces[6] =~ /^__xmm/;
next if $pieces[6] =~ /NULL_THUNK_DATA$/;
next if $pieces[6] =~ /^__IMPORT_DESCRIPTOR/;
next if $pieces[6] =~ /^__NULL_IMPORT/;