diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2004-08-31 13:01:06 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2004-08-31 13:01:06 +0000 |
commit | a62f12f2fa050f04512b7e5ede1333cf95c509ba (patch) | |
tree | 97e4d6ff187a60b054a9d1a56802aea2bad21c6f | |
parent | 1dbf634fe2eab40b0590ca43b60a81697d53950a (diff) | |
download | MPC-a62f12f2fa050f04512b7e5ede1333cf95c509ba.tar.gz |
ChangeLogTag: Tue Aug 31 08:00:20 2004 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | ChangeLog | 40 | ||||
-rw-r--r-- | USAGE | 3 | ||||
-rw-r--r-- | modules/Creator.pm | 8 | ||||
-rw-r--r-- | modules/Driver.pm | 3 | ||||
-rw-r--r-- | modules/Options.pm | 58 | ||||
-rw-r--r-- | modules/ProjectCreator.pm | 257 | ||||
-rw-r--r-- | modules/TemplateParser.pm | 12 | ||||
-rw-r--r-- | modules/VC6ProjectCreator.pm | 5 | ||||
-rw-r--r-- | modules/VC7ProjectCreator.pm | 50 | ||||
-rw-r--r-- | modules/VC7WorkspaceCreator.pm | 57 | ||||
-rw-r--r-- | modules/WorkspaceCreator.pm | 9 | ||||
-rw-r--r-- | templates/make.mpd | 37 | ||||
-rw-r--r-- | templates/makedll.mpt | 20 | ||||
-rw-r--r-- | templates/vc7csharp.mpd | 120 | ||||
-rw-r--r-- | templates/vc7csharp.mpt | 19 | ||||
-rw-r--r-- | templates/vc7vb.mpd | 116 | ||||
-rw-r--r-- | templates/vc7vb.mpt | 17 |
17 files changed, 685 insertions, 146 deletions
@@ -1,3 +1,43 @@ +Tue Aug 31 08:00:20 2004 Chad Elliott <elliott_c@ociweb.com> + + * modules/TemplateParser.pm: + + Fixed a bug where setting a scoped assignment would not apply to a + directory specified within that scope. For example: + + project { + Source_Files { + some_feature = value + src + } + } + + The some_feature setting would not get applied to the files found + in the src directory. + + * USAGE: + * modules/Creator.pm: + * modules/Driver.pm: + * modules/Options.pm: + * modules/ProjectCreator.pm: + * modules/VC6ProjectCreator.pm: + * modules/VC7ProjectCreator.pm: + * modules/VC7WorkspaceCreator.pm: + * modules/WorkspaceCreator.pm: + * templates/make.mpd: + * templates/makedll.mpt: + * templates/vc7csharp.mpd: + * templates/vc7csharp.mpt: + * templates/vc7vb.mpd: + * templates/vc7vb.mpt: + + Added multi-language support to MPC. The default language is C++, + but it now supports C#, Java and Visual Basic. + + An additional bug was fixed in ProjectCreator.pm. If, in a + Define_Custom, the automatic keyword was not set or set to zero + MPC would still automatically add custom files to the project. + Mon Aug 30 08:07:51 2004 Chad Elliott <elliott_c@ociweb.com> * README: @@ -18,6 +18,7 @@ Usage: mwc.pl [-global <file>] [-include <directory>] [-recurse] [-feature_file <file name>] [-make_coexistence] [-exclude <directories>] [-name_modifier <pattern>] [-apply_project] [-version] [-into <directory>] + [-language <cplusplus | csharp | java | vb>] [-type <automake | bmake | cbx | em3 | ghs | html | make | nmake | sle | va4 | vc6 | vc7 | vc71 | vc8>] @@ -41,6 +42,8 @@ Usage: mwc.pl [-global <file>] [-include <directory>] [-recurse] option can be used multiple times to add directories. -into Place all output files in a mirrored directory structure starting at <directory>. + -language Specify the language preference. The default is + cplusplus. -make_coexistence If multiple 'make' based project types are generated, they will be named such that they can coexist. -name_modifier Modify output names. The pattern passed to this diff --git a/modules/Creator.pm b/modules/Creator.pm index e9bf1e8c..4402b8e2 100644 --- a/modules/Creator.pm +++ b/modules/Creator.pm @@ -55,6 +55,7 @@ sub new { my($nmodifier) = shift; my($applypj) = shift; my($into) = shift; + my($language) = shift; my($type) = shift; my($self) = Parser::new($class, $inc); @@ -83,6 +84,7 @@ sub new { $self->{'name_modifier'} = $nmodifier; $self->{'apply_project'} = $applypj; $self->{'into'} = $into; + $self->{'language'} = $language; $self->{'convert_slashes'} = $self->convert_slashes(); return $self; @@ -871,6 +873,12 @@ sub get_apply_project { return $self->{'apply_project'}; } + +sub get_language { + my($self) = shift; + return $self->{'language'}; +} + # ************************************************************ # Virtual Methods To Be Overridden # ************************************************************ diff --git a/modules/Driver.pm b/modules/Driver.pm index 66310137..c8318e3d 100644 --- a/modules/Driver.pm +++ b/modules/Driver.pm @@ -306,7 +306,8 @@ sub run { $options->{'name_modifier'}, $options->{'apply_project'}, $options->{'genins'}, - $options->{'into'}); + $options->{'into'}, + $options->{'language'}); if ($base ne $file) { my($dir) = ($base eq '' ? $file : $self->mpc_dirname($file)); if (!$creator->cd($dir)) { diff --git a/modules/Options.pm b/modules/Options.pm index ffcbd695..21c6a021 100644 --- a/modules/Options.pm +++ b/modules/Options.pm @@ -13,6 +13,16 @@ package Options; use strict; # ************************************************************ +# Data Section +# ************************************************************ + +my(%languages) = ('cplusplus' => 1, + 'csharp' => 1, + 'java' => 1, + 'vb' => 1, + ); + +# ************************************************************ # Subroutine Section # ************************************************************ @@ -29,7 +39,7 @@ sub printUsage { } my($spaces) = (' ' x (length($base) + 8)); print STDERR "$base v$version\n" . - "Usage: $base [-global <file>] [-include <directory>] [-recurse]]\n" . + "Usage: $base [-global <file>] [-include <directory>] [-recurse]\n" . $spaces . "[-ti <dll | lib | dll_exe | lib_exe>:<file>] [-hierarchy]\n" . $spaces . "[-template <file>] [-relative NAME=VAR] [-base <project>]\n" . $spaces . "[-noreldefs] [-notoplevel] [-static] [-genins]\n" . @@ -38,9 +48,22 @@ sub printUsage { $spaces . "[-feature_file <file name>] [-make_coexistence]\n" . $spaces . "[-exclude <directories>] [-name_modifier <pattern>]\n" . $spaces . "[-apply_project] [-version] [-into <directory>]\n" . - $spaces . "[-type <"; + $spaces . "[-language <"; + + my(@keys) = sort keys %languages; + for(my $i = 0; $i <= $#keys; $i++) { + print STDERR $keys[$i]; + if ($i != $#keys) { + print STDERR ' | '; + } + if ($i != $#keys && (($i + 1) % 4) == 0) { + print STDERR "\n$spaces "; + } + } + print STDERR ">]\n", + $spaces, "[-type <"; - my(@keys) = sort @types; + @keys = sort @types; for(my $i = 0; $i <= $#keys; $i++) { print STDERR $keys[$i]; if ($i != $#keys) { @@ -72,6 +95,8 @@ sub printUsage { " option can be used multiple times to add directories.\n" . " -into Place all output files in a mirrored directory\n" . " structure starting at <directory>.\n" . +" -language Specify the language preference. The default is\n". +" cplusplus.\n" . " -make_coexistence If multiple 'make' based project types are\n" . " generated, they will be named such that they can coexist.\n" . " -name_modifier Modify output names. The pattern passed to this\n" . @@ -162,6 +187,7 @@ sub options { my($nmodifier) = undef; my($into) = undef; my($hierarchy) = 0; + my($language) = ($defaults ? 'cplusplus' : undef); my($dynamic) = ($defaults ? 1 : undef); my($reldefs) = ($defaults ? 1 : undef); my($toplevel) = ($defaults ? 1 : undef); @@ -262,6 +288,16 @@ sub options { $self->optionError('-into requires a directory argument'); } } + elsif ($arg eq '-language') { + $i++; + $language = $args[$i]; + if (!defined $language) { + $self->optionError('-language requires a language argument'); + } + elsif (!defined $languages{$language}) { + $self->optionError("$language is not a valid language"); + } + } elsif ($arg eq '-make_coexistence') { $makeco = 1; } @@ -317,10 +353,17 @@ sub options { $self->optionError('-ti requires a template input argument'); } else { - if ($tmpi =~ /(dll|lib|dll_exe|lib_exe):(.*)/) { - my($key) = $1; - my($name) = $2; - $ti{$key} = $name; + if ($tmpi =~ /((dll|lib|dll_exe|lib_exe):)?(.*)/) { + my($key) = $2; + my($name) = $3; + if (defined $key) { + $ti{$key} = $name; + } + else { + foreach my $type ('dll', 'lib', 'dll_exe', 'lib_exe') { + $ti{$type} = $name; + } + } } else { $self->optionError("Invalid -ti argument: $tmpi"); @@ -429,6 +472,7 @@ sub options { 'apply_project' => $applypj, 'genins' => $genins, 'into' => $into, + 'language' => $language, ); return \%options; diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm index 01b83d11..12891b3a 100644 --- a/modules/ProjectCreator.pm +++ b/modules/ProjectCreator.pm @@ -117,25 +117,75 @@ my(%sourceComponents) = ('source_files' => 1, 'template_files' => 1, ); +my(%genext) = (); + +my($grouped_key) = 'grouped_'; + +# ************************************************************ +# C++ Specific Component Settings +# ************************************************************ + ## Valid component names within a project along with the valid file extensions -my(%vc) = ('source_files' => [ "\\.cpp", "\\.cxx", "\\.cc", "\\.c", "\\.C", ], - 'template_files' => [ "_T\\.cpp", "_T\\.cxx", "_T\\.cc", "_T\\.c", "_T\\.C", ], - 'header_files' => [ "\\.h", "\\.hpp", "\\.hxx", "\\.hh", ], - 'inline_files' => [ "\\.i", "\\.inl", ], - 'documentation_files' => [ "README", "readme", "\\.doc", "\\.txt", "\\.html" ], - 'resource_files' => [ "\\.rc", ], - ); +my(%cppvc) = ('source_files' => [ "\\.cpp", "\\.cxx", "\\.cc", "\\.c", "\\.C", ], + 'template_files' => [ "_T\\.cpp", "_T\\.cxx", "_T\\.cc", "_T\\.c", "_T\\.C", ], + 'header_files' => [ "\\.h", "\\.hpp", "\\.hxx", "\\.hh", ], + 'inline_files' => [ "\\.i", "\\.inl", ], + 'documentation_files' => [ "README", "readme", "\\.doc", "\\.txt", "\\.html" ], + 'resource_files' => [ "\\.rc", ], + ); ## Exclude these extensions when auto generating the component values -my(%ec) = ('source_files' => $vc{'template_files'}, - ); +my(%cppec) = ('source_files' => $cppvc{'template_files'}, + ); -## Match up assignments with the valid components -my(%ma) = (); +# ************************************************************ +# C# Specific Component Settings +# ************************************************************ -my(%genext) = (); +## Valid component names within a project along with the valid file extensions +my(%csvc) = ('source_files' => [ "\\.cs" ], + 'config_files' => [ "\\.config" ], + 'resx_files' => [ "\\.resx" ], + 'ico_files' => [ "\\.ico" ], + 'documentation_files' => [ "README", "readme", "\\.doc", "\\.txt", "\\.html" ], + ); -my($grouped_key) = 'grouped_'; +my(%csma) = ('source_files' => [ 'subtype' ], + ); + +# ************************************************************ +# Java Specific Component Settings +# ************************************************************ + +## Valid component names within a project along with the valid file extensions +my(%jvc) = ('source_files' => [ "\\.java" ], + 'documentation_files' => [ "README", "readme", "\\.doc", "\\.txt", "\\.html" ], + ); + +# ************************************************************ +# Visual Basic Specific Component Settings +# ************************************************************ + +## Valid component names within a project along with the valid file extensions +my(%vbvc) = ('source_files' => [ "\\.vb" ], + 'config_files' => [ "\\.config" ], + 'resx_files' => [ "\\.resx" ], + 'ico_files' => [ "\\.ico" ], + 'documentation_files' => [ "README", "readme", "\\.doc", "\\.txt", "\\.html" ], + ); + +my(%vbma) = ('source_files' => [ 'subtype' ], + ); + +# ************************************************************ +# Language Specific Component Settings +# ************************************************************ + +my(%language) = ('cplusplus' => [ \%cppvc, \%cppec, {} , 'main' ], + 'csharp' => [ \%csvc, {}, \%csma, 'Main' ], + 'java' => [ \%jvc, {}, {} , 'Main' ], + 'vb' => [ \%vbvc, {}, \%vbma, 'Main' ], + ); # ************************************************************ # Subroutine Section @@ -164,12 +214,13 @@ sub new { my($applypj) = shift; my($genins) = shift; my($into) = shift; + my($language) = shift; my($self) = $class->SUPER::new($global, $inc, $template, $ti, $dynamic, $static, $relative, $addtemp, $addproj, $progress, $toplevel, $baseprojs, $feature, $hierarchy, $nmod, $applypj, - $into, + $into, $language, 'project'); $self->{$self->{'type_check'}} = 0; @@ -1663,12 +1714,13 @@ sub generate_default_target_names { my(@sources) = $self->get_component_list('source_files', 1); foreach my $file (@sources) { if (open($fh, $file)) { + my($main) = $language{$self->get_language()}->[3]; while(<$fh>) { ## Remove c++ comments (ignore c style comments for now) $_ =~ s/\/\/.*//; ## Check for main - if (/(main|ACE_MAIN|ACE_WMAIN|ACE_TMAIN)\s*\(/) { + if (/\s+($main)\s*\(/ || /^\s*($main)\s*\(/) { ## If we found a main, set the exename to the basename ## of the cpp file with the extension removed $exename = basename($file); @@ -1883,95 +1935,98 @@ sub generate_default_components { my($recurse) = $self->get_assignment('recurse'); foreach my $tag (@tags) { - my($exts) = $$vc{$tag}; - if (defined $$exts[0]) { - if (defined $self->{$tag}) { - ## If the tag is defined, then process directories - my($names) = $self->{$tag}; - foreach my $name (keys %$names) { - my($comps) = $$names{$name}; - foreach my $comp (keys %$comps) { - my($array) = $$comps{$comp}; - if (defined $passed) { - $self->sift_files($files, $exts, $pchh, $pchc, $tag, $array); - } - else { - my(@built) = (); - foreach my $file (@$array) { - if (-d $file) { - my($alldir) = $recurse || - $self->{'flag_overrides'}->{$tag}->{$file}->{'recurse'}; - my(@gen) = $self->generate_default_file_list( - $file, [], $alldir); - $self->sift_files(\@gen, $exts, $pchh, - $pchc, $tag, \@built, $alldir); - } - else { - if (!$self->already_added(\@built, $file)) { - push(@built, $file); + if (!defined $self->{'generated_exts'}->{$tag} || + $self->{'generated_exts'}->{$tag}->{'automatic'}) { + my($exts) = $$vc{$tag}; + if (defined $$exts[0]) { + if (defined $self->{$tag}) { + ## If the tag is defined, then process directories + my($names) = $self->{$tag}; + foreach my $name (keys %$names) { + my($comps) = $$names{$name}; + foreach my $comp (keys %$comps) { + my($array) = $$comps{$comp}; + if (defined $passed) { + $self->sift_files($files, $exts, $pchh, $pchc, $tag, $array); + } + else { + my(@built) = (); + foreach my $file (@$array) { + if (-d $file) { + my($alldir) = $recurse || + $self->{'flag_overrides'}->{$tag}->{$file}->{'recurse'}; + my(@gen) = $self->generate_default_file_list( + $file, [], $alldir); + $self->sift_files(\@gen, $exts, $pchh, + $pchc, $tag, \@built, $alldir); + } + else { + if (!$self->already_added(\@built, $file)) { + push(@built, $file); + } } } + $$comps{$comp} = \@built; } - $$comps{$comp} = \@built; } } } - } - else { - ## Generate default values for undefined tags - my($defcomp) = $self->get_default_element_name(); - my($names) = {}; - $self->{$tag} = $names; - my($comps) = {}; - $$names{$self->get_default_component_name()} = $comps; - $$comps{$defcomp} = []; - my($array) = $$comps{$defcomp}; - - $self->{'defaulted'}->{$tag} = 1; - - if (!defined $specialComponents{$tag}) { - $self->sift_files($files, $exts, $pchh, $pchc, $tag, $array); - if (defined $sourceComponents{$tag}) { - foreach my $gentype (keys %{$self->{'generated_exts'}}) { - ## If we are auto-generating the source_files, then - ## we need to make sure that any generated source - ## files that are added are put at the front of the list. - my(@front) = (); - my(@copy) = @$array; - my(@input) = $self->get_component_list($gentype, 1); - my($wanted) = $self->{'valid_components'}->{$gentype}->[0]; - - @$array = (); - foreach my $file (@copy) { - my($found) = 0; - foreach my $input (@input) { - my($part) = $input; - $part =~ s/$wanted$//; - $part = $self->escape_regex_special($part); - foreach my $re ($self->generated_filenames($part, $gentype, - $tag, $input, - 0)) { - if ($file =~ /$re$/) { - ## No need to check for previously added files - ## here since there are none. - push(@front, $file); - $found = 1; + else { + ## Generate default values for undefined tags + my($defcomp) = $self->get_default_element_name(); + my($names) = {}; + $self->{$tag} = $names; + my($comps) = {}; + $$names{$self->get_default_component_name()} = $comps; + $$comps{$defcomp} = []; + my($array) = $$comps{$defcomp}; + + $self->{'defaulted'}->{$tag} = 1; + + if (!defined $specialComponents{$tag}) { + $self->sift_files($files, $exts, $pchh, $pchc, $tag, $array); + if (defined $sourceComponents{$tag}) { + foreach my $gentype (keys %{$self->{'generated_exts'}}) { + ## If we are auto-generating the source_files, then + ## we need to make sure that any generated source + ## files that are added are put at the front of the list. + my(@front) = (); + my(@copy) = @$array; + my(@input) = $self->get_component_list($gentype, 1); + my($wanted) = $self->{'valid_components'}->{$gentype}->[0]; + + @$array = (); + foreach my $file (@copy) { + my($found) = 0; + foreach my $input (@input) { + my($part) = $input; + $part =~ s/$wanted$//; + $part = $self->escape_regex_special($part); + foreach my $re ($self->generated_filenames($part, $gentype, + $tag, $input, + 0)) { + if ($file =~ /$re$/) { + ## No need to check for previously added files + ## here since there are none. + push(@front, $file); + $found = 1; + last; + } + } + if ($found) { last; } } - if ($found) { - last; + if (!$found) { + ## No need to check for previously added files + ## here since there are none. + push(@$array, $file); } } - if (!$found) { - ## No need to check for previously added files - ## here since there are none. - push(@$array, $file); - } - } - if (defined $front[0]) { - unshift(@$array, @front); + if (defined $front[0]) { + unshift(@$array, @front); + } } } } @@ -3171,12 +3226,13 @@ sub reset_values { sub add_default_matching_assignments { - #my($self) = shift; - foreach my $key (keys %vc) { - if (!defined $ma{$key}) { - $ma{$key} = []; + my($self) = shift; + my($lang) = $self->get_language(); + foreach my $key (keys %{$language{$lang}->[0]}) { + if (!defined $language{$lang}->[2]->{$key}) { + $language{$lang}->[2]->{$key} = []; foreach my $keyword (@default_matching_assignments) { - push(@{$ma{$key}}, $keyword); + push(@{$language{$lang}->[2]->{$key}}, $keyword); } } } @@ -3185,10 +3241,11 @@ sub add_default_matching_assignments { sub reset_generating_types { my($self) = shift; - my(%reset) = ('matching_assignments' => \%ma, - 'valid_components' => \%vc, + my($lang) = $self->get_language(); + my(%reset) = ('valid_components' => $language{$lang}->[0], + 'exclude_components' => $language{$lang}->[1], + 'matching_assignments' => $language{$lang}->[2], 'generated_exts' => \%genext, - 'exclude_components' => \%ec, 'valid_names' => \%validNames, ); diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm index 1d59bfbd..62a90747 100644 --- a/modules/TemplateParser.pm +++ b/modules/TemplateParser.pm @@ -435,6 +435,10 @@ sub get_flag_overrides { my($fo) = $prjc->{'flag_overrides'}; if (defined $file) { + my($ustyle) = $file; + $ustyle =~ s/\\/\//g; + my($dir) = $self->mpc_dirname($ustyle); + ## Replace the custom_type key with the actual custom type if ($name =~ /^custom_type\->/) { my($ct) = $self->get_value('custom_type'); @@ -446,11 +450,9 @@ sub get_flag_overrides { foreach my $key (keys %$fo) { if ($key =~ /^$name/) { foreach my $of (keys %{$$fo{$key}}) { - my($cv) = $of; - if ($self->{'cslashes'}) { - $cv = $prjc->slash_to_backslash($of); - } - if ($cv eq $file) { + my($cv) = ($self->{'cslashes'} ? $prjc->slash_to_backslash($of) : + $of); + if ($cv eq $file || $cv eq $dir) { foreach my $ma (keys %{$prjc->{'matching_assignments'}}) { if ($ma eq $key) { foreach my $aname (@{$prjc->{'matching_assignments'}->{$ma}}) { diff --git a/modules/VC6ProjectCreator.pm b/modules/VC6ProjectCreator.pm index 0f7533b9..87298a46 100644 --- a/modules/VC6ProjectCreator.pm +++ b/modules/VC6ProjectCreator.pm @@ -88,9 +88,8 @@ sub override_valid_component_extensions { my($comp) = shift; my($array) = undef; - if ($comp eq 'source_files') { - my(@exts) = ("\\.cpp", "\\.cxx", "\\.c"); - $array = \@exts; + if ($comp eq 'source_files' && $self->get_language() eq 'cplusplus') { + $array = ["\\.cpp", "\\.cxx", "\\.c"]; } return $array; diff --git a/modules/VC7ProjectCreator.pm b/modules/VC7ProjectCreator.pm index bc1a48e0..9fdf9faa 100644 --- a/modules/VC7ProjectCreator.pm +++ b/modules/VC7ProjectCreator.pm @@ -19,6 +19,33 @@ use vars qw(@ISA); @ISA = qw(ProjectCreator); # ************************************************************ +# Data Section +# ************************************************************ + +my(%info) = ('cplusplus' => {'ext' => '.vcproj', + 'dllexe' => 'vc7exe', + 'libexe' => 'vc7libexe', + 'dll' => 'vc7dll', + 'lib' => 'vc7lib', + 'template' => 'vc7', + }, + 'csharp' => {'ext' => '.csproj', + 'dllexe' => 'vc7csharp', + 'libexe' => 'vc7csharp', + 'dll' => 'vc7csharp', + 'lib' => 'vc7csharp', + 'template' => 'vc7csharp', + }, + 'vb' => {'ext' => '.vbproj', + 'dllexe' => 'vc7vb', + 'libexe' => 'vc7vb', + 'dll' => 'vc7vb', + 'lib' => 'vc7vb', + 'template' => 'vc7vb', + }, + ); + +# ************************************************************ # Subroutine Section # ************************************************************ @@ -109,37 +136,38 @@ sub project_file_name { $name = $self->project_name(); } - return $self->get_modified_project_file_name($name, '.vcproj'); + return $self->get_modified_project_file_name( + $name, $info{$self->get_language()}->{'ext'}); } sub get_dll_exe_template_input_file { - #my($self) = shift; - return 'vc7exe'; + my($self) = shift; + return $info{$self->get_language()}->{'dllexe'}; } sub get_lib_exe_template_input_file { - #my($self) = shift; - return 'vc7libexe'; + my($self) = shift; + return $info{$self->get_language()}->{'libexe'}; } sub get_dll_template_input_file { - #my($self) = shift; - return 'vc7dll'; + my($self) = shift; + return $info{$self->get_language()}->{'dll'}; } sub get_lib_template_input_file { - #my($self) = shift; - return 'vc7lib'; + my($self) = shift; + return $info{$self->get_language()}->{'lib'}; } sub get_template { - #my($self) = shift; - return 'vc7'; + my($self) = shift; + return $info{$self->get_language()}->{'template'}; } diff --git a/modules/VC7WorkspaceCreator.pm b/modules/VC7WorkspaceCreator.pm index fed196ac..cdadb75a 100644 --- a/modules/VC7WorkspaceCreator.pm +++ b/modules/VC7WorkspaceCreator.pm @@ -19,6 +19,15 @@ use vars qw(@ISA); @ISA = qw(WorkspaceCreator); # ************************************************************ +# Data Section +# ************************************************************ + +my(%guids) = ('cplusplus' => '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942', + 'csharp' => 'FAE04EC0-301F-11D3-BF4B-00C04F79EFBC', + 'vb' => 'F184B08F-C81C-45F6-A57F-5ABD9991F28F', + ); + +# ************************************************************ # Subroutine Section # ************************************************************ @@ -124,7 +133,8 @@ sub write_comps { my($fh) = shift; my($gen) = shift; my($projects) = $self->get_projects(); - my($vc7guid) = '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'; + my($language) = $self->get_language(); + my($vc7guid) = $guids{$language}; my($pjs) = $self->get_project_info(); my(@list) = sort @$projects; my($crlf) = $self->crlf(); @@ -146,6 +156,11 @@ sub write_comps { print $fh "Project(\"{$vc7guid}\") = \"$name\", \"$cpy\", \"{$guid}\"$crlf"; $self->print_inner_project($fh, $gen, $guid, $deps, $name, \%name_to_guid_map); print $fh "EndProject$crlf"; + + if ($deps ne '' && + ($language eq 'csharp' || $language eq 'vb')) { + $self->add_references($project, $vc7guid, $deps, \%name_to_guid_map); + } } ## Project Configurations @@ -186,4 +201,44 @@ sub write_comps { } +sub add_references { + my($self) = shift; + my($proj) = shift; + my($pguid) = shift; + my($deps) = shift; + my($gmap) = shift; + my($crlf) = $self->crlf(); + my($fh) = new FileHandle(); + + if (open($fh, $proj)) { + my($write) = 0; + my(@read) = (); + while(<$fh>) { + if (/MPC\s+ADD\s+REFERENCES/) { + $write = 1; + my($darr) = $self->create_array($deps); + foreach my $dep (@$darr) { + push(@read, " <Reference$crlf", + " Name = \"$dep\"$crlf", + " Project = \"{$$gmap{$dep}}\"$crlf", + " Package = \"{$pguid}\"$crlf", + " />$crlf"); + } + } + else { + push(@read, $_); + } + } + close($fh); + + if ($write && open($fh, ">$proj")) { + foreach my $line (@read) { + print $fh $line; + } + close($fh); + } + } +} + + 1; diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm index 31d78a2d..7d8e002f 100644 --- a/modules/WorkspaceCreator.pm +++ b/modules/WorkspaceCreator.pm @@ -71,12 +71,13 @@ sub new { my($applypj) = shift; my($genins) = shift; my($into) = shift; + my($language) = shift; my($self) = Creator::new($class, $global, $inc, $template, $ti, $dynamic, $static, $relative, $addtemp, $addproj, $progress, $toplevel, $baseprojs, $feature, $hierarchy, $nmod, $applypj, - $into, + $into, $language, 'workspace'); $self->{'workspace_name'} = undef; @@ -1590,6 +1591,9 @@ sub process_cmdline { if (defined $options->{'into'}) { $self->optionError('-into is ignored'); } + if (defined $options->{'language'}) { + $self->optionError('-language is ignored'); + } if (defined $options->{'input'}->[0]) { $self->optionError('Command line files ' . 'specified in a workspace are ignored'); @@ -1660,7 +1664,8 @@ sub project_creator { $parameters{'name_modifier'}, $parameters{'apply_project'}, $self->{'generate_ins'}, - $parameters{'into'}); + $parameters{'into'}, + $self->get_language()); } diff --git a/templates/make.mpd b/templates/make.mpd index 2c90a8d1..56881246 100644 --- a/templates/make.mpd +++ b/templates/make.mpd @@ -28,16 +28,20 @@ DEPENDENCIES = .depend.$(MAKEFILE) <%if(exename)%> BIN = <%exename%>$(EXEEXT) <%endif%> -<%if(staticname)%> -LIB = lib<%staticname%>.a -<%endif%> <%foreach(platforms)%> EXEEXT = <%exeext%> LN = <%ln%> +LIBPREFIX = <%libprefix%> +<%if(arext)%> +<%if(staticname)%> +AREXT = <%arext%> +LIB = $(LIBPREFIX)<%staticname%>.$(AREXT) +<%endif%> +<%endif%> <%if(soext)%> <%if(sharedname)%> -SHLIB = lib<%sharedname%>.$(SOEXT) SOEXT = <%soext%> +SHLIB = $(LIBPREFIX)<%sharedname%>.$(SOEXT) <%foreach(configurations)%> <%if(pic)%> PICFLAGS = <%pic%> @@ -50,23 +54,24 @@ SHFLAGS = <%shflags%> <%endif%> <%endfor%> <%foreach(configurations)%> +OBJEXT = <%objext%> +OUTPUT_OPTION = <%output_option("-o $@")%> +COMPILE.cc = $(CXX) $(CCFLAGS) $(CPPFLAGS) <%compile_option("-c")%> +<%if(arflags)%> +ARFLAGS = <%arflags%> +<%endif%> <%if(tempinc)%> TEMPINCDIR = <%tempinc%>/<%project_name%> <%endif%> <%endfor%> GENFLAGS = <%genflags(-g)%> CPPFLAGS = $(PICFLAGS) $(GENFLAGS)<%if(cppflags)%> <%cppflags%><%endif%><%foreach(configurations)%><%if(compileflags)%> <%compileflags%><%endif%><%if(cpu)%> -DCPU=$(CPU)<%endif%><%if(tempinc)%> <%tempincopt%>$(TEMPINCDIR)<%endif%><%if(compilerflags)%> <%compilerflags%><%endif%><%if(pch_source && pchsupport)%><%foreach(pch_defines)%> -D<%pch_define%><%endfor%><%endif%><%endfor%><%foreach(platforms)%><%if(extracppflags)%> <%extracppflags%><%endif%><%endfor%><%if(includes)%><%foreach(includes)%> -I<%include%><%endfor%><%endif%><%if(macros)%><%foreach(macros)%> -D<%macro%><%endfor%><%endif%> -<%if(arflags)%> -ARFLAGS = <%arflags%> -<%endif%> SRC =<%if(pch_source && pchsupport)%> <%pch_source%><%endif%> <%source_files%> -OBJS =<%if(pch_source && pchsupport)%> <%basenoextension(pch_source)%>.o<%endif%><%foreach(source_files)%> <%basenoextension(source_file)%>.o<%endfor%><%foreach(platforms)%><%if(rc)%><%foreach(resource_files)%> <%resource_file%>.o<%endfor%><%endif%><%endfor%> +OBJS =<%if(pch_source && pchsupport)%> <%basenoextension(pch_source)%>.$(OBJEXT)<%endif%><%foreach(source_files)%> <%basenoextension(source_file)%>.$(OBJEXT)<%endfor%><%foreach(platforms)%><%if(rc)%><%foreach(resource_files)%> <%resource_file%>.$(OBJEXT)<%endfor%><%endif%><%endfor%> LDFLAGS =<%if(libpaths)%><%foreach(libpaths)%> -L<%libpath%><%endfor%><%endif%><%foreach(configurations)%><%if(linkflags)%> <%linkflags%><%endif%><%endfor%> LDLIBS =<%foreach(pure_libs)%> <%pure_lib%><%endfor%><%foreach(libs lit_libs)%> -l<%lib%><%endfor%><%foreach(platforms)%> <%ldlibs%><%endfor%> LINK.cc = $(LD) $(LDFLAGS) -COMPILE.cc = $(CXX) $(CCFLAGS) $(CPPFLAGS) -c RM = rm -f -OUTPUT_OPTION = -o $@ <%if(dynamicflags)%> DYNAMICFLAGS =<%foreach(dynamicflags)%> -D<%dynamicflag%><%endfor%> <%endif%> @@ -97,14 +102,14 @@ specialscript: @./specialscript $(NM) "$(OBJS)" "$(LDLIBS)" "<%if(libpaths)%><%libpaths%><%else%>.<%endif%>" <%prelink%> @$(RM) specialscript -<%basenoextension(prelink)%>.o: <%prelink%> +<%basenoextension(prelink)%>.$(OBJEXT): <%prelink%> $(COMPILE.cc) <%prelink%> $(OUTPUT_OPTION) @$(RM) <%prelink%> <%endif%> <%endfor%> <%endfor%> -$(BIN): $(TEMPINCDIR) $(OBJS) <%foreach(configurations)%><%foreach(platforms)%><%if(prelink)%><%basenoextension(prelink)%>.o<%endif%><%endfor%><%endfor%> +$(BIN): $(TEMPINCDIR) $(OBJS) <%foreach(configurations)%><%foreach(platforms)%><%if(prelink)%><%basenoextension(prelink)%>.$(OBJEXT)<%endif%><%endfor%><%endfor%> $(LINK.cc) $(OUTPUT_OPTION) $(OBJS) $(LDLIBS) <%endif%> @@ -191,12 +196,12 @@ $(TEMPINCDIR): <%endif%> <%if(pch_source && pchsupport)%> -<%basenoextension(pch_source)%>.o: <%pch_source%> +<%basenoextension(pch_source)%>.$(OBJEXT): <%pch_source%> $(COMPILE.cc) <%if(pchcreate)%><%pchcreate%><%basename(pch_header)%>.gch <%endif%>$(EXPORTFLAGS) <%pch_source%> $(OUTPUT_OPTION) <%endif%> <%foreach(source_files)%> -<%basenoextension(source_file)%>.o: <%source_file%> +<%basenoextension(source_file)%>.$(OBJEXT): <%source_file%> $(COMPILE.cc) <%if(pchuse && pch_source && pchsupport)%><%pchuse%><%basename(pch_header)%>.gch <%endif%>$(EXPORTFLAGS) <%source_file%> $(OUTPUT_OPTION) <%endfor%> @@ -205,8 +210,8 @@ $(TEMPINCDIR): <%foreach(platforms)%> <%if(rc)%> <%foreach(resource_files)%> -<%resource_file%>.o: <%resource_file%> - <%rc%> <%resource_file%> <%resource_file%>.o +<%resource_file%>.$(OBJEXT): <%resource_file%> + <%rc%> <%resource_file%> <%resource_file%>.$(OBJEXT) <%endfor%> <%endif%> diff --git a/templates/makedll.mpt b/templates/makedll.mpt index 91bce462..50f91c5d 100644 --- a/templates/makedll.mpt +++ b/templates/makedll.mpt @@ -21,7 +21,10 @@ conditional_include "common" configurations = gcc ln = ln -s +libprefix = lib +arext = a soext = so +objext = o exeext = cppflags = arflags = @@ -31,6 +34,17 @@ pchsupport = 1 // Configuration Section // *********************************************************************** +java { + cxx = javac + ld = echo + objext = class + output_option = + compile_option = + ar = jar + arflags = cvf + platforms = jvm +} + cxx { cxx = cxx clean = cxx_repository so_locations @@ -109,6 +123,12 @@ wrspentium { // Platform Section // *********************************************************************** +jvm { + libprefix = + soext = + arext = jar +} + tru64 { shflags = -shared /usr/lib/libcxxstd.a ldlibs = -ltli -lrt diff --git a/templates/vc7csharp.mpd b/templates/vc7csharp.mpd new file mode 100644 index 00000000..8f99eca0 --- /dev/null +++ b/templates/vc7csharp.mpd @@ -0,0 +1,120 @@ +<VisualStudioProject> + <CSHARP + ProjectType = "Local" + ProductVersion = "<%prversion("7.10.3077")%>" + SchemaVersion = "<%schemaversion("2.0)%>" + ProjectGuid = "{<%guid%>}" +<%if(scc)%> + SccProjectName = "<%scc%>" + SccLocalPath = "<%scc%>" + SccAuxPath = "<%scc%>" + SccProvider = "<%scc%>" +<%endif%> + > + <Build> + <Settings +<%if(ico_files)%> +<%foreach(ico_files)%> +<%if(forfirst)%> + ApplicationIcon = "<%ico_file%>" +<%endif%> +<%endfor%> +<%else%> + ApplicationIcon = "" +<%endif%> + AssemblyKeyContainerName = "" + AssemblyName = "<%if(exename)%><%exename%><%else%><%sharedname%><%endif%>" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "<%if(exename)%><%if(winapp)%>Win<%endif%>Exe<%else%>Library<%endif%>" + PreBuildEvent = "" + PostBuildEvent = "" + RootNamespace = "" + RunPostBuildEvent = "OnBuildSuccess" + StartupObject = "<%startupobject%>" + > +<%foreach(configurations)%> + <Config + Name = "<%configuration%>" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "<%foreach(defines common_defines macros)%><%define%><%fornotlast(";")%><%endfor%>" + DocumentationFile = "" + DebugSymbols = "<%if(optimize)%>false<%else%>true<%endif%>" + FileAlignment = "4096" + IncrementalBuild = "<%incremental("false")%>" + NoStdLib = "false" + NoWarn = "" + Optimize = "<%if(optimize)%>true<%else%>false<%endif%>" + OutputPath = "<%if(exename)%><%if(install)%><%install%><%else%>.<%endif%><%else%><%if(dllout)%><%dllout%><%else%><%libout%><%endif%><%endif%>\<%output_dir%>\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> +<%endfor%> + </Settings> + <References> +<%foreach(libs lit_libs pure_libs)%> + <Reference + Name = "<%lib%>" + AssemblyName = "<%lib%>" + /> +<%endfor%> + <!-- MPC ADD REFERENCES --> + </References> + </Build> + <Files> + <Include> +<%foreach(source_files)%> + <File + RelPath = "<%source_file%>" + SubType = "<%if(flag_overrides(source_file, subtype))%><%flag_overrides(source_file, subtype)%><%else%>Code<%endif%>" + BuildAction = "Compile" + /> +<%endfor%> +<%foreach(resx_files)%> + <File + RelPath = "<%resx_file%>" + DependentUpon = "<%noextension(resx_file)%>.cs" + BuildAction = "EmbeddedResource" + /> +<%endfor%> +<%foreach(custom_types)%> +<%foreach(custom_type->input_files)%> +<%if(custom_type->input_file->output_files)%> + <File + RelPath = "<%custom_type->input_file%>" + BuildAction = "Compile" + Generator = "<%if(custom_type->libpath)%>PATH=%PATH%;<%custom_type->libpath%>
<%endif%><%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> <%custom_type->input_file%><%if(custom_type->output_option)%> <%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%basename(custom_type->input_file->output_files)%><%else%><%custom_type->input_file->output_files%><%endif%><%endif%><%if(custom_type->postcommand)%><%foreach(custom_type->input_file->output_files)%>
<%custom_type->postcommand()%><%endfor%><%endif%>" + /> +<%endif%> +<%endfor%> +<%endfor%> +<%foreach(ico_files)%> + <File + RelPath = "<%ico_file%>" + BuildAction = "Content" + /> +<%endfor%> +<%foreach(config_files)%> + <File + RelPath = "<%config_file%>" + BuildAction = "None" + /> +<%endfor%> +<%foreach(documentation_files)%> + <File + RelPath = "<%documentation_file%>" + BuildAction = "None" + /> +<%endfor%> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> diff --git a/templates/vc7csharp.mpt b/templates/vc7csharp.mpt new file mode 100644 index 00000000..1162f9da --- /dev/null +++ b/templates/vc7csharp.mpt @@ -0,0 +1,19 @@ +// -*- MPC -*- +// $Id$ + +conditional_include "common" + +configurations = Release Debug +common_defines = TRACE + +Release { + optimize = 1 + defines = + output_dir = Release +} + +Debug { + optimize = + defines = DESIGN DEBUG + output_dir = Debug +} diff --git a/templates/vc7vb.mpd b/templates/vc7vb.mpd new file mode 100644 index 00000000..8a3f31c9 --- /dev/null +++ b/templates/vc7vb.mpd @@ -0,0 +1,116 @@ +<VisualStudioProject> + <VisualBasic + ProjectType = "Local" + ProductVersion = "<%prversion("7.10.3077")%>" + SchemaVersion = "<%schemaversion("2.0)%>" + ProjectGuid = "{<%guid%>}" +<%if(scc)%> + SccProjectName = "<%scc%>" + SccLocalPath = "<%scc%>" + SccAuxPath = "<%scc%>" + SccProvider = "<%scc%>" +<%endif%> + > + <Build> + <Settings +<%if(ico_files)%> +<%foreach(ico_files)%> +<%if(forfirst)%> + ApplicationIcon = "<%ico_file%>" +<%endif%> +<%endfor%> +<%else%> + ApplicationIcon = "" +<%endif%> + AssemblyKeyContainerName = "" + AssemblyName = "<%if(exename)%><%exename%><%else%><%sharedname%><%endif%>" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "<%if(exename)%><%if(winapp)%>Win<%endif%>Exe<%else%>Library<%endif%>" + OutputCompare = "Binary" + OptionExplicit = "On" + OptionStrict = "Off" + RootNamespace = "" + StartupObject = "<%startupobject%>" + > +<%foreach(configurations)%> + <Config + Name = "<%configuration%>" + BaseAddress = "285212672" + ConfigurationOverrideFile = "" + DefineConstants = "<%foreach(defines common_defines macros)%><%define%><%fornotlast(";")%><%endfor%>" + DefineDebug = "<%if(optimize)%>false<%else%>true<%endif%>" + DefineTrace = "<%trace("true")%>" + DefineSymbols = "<%if(optimize)%>false<%else%>true<%endif%>" + IncrementalBuild = "<%incremental("false")%>" + Optimize = "<%if(optimize)%>true<%else%>false<%endif%>" + OutputPath = "<%if(exename)%><%if(install)%><%install%><%else%>.<%endif%><%else%><%if(dllout)%><%dllout%><%else%><%libout%><%endif%><%endif%>\<%output_dir%>\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "1" + /> +<%endfor%> + </Settings> + <References> +<%foreach(libs lit_libs pure_libs)%> + <Reference + Name = "<%lib%>" + AssemblyName = "<%lib%>" + /> +<%endfor%> + <!-- MPC ADD REFERENCES --> + </References> + </Build> + <Files> + <Include> +<%foreach(source_files)%> + <File + RelPath = "<%source_file%>" + SubType = "<%if(flag_overrides(source_file, subtype))%><%flag_overrides(source_file, subtype)%><%else%>Code<%endif%>" + BuildAction = "Compile" + /> +<%endfor%> +<%foreach(resx_files)%> + <File + RelPath = "<%resx_file%>" + DependentUpon = "<%noextension(resx_file)%>.cs" + BuildAction = "EmbeddedResource" + /> +<%endfor%> +<%foreach(custom_types)%> +<%foreach(custom_type->input_files)%> +<%if(custom_type->input_file->output_files)%> + <File + RelPath = "<%custom_type->input_file%>" + BuildAction = "Compile" + Generator = "<%if(custom_type->libpath)%>PATH=%PATH%;<%custom_type->libpath%>
<%endif%><%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> <%custom_type->input_file%><%if(custom_type->output_option)%> <%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>\<%basename(custom_type->input_file->output_files)%><%else%><%custom_type->input_file->output_files%><%endif%><%endif%><%if(custom_type->postcommand)%><%foreach(custom_type->input_file->output_files)%>
<%custom_type->postcommand()%><%endfor%><%endif%>" + /> +<%endif%> +<%endfor%> +<%endfor%> +<%foreach(ico_files)%> + <File + RelPath = "<%ico_file%>" + BuildAction = "Content" + /> +<%endfor%> +<%foreach(config_files)%> + <File + RelPath = "<%config_file%>" + BuildAction = "None" + /> +<%endfor%> +<%foreach(documentation_files)%> + <File + RelPath = "<%documentation_file%>" + BuildAction = "None" + /> +<%endfor%> + </Include> + </Files> + </VisualBasic> +</VisualStudioProject> diff --git a/templates/vc7vb.mpt b/templates/vc7vb.mpt new file mode 100644 index 00000000..25f11324 --- /dev/null +++ b/templates/vc7vb.mpt @@ -0,0 +1,17 @@ +// -*- MPC -*- +// $Id$ + +conditional_include "common" + +configurations = Release Debug +common_defines = + +Release { + optimize = 1 + output_dir = Release +} + +Debug { + optimize = + output_dir = Debug +} |