1 # Win32 auto_compile script.
3 $ACE_ROOT = getcwd
()."\\";
4 warn "ACE_ROOT not defined, defaulting to ACE_ROOT=$ACE_ROOT";
7 $ACE_ROOT = $ENV{ACE_ROOT
};
10 use lib
"$ENV{ACE_ROOT}/bin";
13 use PerlACE
::Run_Test
;
18 @ace_dirs = ("$ACE_ROOT\\ace",
19 "$ACE_ROOT\\ACEXML\\common",
20 "$ACE_ROOT\\ACEXML\\parser",
21 "$ACE_ROOT\\ACEXML\\apps",
22 "$ACE_ROOT\\ACEXML\\tests",
23 "$ACE_ROOT\\ACEXML\\examples",
26 "$ACE_ROOT\\examples",
28 "$ACE_ROOT\\performance-tests",
29 "$ACE_ROOT\\protocols",
31 "$ACE_ROOT\\websvcs");
36 $Ignore_errors = 0; # By default, bail out if an error occurs.
42 $Build_Cmd = "/BUILD";
53 my ($project, $config) = @_;
60 print "Auto_compiling $project : $config\n";
62 print "Building $project $config\n" if $verbose;
64 return system ("msdev.com $project /MAKE \"$config\" $Build_Cmd $useenv");
71 my ($project, $config) = @_;
78 print "Auto_compiling $project : $config\n";
80 print "Building $project $config\n" if $verbose;
82 return system ("devenv.com $project $Build_Cmd $config $useenv");
93 $File::Find
::name
if ($File::Find
::name
=~ /\.dsw$/i);
96 find
(\
&wanted_dsw
, @dir);
98 print "List of dsw's \n" if ($verbose == 1);
109 $File::Find
::name
if ($File::Find
::name
=~ /\.sln$/i);
112 find
(\
&wanted_sln
, @dir);
114 print "List of sln's \n" if ($verbose == 1);
118 sub Rename_Files
($$)
120 my ($target) = shift;
121 my ($newext) = shift;
127 if ($File::Find
::name
=~ /^(.*)$text$/i) {
128 my ($newname) = $1 . $next;
129 rename ($File::Find
::name
, $newname);
133 find
(sub { wanted_file
($target, $newext) }, $ACE_ROOT);
136 # Only builds the core libraries.
139 print STDERR
"Building Core of ACE/TAO\n" if ($print_status == 1);
140 print "\nmsvc_static_compile: Building Core of ACE/TAO\n";
142 print "Build \n" if ($verbose);
143 print "Debug " if ($verbose) && ($Build_Debug);
144 print "Release " if ($verbose) && ($Build_Release);
145 print "LIB " if ($verbose) && ($Build_LIB);
146 print "\n" if ($verbose);
151 push (@file_list, "/bin/msvc_static_order.lst");
153 foreach my$test_lst (@file_list) {
154 my $config_list = new PerlACE
::ConfigList
;
155 $config_list->load ($ACE_ROOT.$test_lst);
157 foreach $test ($config_list->valid_entries ()) {
159 @plist = split (/\//, $test);
161 $fname_mod = $name_mod;
162 $fname_mod =~ s/\*/$fname/;
163 push @plist,($fname_mod);
164 push (@core_list, join('/', @plist) . $proj_ext);
167 push (@core_list, $test . $proj_ext);
174 foreach $c (@core_list) {
176 $Status = Build_VC7
($c, "debug");
177 return if $Status != 0 && !$Ignore_errors;
179 if ($Build_Release) {
180 $Status = Build_VC7
($c, "release");
181 return if $Status != 0 && !$Ignore_errors;
186 foreach $c (@core_list) {
188 $Status = Build
($c, "ALL - Win32 Debug");
189 return if $Status != 0 && !$Ignore_errors;
191 if ($Build_Release) {
192 $Status = Build
($c, "ALL - Win32 Release");
193 return if $Status != 0 && !$Ignore_errors;
202 my @configurations = Find_Dsw
(@directories);
204 print STDERR
"Building selected projects\n" if ($print_status == 1);
205 print "\nmsvc_static_compile: Building selected projects\n";
208 foreach $c (@configurations) {
209 print STDERR
"Configuration ".$count++." of ".$#configurations."\n" if ($print_status == 1);
211 $Status = Build
($c, "ALL - Win32 Debug");
212 return if $Status != 0 && !$Ignore_errors;
214 if ($Build_Release) {
215 $Status = Build
($c, "ALL - Win32 Release");
216 return if $Status != 0 && !$Ignore_errors;
223 my @configurations = Find_Sln
(@directories);
225 print STDERR
"Building selected projects\n" if ($print_status == 1);
226 print "\nmsvc_static_compile: Building selected projects\n";
229 foreach $c (@configurations) {
230 print STDERR
"Configuration ".$count++." of ".$#configurations."\n" if ($print_status == 1);
232 $Status = Build_VC7
($c, "debug");
233 return if $Status != 0 && !$Ignore_errors;
235 if ($Build_Release) {
236 $Status = Build_VC7
($c, "release");
237 return if $Status != 0 && !$Ignore_errors;
243 ## Parse command line argument
244 while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ )
246 if ($ARGV[0] =~ '-k') { # Ignore errors
247 print "Ignore errors\n" if ( $verbose );
250 elsif ($ARGV[0] =~ /^-d$/i) { # debug
253 elsif ($ARGV[0] =~ '-vc7') { # Use VC7 project and solution files.
254 print "Using VC7 files\n" if ( $verbose );
256 $proj_ext = '.vcproj';
258 elsif ($ARGV[0] =~ '-vc8') { # Use VC8 project and solution files.
259 print "Using VC8 files\n" if ( $verbose );
260 $vc7 = 1; # VC8 is like VC7
261 $proj_ext = '.vcproj';
263 elsif ($ARGV[0] =~ '-vc9') { # Use VC9 project and solution files.
264 print "Using VC9 files\n" if ( $verbose );
265 $vc7 = 1; # VC9 is like VC7
266 $proj_ext = '.vcproj';
268 elsif ($ARGV[0] =~ '-v') { # verbose mode
271 elsif ($ARGV[0] =~ '-name_modifier') { # use MPC name_modifier for project
273 print "Setting name_modifier $ARGV[0]\n" if ( $verbose );
274 $name_mod = $ARGV[0];
277 elsif ($ARGV[0] =~ '-s') { # status messages
280 elsif ($ARGV[0] =~ '-u') { # USEENV
281 print "Using Environment\n" if ($verbose);
284 elsif ($ARGV[0] =~ '-CORE') { # Build the core of ace/tao
285 print "Building only Core\n" if ( $verbose );
286 $build_core_only = 1;
288 elsif ($ARGV[0] =~ '-ACE') { # Build ACE and its programs
289 print "Building ACE\n" if ( $verbose );
291 push @directories, @ace_dirs;
293 elsif ($ARGV[0] =~ '-TAO') { # Build TAO and its programs
294 print "Building TAO\n" if ( $verbose );
296 # Other tests depend on the lib in this dir so we need to force it
297 # to the front of the build list. This is pretty ugly.
298 push @directories, ("$ACE_ROOT\\TAO\\orbsvcs\\tests\\Notify\\lib");
299 push @directories, ("$ACE_ROOT\\TAO");
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] =~ '-rebuild') { # Rebuild all
308 print "Rebuild all\n" if ( $verbose );
309 $Build_Cmd = "/REBUILD";
311 elsif ($ARGV[0] =~ '-clean') { # Clean
312 print "Cleaning all\n" if ( $verbose );
313 $Build_Cmd = "/CLEAN";
315 elsif ($ARGV[0] =~ '-Debug') { # Debug versions
316 print "Building Debug Version\n" if ( $verbose );
320 elsif ($ARGV[0] =~ '-Release') { # Release versions
321 print "Building Release Version\n" if ( $verbose );
325 elsif ($ARGV[0] =~ '-LIB') { # Build LIB only
326 print "Build LIB only\n" if ( $verbose );
330 elsif ($ARGV[0] =~ '-(\?|h)') { # Help information
332 print "-d = Debug (only print out projects)\n";
333 print "-k = Ignore Errors\n";
334 print "-v = Script verbose Mode\n";
335 print "-s = Print status messages to STDERR\n";
336 print "-u = Tell MSVC to use the environment\n";
337 print "-vc7 = Use MSVC 7 toolset\n";
338 print "-vc8 = Use MSVC 8 toolset\n";
339 print "-name_modifier <mod> = Use MPC name_modifier to match projects\n";
341 print "-CORE = Build the Core libraries\n";
342 print "-ACE = Build ACE and its programs\n";
343 print "-TAO = Build TAO and its programs\n";
344 print "-dir <dir> = Compile custom directories\n";
346 print "-rebuild = Rebuild All\n";
347 print "-clean = Clean\n";
348 print "-Debug = Compile Debug versions\n";
349 print "-Release = Compile Release versions\n";
350 print "-LIB = Comple LIB Configurations\n";
354 warn "$0: error unknown option $ARGV[0]\n";
360 if (!$Build_DLL && !$Build_LIB) {
365 if (!$Build_Debug && !$Build_Release) {
370 if ($#directories < 0) {
371 @directories = ($ACE_ROOT);
374 print "msvc_static_compile: Begin\n";
375 print STDERR
"Beginning Core Build\n" if ($print_status == 1);
376 if (!$use_custom_dir || $build_core_only) {
378 ## devenv is too smart for it's own good. When a .vcproj is specified,
379 ## as is done when building the CORE, it will find the solution to which
380 ## the .vcproj belongs and begin to build additional portions of the
381 ## solution. This is not what we want as dependencies are not set up
382 ## between library projects.
384 my($core_sln) = $sln . '.build_core';
386 Rename_Files
($sln, $core_sln);
388 foreach my $sig ('INT', 'TERM') {
389 $SIG{$sig} = sub { print STDERR
"Renaming solution files, please be patient...\n";
390 Rename_Files
($core_sln, $sln);
396 Rename_Files
($core_sln, $sln);
398 foreach my $sig ('INT', 'TERM') {
399 $SIG{$sig} = 'DEFAULT';
406 print STDERR
"Beginning Full Build\n" if ($print_status == 1);
408 Build_All_VC7
if !$build_core_only;
411 Build_All
if !$build_core_only;
414 print "msvc_static_compile: End\n";
415 print STDERR
"End\n" if ($print_status == 1);