From ebd33579fd0f2278d16e83ad6b420a3d496518e6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 29 Jan 2015 00:57:52 +0100 Subject: [PATCH] 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. --- build/bakefiles/Bakefiles.bkgen | 6 +++ build/upmake | 80 ++++++++++++++++++++++++--------- build/upmake_script.pl | 10 ++--- 3 files changed, 69 insertions(+), 27 deletions(-) diff --git a/build/bakefiles/Bakefiles.bkgen b/build/bakefiles/Bakefiles.bkgen index fe3aed1634..f0bcd7141d 100644 --- a/build/bakefiles/Bakefiles.bkgen +++ b/build/bakefiles/Bakefiles.bkgen @@ -30,6 +30,12 @@ autoconf,borland,dmars_smake,dmars,mingw,msvc,msvc6prj,msevc4prj,msvs2003prj,msvs2005prj,msvs2008prj,watcom + + + msvs2003prj,msvs2005prj,msvs2008prj + + autoconf,msvc6prj,msevc4prj,msvs2003prj,msvs2005prj,msvs2008prj diff --git a/build/upmake b/build/upmake index 577acb1d48..86f1cc7b81 100755 --- a/build/upmake +++ b/build/upmake @@ -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 <] +Usage: $0 [--verbose] [--quiet] [--only-bkl] [--only-project=] [--only-version=] -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 + # element and so is completely separate from the real headers that use + # ). + 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); + } } } diff --git a/build/upmake_script.pl b/build/upmake_script.pl index edd0005ee6..8f06ac7dcb 100755 --- a/build/upmake_script.pl +++ b/build/upmake_script.pl @@ -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 <] [--only-version=] @@ -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; }