Only generate common defines when we have those
[MPC.git] / modules / BCB2007WorkspaceCreator.pm
blob37af7601885e39138356c10b2c371524a9eb6e2a
1 package BCB2007WorkspaceCreator;
3 # ************************************************************
4 # Description : A BCB2007 Workspace Creator
5 # Author : Johnny Willemsen
6 # Create Date : 14/12/2005
7 # ************************************************************
9 # ************************************************************
10 # Pragmas
11 # ************************************************************
13 use strict;
15 use BCB2007ProjectCreator;
16 use BorlandPropertyBase;
17 use WinWorkspaceBase;
18 use WorkspaceCreator;
20 use vars qw(@ISA);
21 @ISA = qw(BorlandPropertyBase WinWorkspaceBase WorkspaceCreator);
23 # ************************************************************
24 # Subroutine Section
25 # ************************************************************
27 sub crlf {
28 #my $self = shift;
29 return "\n";
33 sub compare_output {
34 #my $self = shift;
35 return 1;
39 sub workspace_file_extension {
40 #my $self = shift;
41 return '.groupproj';
45 sub pre_workspace {
46 my($self, $fh) = @_;
47 my $crlf = $self->crlf();
49 ## This identifies it as a Borland C++Builder 2007 file
50 print $fh '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', $crlf;
52 ## Optionally print the workspace comment
53 # $self->print_workspace_comment($fh,
54 # '<!-- MPC Command -->', $crlf,
55 # '<!-- ', $self->create_command_line_string($0, @ARGV), ' -->',
56 # $crlf);
60 sub write_comps {
61 my($self, $fh) = @_;
62 my $crlf = $self->crlf();
63 my $project_info = $self->get_project_info();
64 my @projects = $self->sort_dependencies($self->get_projects(), 0);
66 ## Print GUID and personality information
67 print $fh ' <PropertyGroup>', $crlf,
68 ' <ProjectGuid>{1946f85e-487f-46b6-8e41-159cd446db35}</ProjectGuid>', $crlf,
69 ' </PropertyGroup>', $crlf,
70 ' <ItemGroup />', $crlf,
71 ' <ItemGroup />', $crlf,
72 ' <ProjectExtensions>', $crlf,
73 ' <Borland.Personality>Default.Personality</Borland.Personality>', $crlf,
74 ' <Borland.ProjectType />', $crlf,
75 ' <BorlandProject>', $crlf,
76 ' <BorlandProject xmlns=""> <Default.Personality> </Default.Personality> </BorlandProject></BorlandProject>', $crlf,
77 ' </ProjectExtensions>', $crlf;
79 ## Print the project targets
80 foreach my $project (@projects) {
81 my $name = $$project_info{$project}->[ProjectCreator::PROJECT_NAME];
82 print $fh ' <Target Name="', $name, '">', $crlf,
83 ' <MSBuild Projects="', $self->mpc_basename($project), '" Targets="" />', $crlf,
84 ' </Target>', $crlf,
85 ' <Target Name="', $name, ':Make">', $crlf,
86 ' <MSBuild Projects="', $self->mpc_basename($project), '" Targets="Make" />', $crlf,
87 ' </Target>', $crlf,
88 ' <Target Name="', $name, ':Clean">', $crlf,
89 ' <MSBuild Projects="', $self->mpc_basename($project), '" Targets="Clean" />', $crlf,
90 ' </Target>', $crlf;
93 ## Print the target build order
94 print $fh ' <Target Name="Build">', $crlf,
95 ' <CallTarget Targets="';
96 foreach my $project (@projects) {
97 print $fh $$project_info{$project}->[ProjectCreator::PROJECT_NAME], ';';
100 ## Print the target make order
101 print $fh '" />', $crlf,
102 ' </Target>', $crlf,
103 ' <Target Name="Make">', $crlf,
104 ' <CallTarget Targets="';
105 foreach my $project (@projects) {
106 print $fh $$project_info{$project}->[ProjectCreator::PROJECT_NAME],
107 ':Make;';
110 ## Print the target clean order
111 print $fh '" />', $crlf,
112 ' </Target>', $crlf,
113 ' <Target Name="Clean">', $crlf,
114 ' <CallTarget Targets="';
115 foreach my $project (@projects) {
116 print $fh $$project_info{$project}->[ProjectCreator::PROJECT_NAME],
117 ':Clean;';
119 print $fh '" />', $crlf,
120 ' </Target>', $crlf,
121 '</Project>', $crlf;