Merge pull request #228 from DOCGroup/jwillemsen-patch-1
[MPC.git] / modules / CDT6ProjectCreator.pm
blob77eaece86498702b910bab130ea6d33702a588e7
1 package CDT6ProjectCreator;
3 # ************************************************************
4 # Description : Eclipse CDT 6 generator
5 # Author : Chris Cleeland, Object Computing, Inc.
6 # Create Date : 23-Apr-2010
7 # ************************************************************
9 # ************************************************************
10 # Pragmas
11 # ************************************************************
13 use strict;
15 use ProjectCreator;
17 use vars qw(@ISA);
18 @ISA = qw(ProjectCreator);
20 # ************************************************************
21 # Data Section
22 # ************************************************************
24 my %templates = ('cdt6project' => '.project',
25 'cdt6cproject' => '.cproject' );
27 my @tkeys = sort keys %templates;
29 # ************************************************************
30 # Subroutine Section
31 # ************************************************************
33 sub crlf {
34 #my $self = shift;
35 return "\n";
38 sub project_file_name {
39 my($self, $name, $template) = @_;
41 ## Fill in the name and template if they weren't provided
42 $name = $self->project_name() if (!defined $name);
43 $template = 'cdt6project' if (!defined $template ||
44 !defined $templates{$template});
46 if ($self->{'make_coexistence'}) {
47 return $self->get_modified_project_file_name("cdt_$name",
48 '/' . $templates{$template});
50 else {
51 return $templates{$template};
55 sub fill_value {
56 my($self, $name) = @_;
58 if ($name eq 'platforms') {
59 if (defined $ENV{'MPC_CDT_PLATFORMS'}) {
60 return $ENV{'MPC_CDT_PLATFORMS'};
62 elsif ($^O eq 'darwin') {
63 return 'macosx';
65 elsif ($^O eq 'MSWin32') {
66 return 'win32';
68 else {
69 return $^O; # cygwin, solaris, linux match what we expect
72 elsif ($name eq 'nocross') {
73 # return the value of the 'nocross' element from the project_info array
74 return $self->get_project_info()->[ProjectCreator::NO_CROSS_COMPILE];
77 return $self->get_configurable($name);
80 sub get_configurable {
81 #my($self, $name) = @_;
82 return undef;
85 sub get_template {
86 #my $self = shift;
87 return @tkeys;
90 sub dependency_is_filename {
91 #my $self = shift;
92 return 0;
95 sub requires_forward_slashes {
96 return 1;
99 sub file_visible {
100 ## We only want the project file visible to the workspace creator.
101 ## There can only be one and this is it.
102 #my($self, $template) = @_;
103 return $_[1] eq 'cdt6project';
106 sub get_dll_exe_template_input_file {
107 #my $self = shift;
108 return 'cdt6exe';
111 sub get_dll_template_input_file {
112 #my $self = shift;
113 #print "in get_dll_template_input_file\n";
114 return 'cdt6dll';
117 sub get_lib_template_input_file {
118 #my $self = shift;
119 #print "in get_lib_template_input_file\n";
120 return 'cdt6lib';
123 sub use_win_compatibility_commands {
124 return (defined $ENV{'MPC_CDT_HOST_WIN32'})
125 ? $ENV{'MPC_CDT_HOST_WIN32'} : ($^O eq 'MSWin32' || $^O eq 'cygwin');
128 sub pre_write_output_file {
129 my $self = shift;
130 if ($self->{'assign'}->{'custom_only'}) {
131 return 1;
133 return $self->combine_custom_types();