1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
5 # Win32 auto_compile script.
10 if (!$ENV{ACE_ROOT
}) {
11 $ACE_ROOT = getcwd
()."\\";
12 warn "ACE_ROOT not defined, defaulting to ACE_ROOT=$ACE_ROOT";
15 $ACE_ROOT = $ENV{ACE_ROOT
};
16 $TAO_ROOT = $ENV{TAO_ROOT
};
21 @ace_core_dirs = ("$ACE_ROOT\\ace",
24 "$ACE_ROOT\\examples",
26 "$ACE_ROOT\\protocols");
28 @tao_core_dirs = ("$ACE_ROOT\\apps\\gperf\\src",
33 @orbsvcs_core_dirs = ("$TAO_ROOT\\orbsvcs\\orbsvcs");
38 $Ignore_errors = 0; # By default, bail out if an error occurs.
42 $Build_Cmd = "/BUILD";
46 $project_root = "$ACE_ROOT";
48 # Build_Config takes in a string of the type "project--configuration" and
49 # runs msdev to build it.
50 # sub Build_Config ($)
53 # my ($project, $config) = split /--/, $arg;
55 # return Build ($project, $config);
61 my ($project, $config) = @_;
68 print "Auto_compiling $project : $config\n";
70 print "Building $project $config\n" if $verbose;
72 return system ("msdev.com $project /MAKE \"$config\" $Build_Cmd $useenv");
79 my ($project, $config) = @_;
86 print "Auto_compiling $project : $config\n";
88 print "Building $project $config\n" if $verbose;
90 return system ("devenv.com $project $Build_Cmd $config $useenv");
101 $File::Find
::name
if ($File::Find
::name
=~ /\.dsw$/i);
104 find
(\
&wanted_dsw
, @dir);
106 print "List of dsw's\n" if ($verbose == 1);
115 print "Searching for list of sln's\n" if ($verbose == 1);
119 $File::Find
::name
if ($File::Find
::name
=~ /\.sln$/i);
122 find
(\
&wanted_sln
, @dir);
124 print "List of sln's\n" if ($verbose == 1);
128 # Only builds the core libraries.
131 print STDERR
"Building Custom\n";
132 print "Building Custom directories specified\n";# if ($verbose == 1);
134 print "Build " if ($verbose);
135 print "Debug " if ($verbose) && ($Build_Debug);
136 print "Release " if ($verbose) && ($Build_Release);
137 print "\n" if ($verbose);
139 my @custom_list = Find_Dsw
(@directories);
141 print "List now is @custom_list \n";
142 foreach $c (@custom_list) {
143 print "List now is $c \n";
145 $Status = Build
($c, "ALL - Win32 Debug");
146 return if $Status != 0 && !$Ignore_errors;
148 if ($Build_Release) {
149 $Status = Build
($c, "ALL - Win32 Release");
150 return if $Status != 0 && !$Ignore_errors;
155 # Build all examples and directories
158 push @directories, @ace_core_dirs;
159 push @directories, @tao_core_dirs;
160 push @directories, @orbsvcs_core_dirs;
162 print STDERR
"First pass (libraries)\n" if ($print_status == 1);
163 print "\nmsvc_mpc_auto_compile: First Pass CORE (libraries)\n";
167 my @new_directory_search = "$project_root";
169 my @configurations = Find_Dsw
(@new_directory_search);
171 print STDERR
"Second pass (for other things)\n" if ($print_status == 1);
172 print "\nmsvc_mpc_auto_compile: Second Pass (rest of the stuff)\n";
174 foreach $c (@configurations) {
175 print "\nUsing $c for compilation\n";
177 $Status = Build
($c, "ALL - Win32 Debug");
178 return if $Status != 0 && !$Ignore_errors;
180 if ($Build_Release) {
181 $Status = Build
($c, "ALL - Win32 Release");
182 return if $Status != 0 && !$Ignore_errors;
188 # Only builds the core libraries.
189 sub Build_Custom_VC7
()
191 print STDERR
"Building Custom\n";
192 print "Building Custom directories specified\n";# if ($verbose == 1);
194 print "Build " if ($verbose);
195 print "Debug " if ($verbose) && ($Build_Debug);
196 print "Release " if ($verbose) && ($Build_Release);
197 print "\n" if ($verbose);
199 my @custom_list = Find_Sln
(@directories);
201 print "List now is @custom_list \n";
202 foreach $c (@custom_list) {
203 print "List now is $c \n";
205 $Status = Build_VC7
($c, "debug");
206 return if $Status != 0 && !$Ignore_errors;
208 if ($Build_Release) {
209 $Status = Build_VC7
($c, "release");
210 return if $Status != 0 && !$Ignore_errors;
215 # Build all examples and directories
218 push @directories, @ace_core_dirs;
219 push @directories, @tao_core_dirs;
220 push @directories, @orbsvcs_core_dirs;
222 print STDERR
"First pass (libraries)\n" if ($print_status == 1);
223 print "\nmsvc_mpc_auto_compile: First Pass CORE (libraries)\n";
227 my @new_directory_search = "$project_root";
229 my @configurations = Find_Sln
(@new_directory_search);
231 print STDERR
"Second pass (for other things)\n" if ($print_status == 1);
232 print "\nmsvc_mpc_auto_compile: Second Pass (rest of the stuff)\n";
234 foreach $c (@configurations) {
235 print "\nUsing $c for compilation\n";
237 $Status = Build_VC7
($c, "debug");
238 return if $Status != 0 && !$Ignore_errors;
240 if ($Build_Release) {
241 $Status = Build_VC7
($c, "release");
242 return if $Status != 0 && !$Ignore_errors;
247 ## Parse command line argument
248 while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ )
250 if ($ARGV[0] =~ '-k') { # Ignore errors
251 print "Ignore errors\n" if ( $verbose );
254 elsif ($ARGV[0] =~ /^-d$/i) { # debug
257 elsif ($ARGV[0] =~ '-vc7') { # Use VC7 project and solution files.
258 print "Using VC7 files\n" if ( $verbose );
261 elsif ($ARGV[0] =~ '-vc8') { # Use VC8 project and solution files.
262 print "Using VC8 files\n" if ( $verbose );
263 $vc7 = 1; # vc8 is like vc7
265 elsif ($ARGV[0] =~ '-vc9') { # Use VC9 project and solution files.
266 print "Using VC9 files\n" if ( $verbose );
267 $vc7 = 1; # vc9 is like vc7
269 elsif ($ARGV[0] =~ '-v') { # verbose mode
272 elsif ($ARGV[0] =~ '-s') { # status messages
275 elsif ($ARGV[0] =~ '-u') { # USEENV
276 print "Using Environment\n" if ($verbose);
279 elsif ($ARGV[0] =~ '-ACE') {# Build ACE and its tests
280 print "Building ACE\n" if ( $verbose );
282 push @directories, @ace_core_dirs;
284 elsif ($ARGV[0] =~ '-TAO') {# Build TAO and its tests
285 print "Building TAO\n" if ( $verbose );
287 push @directories, @ace_core_dirs;
288 push @directories, @tao_core_dirs;
290 elsif ($ARGV[0] =~ '-ORBSVCS') {# Build TAO/ORBSVCS and its tests
291 print "Building ACE+TAO+orbsvcs\n" if ( $verbose );
293 push @directories, @ace_core_dirs;
294 push @directories, @tao_core_dirs;
295 push @directories, @orbsvcs_core_dirs;
297 elsif ($ARGV[0] =~ '-ALL') {# Build all
298 print "Building ALL \n" if ( $verbose );
301 elsif ($ARGV[0] =~ '-dir') { # Compile only a specific directory
303 print "Adding directory $ARGV[0]\n" if ( $verbose );
305 push @directories, $ARGV[0];
307 elsif ($ARGV[0] =~ '-project_root') { # use different root than ACE_ROOT
309 print "Using project root $ARGV[0]\n" if ( $verbose );
310 $project_root = $ARGV[0];
312 elsif ($ARGV[0] =~ '-rebuild') { # Rebuild all
313 print "Rebuild all\n" if ( $verbose );
314 $Build_Cmd = "/REBUILD";
316 elsif ($ARGV[0] =~ '-clean') { # Clean
317 print "Cleaning all\n" if ( $verbose );
318 $Build_Cmd = "/CLEAN";
320 elsif ($ARGV[0] =~ '-Debug') { # Debug versions
321 print "Building Debug Version\n" if ( $verbose );
324 elsif ($ARGV[0] =~ '-Release') { # Release versions
325 print "Building Release Version\n" if ( $verbose );
328 elsif ($ARGV[0] =~ '-(\?|h)') { # Help information
330 print "-d = Debug (only print out projects)\n";
331 print "-k = Ignore Errors\n";
332 print "-v = Script verbose Mode\n";
333 print "-s = Print status messages to STDERR\n";
334 print "-u = Tell MSVC to use the environment\n";
335 print "-vc7 = Use MSVC 7 toolset\n";
336 print "-vc8 = Use MSVC 8 toolset\n";
337 print "-vc9 = Use MSVC 9 toolset\n";
339 print "-ACE = Build ACE and its tests\n";
340 print "-TAO = Build ACE+TAO and its tests\n";
341 print "-ORBSVCS = Build ACE+TAO+ORBSVCS and its tests\n";
342 print "-dir <dir> = Compile custom directories\n";
343 print "-project_root <dir> = Use different root directory than ACE_ROOT\n";
345 print "-rebuild = Rebuild All\n";
346 print "-clean = Clean\n";
347 print "-Debug = Compile Debug versions\n";
348 print "-Release = Compile Release versions\n";
352 warn "$0: error unknown option $ARGV[0]\n";
358 if (!$Build_Debug && !$Build_Release) {
363 print "MPC version of msvc_mpc_auto_compile: Begin\n";
365 Build_All_VC7
if ($build_all && !$use_custom_dir);
366 Build_Custom_VC7
if $use_custom_dir;
369 Build_All
if ($build_all && !$use_custom_dir);
370 Build_Custom
if $use_custom_dir;
372 print "msvc_mpc_auto_compile: End\n";
373 print STDERR
"End\n" if ($print_status == 1);