summaryrefslogtreecommitdiff
path: root/bin/MakeProjectCreator/modules/VC6ProjectCreator.pm
blob: f2d4fccdeab1fd60450e830e3dfd57b14d6cd65f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
package VC6ProjectCreator;

# ************************************************************
# Description   : A VC6 Project Creator
# Author        : Chad Elliott
# Create Date   : 3/14/2002
# ************************************************************

# ************************************************************
# Pragmas
# ************************************************************

use strict;

use ProjectCreator;

use vars qw(@ISA);
@ISA = qw(ProjectCreator);

# ************************************************************
# Data Section
# ************************************************************

my($dynamiclib) = 'DLL';
my($staticlib)  = 'LIB';
my($dynamicexe) = 'EXE';
my($staticexe)  = 'Static EXE';
my($sname)      = '_Static';

# ************************************************************
# Subroutine Section
# ************************************************************

sub remove_type_append {
  my($self) = shift;
  my($str)  = shift;

  foreach my $type ($staticexe, $dynamicexe, $staticlib, $dynamiclib) {
    if ($str =~ /(.*)\s+$type$/) {
      $str = $1;
      last;
    }
  }

  return $str;
}


sub base_project_name {
  my($self) = shift;
  return $self->transform_file_name(
               $self->remove_type_append($self->project_name()) .
               ($self->get_writing_type() == 1 ? $sname : ''));
}


sub get_static_append {
  #my($self) = shift;
  return $sname;
}


sub get_type_append {
  my($self) = shift;
  my($type) = '';
  if ($self->lib_target()) {
    ## Set the type_append preserving whitespace
    if ($self->get_writing_type() == 1) {
      $type = " $staticlib";
    }
    else {
      $type = " $dynamiclib";
    }
  }
  else {
    ## Set the type_append preserving whitespace
    if ($self->get_writing_type() == 1) {
      $type = " $staticexe";
    }
    else {
      $type = " $dynamicexe";
    }
  }
  return $type;
}


sub translate_value {
  my($self) = shift;
  my($key)  = shift;
  my($val)  = shift;

  if ($key eq 'depends' && $val ne '') {
    my($arr) = $self->create_array($val);
    my($app) = $dynamiclib;
    $val = '';

    ## Only write dependencies for non-static projects
    ## and static exe projects
    my($wt) = $self->get_writing_type();
    if ($wt == 0 || $self->exe_target()) {
      if ($wt == 1) {
        $app = $staticlib;
      }
      foreach my $entry (@$arr) {
        my($dep) = $app;
        ## Hack for executable dependencies
        if ($entry =~ /exe/i) {
          if ($wt == 1) {
            $dep = $staticexe;
          }
          else {
            $dep = $dynamicexe;
          }
        }

        $val .= "\"$entry $dep\" ";
      }
      $val =~ s/\s+$//;
    }
  }
  return $val;
}


sub file_sorter {
  my($self)  = shift;
  my($left)  = shift;
  my($right) = shift;
  return lc($left) cmp lc($right);
}


sub crlf {
  my($self) = shift;
  return $self->windows_crlf();
}


sub fill_value {
  my($self)  = shift;
  my($name)  = shift;
  my($value) = undef;

  if ($name eq 'make_file_name') {
    $value = $self->base_project_name() . '.mak';
  }

  return $value;
}


sub separate_static_project {
  #my($self) = shift;
  return 1;
}


sub project_file_name {
  my($self) = shift;
  return $self->project_name() . '.dsp';
}


sub static_project_file_name {
  my($self) = shift;
  return $self->project_name() . "$sname.dsp";
}


sub override_valid_component_extensions {
  my($self)  = shift;
  my($comp)  = shift;
  my($array) = undef;

  if ($comp eq 'source_files') {
    my(@exts) = ("\\.cpp", "\\.cxx", "\\.c");
    $array = \@exts;
  }

  return $array;
}


sub override_exclude_component_extensions {
  my($self)  = shift;
  my($comp)  = shift;
  my($array) = undef;

  if ($comp eq 'source_files') {
    my(@exts) = ("_T\\.cpp", "_T\\.cxx");
    $array = \@exts;
  }

  return $array;
}


sub get_dll_exe_template_input_file {
  #my($self) = shift;
  return 'vc6dspdllexe';
}


sub get_lib_exe_template_input_file {
  #my($self) = shift;
  return 'vc6dsplibexe';
}


sub get_lib_template_input_file {
  #my($self) = shift;
  return 'vc6dsplib';
}


sub get_dll_template_input_file {
  #my($self) = shift;
  return 'vc6dspdll';
}


sub get_template {
  #my($self) = shift;
  return 'vc6dsp';
}


1;