107 |
bj |
1 |
package VC7WorkspaceCreator;
|
|
|
2 |
|
|
|
3 |
# ************************************************************
|
|
|
4 |
# Description : A VC7 Workspace Creator
|
|
|
5 |
# Author : Chad Elliott
|
|
|
6 |
# Create Date : 5/14/2002
|
|
|
7 |
# ************************************************************
|
|
|
8 |
|
|
|
9 |
# ************************************************************
|
|
|
10 |
# Pragmas
|
|
|
11 |
# ************************************************************
|
|
|
12 |
|
|
|
13 |
use strict;
|
|
|
14 |
|
|
|
15 |
use VC7ProjectCreator;
|
|
|
16 |
use WorkspaceCreator;
|
|
|
17 |
|
|
|
18 |
use vars qw(@ISA);
|
|
|
19 |
@ISA = qw(WorkspaceCreator);
|
|
|
20 |
|
|
|
21 |
# ************************************************************
|
|
|
22 |
# Data Section
|
|
|
23 |
# ************************************************************
|
|
|
24 |
|
|
|
25 |
my(%guids) = ('cplusplus' => '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
|
|
|
26 |
'csharp' => 'FAE04EC0-301F-11D3-BF4B-00C04F79EFBC',
|
|
|
27 |
'vb' => 'F184B08F-C81C-45F6-A57F-5ABD9991F28F',
|
|
|
28 |
);
|
|
|
29 |
|
|
|
30 |
# ************************************************************
|
|
|
31 |
# Subroutine Section
|
|
|
32 |
# ************************************************************
|
|
|
33 |
|
|
|
34 |
sub compare_output {
|
|
|
35 |
#my($self) = shift;
|
|
|
36 |
return 1;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
sub crlf {
|
|
|
41 |
my($self) = shift;
|
|
|
42 |
return $self->windows_crlf();
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
sub workspace_file_name {
|
|
|
47 |
my($self) = shift;
|
|
|
48 |
return $self->get_modified_workspace_name($self->get_workspace_name(),
|
|
|
49 |
'.sln');
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
sub pre_workspace {
|
|
|
54 |
my($self) = shift;
|
|
|
55 |
my($fh) = shift;
|
|
|
56 |
my($crlf) = $self->crlf();
|
|
|
57 |
|
|
|
58 |
print $fh 'Microsoft Visual Studio Solution File, Format Version 7.00', $crlf,
|
|
|
59 |
'#', $crlf,
|
|
|
60 |
'# $Id: VC7WorkspaceCreator.pm 217 2006-05-05 09:35:48Z bj $', $crlf,
|
|
|
61 |
'#', $crlf,
|
|
|
62 |
'# This file was generated by MPC. Any changes made directly to', $crlf,
|
|
|
63 |
'# this file will be lost the next time it is generated.', $crlf,
|
|
|
64 |
'#', $crlf,
|
|
|
65 |
'# MPC Command:', $crlf,
|
|
|
66 |
"# $0 @ARGV", $crlf;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
sub print_inner_project {
|
|
|
71 |
#my($self) = shift;
|
|
|
72 |
#my($fh) = shift;
|
|
|
73 |
#my($gen) = shift;
|
|
|
74 |
#my($pguid) = shift;
|
|
|
75 |
#my($deps) = shift;
|
|
|
76 |
#my($name) = shift;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
sub print_configs {
|
|
|
81 |
my($self) = shift;
|
|
|
82 |
my($fh) = shift;
|
|
|
83 |
my($configs) = shift;
|
|
|
84 |
my($crlf) = $self->crlf();
|
|
|
85 |
my($count) = 0;
|
|
|
86 |
|
|
|
87 |
foreach my $key (sort keys %$configs) {
|
|
|
88 |
print $fh "\t\tConfigName.$count = $key$crlf";
|
|
|
89 |
$count++;
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
sub print_dependencies {
|
|
|
95 |
my($self) = shift;
|
|
|
96 |
my($fh) = shift;
|
|
|
97 |
my($gen) = shift;
|
|
|
98 |
my($list) = shift;
|
|
|
99 |
my($pjs) = shift;
|
|
|
100 |
my($crlf) = $self->crlf();
|
|
|
101 |
|
|
|
102 |
## I hate to add yet another loop through all the projects, but
|
|
|
103 |
## we must have some way to map plain project names to guids.
|
|
|
104 |
my(%name_to_guid_map) = ();
|
|
|
105 |
foreach my $project (@$list) {
|
|
|
106 |
my($name, $deps, $guid) = @{$$pjs{$project}};
|
|
|
107 |
$name_to_guid_map{$name} = $guid;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
## Project Dependencies
|
|
|
111 |
print $fh "\tGlobalSection(ProjectDependencies) = postSolution$crlf";
|
|
|
112 |
foreach my $project (@$list) {
|
|
|
113 |
my($name, $rawdeps, $project_guid) = @{$$pjs{$project}};
|
|
|
114 |
my($deps) = $self->get_validated_ordering($project);
|
217 |
bj |
115 |
if (defined $$deps[0]) {
|
|
|
116 |
my($i) = 0;
|
|
|
117 |
foreach my $dep (@$deps) {
|
107 |
bj |
118 |
my($guid) = $name_to_guid_map{$dep};
|
217 |
bj |
119 |
if (defined $guid) {
|
107 |
bj |
120 |
print $fh "\t\t{$project_guid}.$i = {$guid}$crlf";
|
|
|
121 |
$i++;
|
|
|
122 |
}
|
|
|
123 |
}
|
|
|
124 |
}
|
|
|
125 |
}
|
|
|
126 |
print $fh "\tEndGlobalSection$crlf";
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
sub write_comps {
|
|
|
131 |
my($self) = shift;
|
|
|
132 |
my($fh) = shift;
|
|
|
133 |
my($gen) = shift;
|
|
|
134 |
my($projects) = $self->get_projects();
|
|
|
135 |
my($pjs) = $self->get_project_info();
|
|
|
136 |
my(@list) = sort @$projects;
|
|
|
137 |
my($crlf) = $self->crlf();
|
|
|
138 |
|
|
|
139 |
## I hate to add yet another loop through all the projects, but
|
|
|
140 |
## we must have some way to map plain project names to guids.
|
|
|
141 |
my(%name_to_guid_map) = ();
|
|
|
142 |
foreach my $project (@list) {
|
|
|
143 |
my($name, $deps, $guid) = @{$$pjs{$project}};
|
|
|
144 |
$name_to_guid_map{$name} = $guid;
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
## Project Information
|
|
|
148 |
foreach my $project (@list) {
|
217 |
bj |
149 |
my($name, $rawdeps, $guid, $language) = @{$$pjs{$project}};
|
|
|
150 |
my($pguid) = $guids{$language};
|
107 |
bj |
151 |
my($deps) = $self->get_validated_ordering($project);
|
|
|
152 |
## Convert all /'s to \
|
217 |
bj |
153 |
my($cpy) = $project;
|
|
|
154 |
$cpy =~ s/\//\\/g;
|
|
|
155 |
print $fh "Project(\"{$pguid}\") = \"$name\", \"$cpy\", \"{$guid}\"$crlf";
|
107 |
bj |
156 |
$self->print_inner_project($fh, $gen, $guid, $deps, $name, \%name_to_guid_map);
|
|
|
157 |
print $fh "EndProject$crlf";
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
print $fh "Global$crlf",
|
|
|
161 |
"\tGlobalSection(",
|
|
|
162 |
$self->get_solution_config_section_name(),
|
|
|
163 |
") = preSolution$crlf";
|
|
|
164 |
|
|
|
165 |
my(%configs) = ();
|
|
|
166 |
foreach my $project (@list) {
|
217 |
bj |
167 |
my($name, $deps, $pguid, $lang, @cfgs) = @{$$pjs{$project}};
|
107 |
bj |
168 |
foreach my $cfg (@cfgs) {
|
|
|
169 |
$cfg = $self->get_short_config_name($cfg);
|
|
|
170 |
$configs{$cfg} = 1;
|
|
|
171 |
}
|
|
|
172 |
}
|
|
|
173 |
$self->print_configs($fh, \%configs);
|
|
|
174 |
print $fh "\tEndGlobalSection$crlf";
|
|
|
175 |
|
|
|
176 |
## Print dependencies if there are any
|
|
|
177 |
$self->print_dependencies($fh, $gen, \@list, $pjs);
|
|
|
178 |
|
|
|
179 |
## Project Configuration Names
|
|
|
180 |
print $fh "\tGlobalSection(",
|
|
|
181 |
$self->get_project_config_section_name(),
|
|
|
182 |
") = postSolution$crlf";
|
|
|
183 |
|
|
|
184 |
foreach my $project (@list) {
|
217 |
bj |
185 |
my($name, $deps, $pguid, $lang, @cfgs) = @{$$pjs{$project}};
|
107 |
bj |
186 |
foreach my $cfg (sort @cfgs) {
|
|
|
187 |
my($c) = $self->get_short_config_name($cfg);
|
|
|
188 |
print $fh "\t\t{$pguid}.$c.ActiveCfg = $cfg$crlf" .
|
|
|
189 |
"\t\t{$pguid}.$c.Build.0 = $cfg$crlf";
|
|
|
190 |
}
|
|
|
191 |
}
|
|
|
192 |
print $fh "\tEndGlobalSection$crlf";
|
|
|
193 |
|
|
|
194 |
$self->print_additional_sections($fh);
|
|
|
195 |
|
|
|
196 |
print $fh "EndGlobal$crlf";
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
sub get_short_config_name {
|
|
|
201 |
my($self) = shift;
|
|
|
202 |
my($cfg) = shift;
|
|
|
203 |
$cfg =~ s/\|.*//;
|
|
|
204 |
return $cfg;
|
|
|
205 |
}
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
sub get_solution_config_section_name {
|
|
|
209 |
#my($self) = shift;
|
|
|
210 |
return 'SolutionConfiguration';
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
sub get_project_config_section_name {
|
|
|
215 |
#my($self) = shift;
|
|
|
216 |
return 'ProjectConfiguration';
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
sub print_additional_sections {
|
|
|
221 |
my($self) = shift;
|
|
|
222 |
my($fh) = shift;
|
|
|
223 |
my($crlf) = $self->crlf();
|
|
|
224 |
|
|
|
225 |
print $fh "\tGlobalSection(ExtensibilityGlobals) = postSolution$crlf",
|
|
|
226 |
"\tEndGlobalSection$crlf",
|
|
|
227 |
"\tGlobalSection(ExtensibilityAddIns) = postSolution$crlf",
|
|
|
228 |
"\tEndGlobalSection$crlf";
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
1;
|