3 package PerlACE
::MSProject
;
8 ###############################################################################
15 my $class = ref ($proto) || $proto;
18 $self->{FILENAME
} = shift;
19 $self->{VERSION
} = undef;
20 $self->{NAME
} = undef;
21 %{$self->{CONFIGS
}} = ();
23 bless ($self, $class);
27 ###############################################################################
36 $self->{FILENAME
} = shift;
39 return $self->{FILENAME
};
45 return $self->{VERSION
};
57 return keys %{$self->{CONFIGS
}};
65 if (!defined $config) {
66 print STDERR
"Error: No configuration specified\n";
70 my $name = $self->OutputFile ($config);
72 if ($name =~ m/\.dll$/) {
73 $name = $self->LibraryFile ($config);
76 $name =~ s/.*\\//; # / <- For devenv
87 if (!defined $config) {
88 print STDERR
"Error: No configuration specified\n";
92 if (%{$self->{CONFIGS
}}->{$config}->{LINK
} =~ m/out\:\"([^\"]*)\"/) {
95 elsif (defined $self->Name ()) {
96 my $filename = $self->Filename;
99 if (%{$self->{CONFIGS
}}->{$config}->{LINK
} =~ m/\/dll/) {
102 elsif (%{$self->{CONFIGS
}}->{$config}->{LINK
} =~ m/\/subsystem\
:/) {
109 $filename =~ s/\.[^\.]*$/$ext/;
121 if (!defined $config) {
122 print STDERR
"Error: No configuration specified\n";
126 if ($self->OutputFile ($config) =~ m/([^\/\\]*)\
.dll
$/i
) {
131 if (%{$self->{CONFIGS
}}->{$config}->{LINK
} =~ m/implib\:\"([^\"]*)\"/i) {
135 $dll =~ s/.*\\//ig; # / <- Just here to fix color coding in devenv beta
136 return $self->OutputDir ($config). $dll . ".lib";
146 if (!defined $config) {
147 print STDERR
"Error: No configuration specified\n";
151 return %{$self->{CONFIGS
}}->{$config}->{OUTPUTDIR
};
154 sub IntermidiateDir
($)
159 if (!defined $config) {
160 print STDERR
"Error: No configuration specified\n";
164 return %{$self->{CONFIGS
}}->{$config}->{INTERMEDIATEDIR
};
172 if (!defined $config) {
173 print STDERR
"Error: No configuration specified\n";
177 return %{$self->{CONFIGS
}}->{$config}->{TARGETDIR
};
185 if (!defined $config) {
186 print STDERR
"Error: No configuration specified\n";
190 return %{$self->{CONFIGS
}}->{$config}->{CPP
};
198 if (!defined $config) {
199 print STDERR
"Error: No configuration specified\n";
203 return %{$self->{CONFIGS
}}->{$config}->{LINK
};
211 if (!defined $config) {
212 print STDERR
"Error: No configuration specified\n";
216 return %{$self->{CONFIGS
}}->{$config}->{LIBS
};
223 return $self->{TAOIDL
};
230 return $self->{COMPILER
};
233 ###############################################################################
240 my $config = "Unknown";
244 my $fh = new FileHandle
;
246 unless ($fh->open ("<" . $self->{FILENAME
})) {
247 print "Could not open file ", $self->{FILENAME
}, ": ", $_;
252 if (m/^\#.*Project File - Name=\"([^\"]*)\"/) {
256 if (m/^\#.*Format Version (.*)/) {
257 $self->{VERSION
} = $1;
260 # Check for configurations
262 if (m/^\!.*IF \"\$\(CFG\)\" == \".* - (.*)$\"/) {
265 elsif (m/^\!ENDIF$/) {
269 # Check for directories
271 if (m/\# PROP Output_Dir \"(.*)\"/) {
272 %{$self->{CONFIGS
}}->{$config}->{OUTPUTDIR
} = $1;
274 elsif (m/\# PROP Intermediate_Dir \"(.*)\"/) {
275 %{$self->{CONFIGS
}}->{$config}->{INTERMEDIATEDIR
} = $1;
277 elsif (m/\# PROP Target_Dir \"(.*)\"/) {
278 %{$self->{CONFIGS
}}->{$config}->{TARGETDIR
} = $1;
281 # Look at CPP options
283 if (m/\# ADD BASE CPP(.*)$/ || m/\# ADD CPP(.*)$/) {
284 my @flags = split (/ \//, $1);
286 foreach my $flag (@flags) {
287 if ($flag && %{$self->{CONFIGS
}}->{$config}->{CPP
} !~ m/$flag/) {
288 %{$self->{CONFIGS
}}->{$config}->{CPP
} .= " /$flag";
292 elsif (m/\# SUBTRACT CPP(.*)$/ || m/\# SUBTRACT BASE CPP(.*)$/) {
293 my @flags = split (/ \//, $1);
295 foreach my $flag (@flags) {
296 if ($flag && %{$self->{CONFIGS
}}->{$config}->{CPP
} =~ m/$flag/) {
297 %{$self->{CONFIGS
}}->{$config}->{CPP
} =~ s/ \/$flag//g
;
302 # Look at LINK32 options
304 if (m/\# ADD BASE LINK32(.*)$/ || m/\# ADD LINK32(.*)$/
305 || m/\# ADD BASE LIB32(.*)$/ || m/\# ADD LIB32(.*)$/) {
306 my @flags = split (/ \//, $1);
308 foreach my $flag (@flags) {
310 my @libs = split (/ /, $flag);
312 foreach my $lib (@libs) {
313 if ($lib =~ m/\.lib$/) {
314 if (%{$self->{CONFIGS
}}->{$config}->{LIBS
} !~ m/\Q$lib\E/) {
315 %{$self->{CONFIGS
}}->{$config}->{LIBS
} .= " $lib";
321 if (!$found && $flag) {
322 my $shortflag = $flag;
323 if ($flag =~ m/^(.*)\:/) {
327 if (%{$self->{CONFIGS
}}->{$config}->{LINK
} !~ m/ \/$shortflag/) {
328 %{$self->{CONFIGS
}}->{$config}->{LINK
} .= " /$flag";
333 elsif (m/\# SUBTRACT BASE LINK32(.*)$/ || m/\# SUBTRACT LINK32(.*)$/
334 || m/\# SUBTRACT BASE LIB32(.*)$/ || m/\# SUBTRACT LIB32(.*)$/) {
335 my @flags = split (/ \//, $1);
337 foreach my $flag (@flags) {
338 my $shortflag = $flag;
339 if ($flag =~ m/^(.*)\:/) {
343 if ($flag && %{$self->{CONFIGS
}}->{$config}->{LINK
} =~ m/ (\/$shortflag\
:[^ ]*)/) {
344 %{$self->{CONFIGS
}}->{$config}->{LINK
} =~ s/ \Q$1\E//ig;
349 if (m/^\# Name \".* - (.*)\"/ && defined %{$self->{CONFIGS
}}->{"Unknown"}) {
350 %{$self->{CONFIGS
}}->{$1} = %{$self->{CONFIGS
}}->{"Unknown"};
351 delete %{$self->{CONFIGS
}}->{"Unknown"};
354 if (m/tao\_idl/ && m/\$\(InputName\)\.idl/ || m/tao\_idl/ && m/\$\(InputPath\)/) {
362 ###############################################################################
371 my $command = $self->Compiler () . " " . $self->Filename ()
373 . " /MAKE \"" . $self->Name ()
374 . " - " . $config . "\"";
384 my $command = $self->Compiler () . " " . $self->Filename ()
386 . " /MAKE \"" . $self->Name ()
387 . " - " . $config . "\" /CLEAN";