@@ -71,19 +71,44 @@ sub pre_workspace {
71
71
}
72
72
}
73
73
74
+ # TODO(sonndinh): Some platform information is configurable such as
75
+ # the path to an INTEGRITY installation, bsp name.
76
+ # Some other information is specific to ACE such as its root directory,
77
+ # its compilation and linking requirements (C++ version, flags, etc).
78
+ # These can be put in some form of input to MPC instead of hardcoded here.
79
+ # Update: We can use environment variables and command-line options:
80
+ # --expand_vars, -use_env. Or can use the -relative command-line option.
81
+ # The first option requires setting environment variables.
82
+ # The second option requires passing parameters to the -relative option.
83
+
74
84
# # Print out the preliminary information
75
85
print $fh " #!gbuild$crlf " ,
86
+ " macro __OS_DIR=C:\g hs\i nt1146$crlf " ,
87
+ " macro __BSP_NAME=sim800$crlf " ,
88
+ ' macro __BSP_DIR=${__OS_DIR}\${__BSP_NAME}$crlf' ,
89
+ " macro ACE_ROOT=%expand_path (.)$crlf " ,
90
+ ' macro __BUILD_DIR=${ACE_ROOT}\build$crlf' ,
91
+ ' macro __LIBS_DIR_BASE=${__OS_DIR}\libs$crlf' ,
76
92
" primaryTarget=$tgt$crlf " ,
93
+ ' customization=${__OS_DIR}\target\integrity.bod$crlf' ,
77
94
" [Project]$crlf " ,
78
- " \t --one_instantiation_per_object$crlf " ,
95
+ # "\t-DACE_HAS_CPP14$crlf",
96
+ " \t -gcc$crlf " ,
97
+ " \t --c++14$crlf " ,
98
+ " \t --libcxx$crlf " ,
79
99
" \t :sourceDir=.$crlf " ,
80
- " \t --std$crlf " ,
81
- " \t -language=cxx$crlf " ,
82
- " \t --long_long$crlf " ,
83
- " \t --new_style_casts$crlf " ;
100
+ ' \t:optionsFile=${__OS_DIR}\target\${__BSP_NAME}.opt$crlf' ,
101
+ ' \t-I${ACE_ROOT}$crlf' ,
102
+ " \t -language=cxx$crlf " ,
103
+ " \t --new_style_casts$crlf " ,
104
+ " \t -non_shared$crlf " ;
84
105
}
85
106
86
-
107
+ # TODO(sonndinh): Looks like this only support [INTEGRITY Application] with
108
+ # only one [Program] (i.e., executable) in the image. But this seems sufficient
109
+ # for most cases.
110
+ # How does a [INTEGRITY Application] gpj file look with more
111
+ # than one [Program]s and how does the corresponding .int file look?
87
112
sub create_integrity_project {
88
113
my ($self , $int_proj , $project , $type , $target ) = @_ ;
89
114
my $outdir = $self -> get_outdir();
@@ -111,9 +136,9 @@ sub create_integrity_project {
111
136
" AddressSpace$crlf " ,
112
137
" \t Filename\t\t\t $target$crlf " ,
113
138
" \t Language\t\t\t C++$crlf " ,
114
- " \t Library\t\t\t\t libINTEGRITY.so$crlf " ,
115
- " \t Library\t\t\t\t libc.so$crlf " ,
116
- " \t Library\t\t\t\t libscxx_e.so$crlf " ,
139
+ # "\tLibrary\t\t\t\tlibINTEGRITY.so$crlf",
140
+ # "\tLibrary\t\t\t\tlibc.so$crlf",
141
+ # "\tLibrary\t\t\t\tlibscxx_e.so$crlf",
117
142
" \t Task Initial$crlf " ,
118
143
" \t\t StackLength\t\t 0x8000$crlf " ,
119
144
" \t EndTask$crlf " ,
@@ -137,25 +162,34 @@ sub mix_settings {
137
162
my $integrity_project = (index ($tgt , ' integrity' ) >= 0);
138
163
my ($int_proj , $int_type , $target );
139
164
165
+ # (sonndinh): Go through the lines in this project's gpj file.
166
+ # Each line may result in some changes added to the workspace gpj file.
167
+ # The changes are returned in the $mix variable.
168
+ # In case the project is an
140
169
while (<$rh >) {
170
+ # (sonndinh): Don't need to add compiler/linker options to the workspace file.
171
+ # The gpj file for each individual project should have those already.
172
+ # In the workspace file (the top-level project file), only need to list the child projects.
141
173
if (/ ^\s *(\[ (Program|Library|Subproject)\] )\s *$ / ) {
142
174
my $type = $1 ;
143
175
if ($integrity_project && $type eq ' [Program]' ) {
144
- $int_proj = $project ;
145
- $int_proj =~ s / (\. gpj)$/ _int$1 / ;
146
- $int_type = $type ;
147
- $mix =~ s / (\. gpj)$/ _int$1 / ;
148
- $type = $integrity ;
176
+ $int_proj = $project ; # E.g., tests/ARGV_Test.gpj
177
+ $int_proj =~ s / (\. gpj)$/ _int$1 / ; # E.g., tests/ARGV_Test_int.gpj
178
+ $int_type = $type ; # E.g., [Program]
179
+ $mix =~ s / (\. gpj)$/ _int$1 / ; # E.g., tests/ARGV_Test_int.gpj
180
+ $type = $integrity ; # [INTEGRITY Application]
149
181
}
150
- $mix .= " \t\t $type$crlf " .
151
- " \t -object_dir=" . $self -> mpc_dirname($project ) .
152
- ' /.obj' . $crlf ;
182
+ $mix .= " \t\t $type$crlf " ;
183
+ # $mix .= "\t\t$type$crlf" .
184
+ # "\t-object_dir=" . $self->mpc_dirname($project) .
185
+ # '/.obj' . $crlf;
153
186
}
154
187
elsif (/ ^\s *(\[ Shared Object\] )\s *$ / ) {
155
- $mix .= " \t\t $1 $crlf " .
156
- " \t -pic$crlf " .
157
- " \t -object_dir=" . $self -> mpc_dirname($project ) .
158
- ' /.shobj' . $crlf ;
188
+ $mix .= " \t\t $1 $crlf " ;
189
+ # $mix .= "\t\t$1$crlf" .
190
+ # "\t-pic$crlf" .
191
+ # "\t-object_dir=" . $self->mpc_dirname($project) .
192
+ # '/.shobj' . $crlf;
159
193
}
160
194
elsif ($integrity_project && / ^(.*\. bsp)\s / ) {
161
195
push (@integ_bsps , $1 );
@@ -164,7 +198,7 @@ sub mix_settings {
164
198
if (/ ^\s *\- ((\w )\w *)/ ) {
165
199
# # Save the required options into the mixed project string
166
200
if (defined $directives {$2 } || defined $directives {$1 }) {
167
- $mix .= $_ ;
201
+ # $mix .= $_;
168
202
}
169
203
170
204
# # If this is an integrity project, we need to find out
@@ -189,7 +223,17 @@ sub mix_settings {
189
223
sub write_comps {
190
224
my ($self , $fh ) = @_ ;
191
225
192
- # # Print out each projet
226
+ # my $projects = $self->get_projects();
227
+ # my @list = $self->sort_dependencies($projects);
228
+
229
+ # foreach (@list) {
230
+ # print "$_\n";
231
+ # }
232
+
233
+ # TODO(sonndinh): Looks like the individual project files are produced before this happens.
234
+ # And this module relies on them to add contents to the workspace file (default.gpj in case of GHS).
235
+
236
+ # # Print out each project
193
237
foreach my $project ($self -> sort_dependencies($self -> get_projects(), 0)) {
194
238
print $fh $self -> mix_settings($project );
195
239
}
0 commit comments