Manage VC[789] project files with upmake too

Update the old style MSVC project files for wxWidgets itself (but not the
samples etc) from upmake instead of bakefile too, as the latest upmake version
can handle them.
This commit is contained in:
Vadim Zeitlin 2015-01-29 00:57:52 +01:00
parent 2ee9e28fc2
commit ebd33579fd
3 changed files with 69 additions and 27 deletions

View File

@ -30,6 +30,12 @@
autoconf,borland,dmars_smake,dmars,mingw,msvc,msvc6prj,msevc4prj,msvs2003prj,msvs2005prj,msvs2008prj,watcom
</add-formats>
<!-- MSVC projects for the library itself (but not the samples etc) are now
kept up to date with upmake, not bakefile -->
<del-formats files="wx.bkl">
msvs2003prj,msvs2005prj,msvs2008prj
</del-formats>
<del-formats files="../../samples/*.bkl">
autoconf,msvc6prj,msevc4prj,msvs2003prj,msvs2005prj,msvs2008prj
</del-formats>

View File

@ -1348,53 +1348,51 @@ use Getopt::Long;
use FindBin qw($Bin);
use Text::Upmake;
use Text::Upmake::Bakefile0;
use Text::Upmake::MSBuild;
use Makefile::Update;
use Makefile::Update::Bakefile0;
use Makefile::Update::MSBuild;
use Makefile::Update::VCProj;
my $verbose = 0;
my $quiet = 0;
my ($only_bkl, $only_msbuild, $only_project, $only_version);
my ($only_bkl, $only_msvs, $only_project, $only_version);
GetOptions(
'verbose|v' => \$verbose,
'quiet|q' => \$quiet,
'only-bkl' => \$only_bkl,
'only-project=s' => sub { $only_msbuild = 1; $only_project = $_[1] },
'only-version=i' => sub { $only_msbuild = 1; $only_version = $_[1] },
'only-project=s' => sub { $only_msvs = 1; $only_project = $_[1] },
'only-version=i' => sub { $only_msvs = 1; $only_version = $_[1] },
) or die <<EOF
Usage: $0 [--verbose] [--quiet] [--only-bkl] [--only-project=<name>]
Usage: $0 [--verbose] [--quiet] [--only-bkl] [--only-project=<name>] [--only-version=<ver>]
Update the files used by bakefile and MSBuild projects from the master list
Update the files used by bakefile and MSVC projects from the master list
of files in build/files.
If --no-xxx option is specified, the corresponding outputs are not updated.
By default everything is.
The version argument of --only-version can be 7, 8, 9 or 10 with the latter
selecting the MSBuild projects.
EOF
;
if ($only_bkl && $only_msbuild) {
if ($only_bkl && $only_msvs) {
die qq{Options --only-bkl and --only-project or --only-version can't be used together.\n}
}
sub log_upmake
sub call_upmake
{
my ($fname, @args) = @_;
if (upmake($fname, @args)) {
print qq{File "$fname" successfully updated.\n} unless $quiet;
return 1;
} else {
print qq{No changes in the file "$fname".\n} if $verbose;
return 0;
}
upmake({file => $fname, quiet => $quiet, verbose => $verbose}, @args)
}
open my $files, '<', "$Bin/files";
my $vars = read_files_list($files);
if (!$only_msbuild) {
if (log_upmake("$Bin/bakefiles/files.bkl", \&update_bakefile_0, $vars)) {
if (!$only_msvs) {
if (call_upmake("$Bin/bakefiles/files.bkl", \&update_bakefile_0, $vars)) {
print qq{Don't forget to run "bakefile_gen -b wx.bkl".} if $verbose;
}
}
@ -1404,7 +1402,7 @@ if (!$only_bkl) {
# projects.
my $top_srcdir = '../../';
# The base names of all our MSBuild projects with the list of variables
# The base names of all our projects with the list of variables
# containing the files that should appear in them.
my %projects_vars = (
adv => [qw(ADVANCED_CMN ADVANCED_MSW ADVANCED_MSW_DESKTOP ADVANCED_MSW_NATIVE)],
@ -1425,6 +1423,9 @@ if (!$only_bkl) {
xrc => [qw(XRC)],
);
# The versions of non-MSBuild projects (MSBuild ones all use version "10").
my @vcproj_versions = qw(7 8 9);
# Return the "filter" to use for the given file.
sub filter_cb
{
@ -1483,7 +1484,42 @@ if (!$only_bkl) {
my @args = (\@sources, \@headers, \&filter_cb);
log_upmake("$Bin/msw/wx_${proj}.vcxproj", \&update_msbuild, @args);
log_upmake("$Bin/msw/wx_${proj}.vcxproj.filters", \&update_msbuild_filters, @args);
# First deal with MSBuild project, it's the simplest case.
if (!defined $only_version || $only_version == 10) {
call_upmake("$Bin/msw/wx_${proj}.vcxproj", \&update_msbuild, @args);
call_upmake("$Bin/msw/wx_${proj}.vcxproj.filters", \&update_msbuild_filters, @args);
}
# Pre-MSBuild projects also put this header together with all the other
# ones, so it needs to be added (with MSBuild it's a <CustomBuild>
# element and so is completely separate from the real headers that use
# <ClInclude>).
push @headers, "${top_srcdir}include/wx/msw/genrcdefs.h";
# And core project also includes all GUI headers instead of just those
# it really uses.
if ($proj eq 'core') {
foreach my $gui_proj (grep { $_ ne 'base' &&
$_ ne 'core' &&
$_ ne 'net' &&
$_ ne 'xml' } keys %projects_vars) {
foreach my $var (@{$projects_vars{$gui_proj}}) {
push @headers, "${top_srcdir}include/$_" for @{$vars->{"${var}_HDR"}};
}
}
}
# For compatibility with the existing bakefile-generated projects,
# don't include *.cpp files in the list of headers -- even these files
# are actually used as headers (i.e. they are #include'd).
if ($proj eq 'base') {
@headers = grep { $_ !~ /\.cpp$/ } @headers;
}
foreach my $ver (@vcproj_versions) {
next if defined $only_version && $ver != $only_version;
call_upmake("$Bin/msw/wx_vc${ver}_${proj}.vcproj", \&update_vcproj, @args);
}
}
}

View File

@ -15,14 +15,14 @@ use Makefile::Update::VCProj;
my $verbose = 0;
my $quiet = 0;
my ($only_bkl, $only_msbuild, $only_project, $only_version);
my ($only_bkl, $only_msvs, $only_project, $only_version);
GetOptions(
'verbose|v' => \$verbose,
'quiet|q' => \$quiet,
'only-bkl' => \$only_bkl,
'only-project=s' => sub { $only_msbuild = 1; $only_project = $_[1] },
'only-version=i' => sub { $only_msbuild = 1; $only_version = $_[1] },
'only-project=s' => sub { $only_msvs = 1; $only_project = $_[1] },
'only-version=i' => sub { $only_msvs = 1; $only_version = $_[1] },
) or die <<EOF
Usage: $0 [--verbose] [--quiet] [--only-bkl] [--only-project=<name>] [--only-version=<ver>]
@ -37,7 +37,7 @@ selecting the MSBuild projects.
EOF
;
if ($only_bkl && $only_msbuild) {
if ($only_bkl && $only_msvs) {
die qq{Options --only-bkl and --only-project or --only-version can't be used together.\n}
}
@ -51,7 +51,7 @@ sub call_upmake
open my $files, '<', "$Bin/files";
my $vars = read_files_list($files);
if (!$only_msbuild) {
if (!$only_msvs) {
if (call_upmake("$Bin/bakefiles/files.bkl", \&update_bakefile_0, $vars)) {
print qq{Don't forget to run "bakefile_gen -b wx.bkl".} if $verbose;
}