summaryrefslogtreecommitdiff
path: root/bin/msvc_static_compile.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/msvc_static_compile.pl')
-rwxr-xr-xbin/msvc_static_compile.pl233
1 files changed, 92 insertions, 141 deletions
diff --git a/bin/msvc_static_compile.pl b/bin/msvc_static_compile.pl
index 38531cb0563..e9c5d545269 100755
--- a/bin/msvc_static_compile.pl
+++ b/bin/msvc_static_compile.pl
@@ -42,31 +42,72 @@ $build_core_only = 0;
$Build_Cmd = "/BUILD";
$use_custom_dir = 0;
$useenv = '';
-$vc7 = 0;
-$name_mod = '';
-$mod_name = 0;
-$proj_ext = '.dsp';
-# Build
-sub Build ($$)
+# Find_dsp will search a directory for *.dsp files and return a list
+# of strings that include the project name and the configuration
+sub Find_dsp (@)
{
- my ($project, $config) = @_;
+ my (@dir) = @_;
+ @array = ();
+ my @config_array = ();
- if ($debug == 1) {
- print "$project\n";
- return 0;
- }
- else {
- print "Auto_compiling $project : $config\n";
+ # wanted is only used for the File::Find
+ sub wanted
+ {
+ $array[++$#array] = $File::Find::name if ($File::Find::name =~ /\.dsp$/i);
+ }
- print "Building $project $config\n" if $verbose;
+ # get_config grabs the configurations out of a dsp file.
+ sub get_config ($)
+ {
+ my ($file) = @_;
+ my @configs = ();
- return system ("msdev.com $project /MAKE \"$config\" $Build_Cmd $useenv");
- }
+ print "Looking at $file\n" if ($verbose);
+
+ open (DSP, "< $file") || die $!;
+
+ while (<DSP>)
+ {
+ push @configs, $1 if (/# Name \"([^\"]+)\"/);
+ }
+
+ close (DSP);
+ return @configs;
+ }
+
+ unshift @dir, (\&wanted);
+
+ find @dir;
+
+ for ($i = 0; $i <= $#array; ++$i) {
+ my $filename = "$array[$i]";
+
+ $filename =~ s@/./@/@g;
+ $filename =~ s@/@\\@g;
+ my @dsp_configs = get_config ($array[$i]);
+
+ for ($j = 0; $j <= $#dsp_configs; ++$j) {
+ push @config_array, "$filename--$dsp_configs[$j]";
+ }
+ }
+
+ return @config_array;
+}
+
+
+# Build_Config takes in a string of the type "project--configuration" and
+# runs msdev to build it.
+sub Build_Config ($)
+{
+ my ($arg) = @_;
+ my ($project, $config) = split /--/, $arg;
+
+ return Build ($project, $config);
}
# Build
-sub Build_VC7 ($$)
+sub Build ($$)
{
my ($project, $config) = @_;
@@ -79,47 +120,15 @@ sub Build_VC7 ($$)
print "Building $project $config\n" if $verbose;
- return system ("devenv.com $project $Build_Cmd $config $useenv");
+ return system ("msdev.com $project /MAKE \"$config\" $Build_Cmd $useenv");
}
}
-sub Find_Dsw (@)
-{
- my (@dir) = @_;
- @array = ();
-
- sub wanted_dsw {
- $array[++$#array] =
- $File::Find::name if ($File::Find::name =~ /\.dsw$/i);
- }
-
- find (\&wanted_dsw, @dir);
-
- print "List of dsw's \n" if ($verbose == 1);
- return @array;
-}
-
-sub Find_Sln (@)
-{
- my (@dir) = @_;
- @array = ();
-
- sub wanted_sln {
- $array[++$#array] =
- $File::Find::name if ($File::Find::name =~ /\.sln$/i);
- }
-
- find (\&wanted_sln, @dir);
-
- print "List of sln's \n" if ($verbose == 1);
- return @array;
-}
-
# Only builds the core libraries.
sub Build_Core ()
{
print STDERR "Building Core of ACE/TAO\n" if ($print_status == 1);
- print "\nmsvc_static_compile: Building Core of ACE/TAO\n";
+ print "Building Core of ACE/TAO\n" if ($verbose == 1);
print "Build \n" if ($verbose);
print "Debug " if ($verbose) && ($Build_Debug);
@@ -137,87 +146,53 @@ sub Build_Core ()
$config_list->load ($ACE_ROOT.$test_lst);
foreach $test ($config_list->valid_entries ()) {
- if ($mod_name) {
- @plist = split(/\//, $test);
- $fname = pop @plist;
- $fname_mod = $name_mod;
- $fname_mod =~ s/\*/$fname/;
- push @plist,($fname_mod);
- push (@core_list, join('/', @plist) . $proj_ext);
- }
- else {
- push (@core_list, $test . $proj_ext);
+ push (@core_list, $test);
}
- }
- }
-
-
- if ( $vc7 ) {
- foreach $c (@core_list) {
- if ($Build_Debug) {
- $Status = Build_VC7 ($c, "debug");
- return if $Status != 0 && !$Ignore_errors;
- }
- if ($Build_Release) {
- $Status = Build_VC7 ($c, "release");
- return if $Status != 0 && !$Ignore_errors;
- }
+ }
+
+
+ foreach $c (@core_list) {
+ if ($Build_Debug) {
+ $Status = Build ($c, "ALL - Win32 Debug");
+ return if $Status != 0 && !$Ignore_errors;
}
- }
- else {
- foreach $c (@core_list) {
- if ($Build_Debug) {
- $Status = Build ($c, "ALL - Win32 Debug");
- return if $Status != 0 && !$Ignore_errors;
- }
- if ($Build_Release) {
- $Status = Build ($c, "ALL - Win32 Release");
- return if $Status != 0 && !$Ignore_errors;
- }
+ if ($Build_Release) {
+ $Status = Build ($c, "ALL - Win32 Release");
+ return if $Status != 0 && !$Ignore_errors;
}
- }
+ }
}
}
sub Build_All ()
{
- my @configurations = Find_Dsw (@directories);
+ my @configurations = Find_dsp (@directories);
- print STDERR "Building selected projects\n" if ($print_status == 1);
- print "\nmsvc_static_compile: Building selected projects\n";
+ print STDERR "First pass (libraries)\n" if ($print_status == 1);
+ print "\nmsvc_auto_compile: First Pass (libraries)\n";
- $count = 0;
foreach $c (@configurations) {
- print STDERR "Configuration ".$count++." of ".$#configurations."\n" if ($print_status == 1);
- if ($Build_Debug) {
- $Status = Build ($c, "ALL - Win32 Debug");
- return if $Status != 0 && !$Ignore_errors;
- }
- if ($Build_Release) {
- $Status = Build ($c, "ALL - Win32 Release");
- return if $Status != 0 && !$Ignore_errors;
+ if ($Build_All
+ || ($Build_LIB && $Build_Debug && $c =~ /Win32 Debug/)
+ || ($Build_LIB && $Build_Release && $c =~ /Win32 Release/))
+ {
+ my $Status = 0;
+ $Status = Build_Config ($c)
+ if (($c =~ /Library/) || ($c =~ / DLL /) || ($c =~ / LIB /));
+ return if ($Status != 0 && !$Ignore_errors);
}
}
-}
-sub Build_All_VC7 ()
-{
- my @configurations = Find_Sln (@directories);
- print STDERR "Building selected projects\n" if ($print_status == 1);
- print "\nmsvc_static_compile: Building selected projects\n";
+ print STDERR "Second pass \n" if ($print_status == 1);
+ print "\nmsvc_auto_compile: Second Pass\n";
$count = 0;
foreach $c (@configurations) {
print STDERR "Configuration ".$count++." of ".$#configurations."\n" if ($print_status == 1);
- if ($Build_Debug) {
- $Status = Build_VC7 ($c, "debug");
- return if $Status != 0 && !$Ignore_errors;
- }
- if ($Build_Release) {
- $Status = Build_VC7 ($c, "release");
- return if $Status != 0 && !$Ignore_errors;
- }
+ Build_Config ($c)
+ if (($Build_LIB && $Build_Debug && $c =~ /Win32 Debug/)
+ || ($Build_LIB && $Build_Release && $c =~ /Win32 Release/));
}
}
@@ -232,25 +207,9 @@ while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ )
elsif ($ARGV[0] =~ /^-d$/i) { # debug
$debug = 1;
}
- elsif ($ARGV[0] =~ '-vc7') { # Use VC7 project and solution files.
- print "Using VC7 files\n" if ( $verbose );
- $vc7 = 1;
- $proj_ext = '.vcproj';
- }
- elsif ($ARGV[0] =~ '-vc8') { # Use VC8 project and solution files.
- print "Using VC8 files\n" if ( $verbose );
- $vc7 = 1; # VC8 is like VC7
- $proj_ext = '.vcproj';
- }
elsif ($ARGV[0] =~ '-v') { # verbose mode
$verbose = 1;
}
- elsif ($ARGV[0] =~ '-name_modifier') { # use MPC name_modifier for project
- shift;
- print "Setting name_modifier $ARGV[0]\n" if ( $verbose );
- $name_mod = $ARGV[0];
- $mod_name = 1;
- }
elsif ($ARGV[0] =~ '-s') { # status messages
$print_status = 1;
}
@@ -270,7 +229,7 @@ while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ )
elsif ($ARGV[0] =~ '-TAO') { # Build TAO and its programs
print "Building TAO\n" if ( $verbose );
$use_custom_dir = 1;
- # Other tests depend on the lib in this dir so we need to force it
+ # Other tests depend on the lib in this dir so we need to force it
# to the front of the build list. This is pretty ugly.
push @directories, ("$ACE_ROOT\\TAO\\orbsvcs\\tests\\Notify\\lib");
push @directories, ("$ACE_ROOT\\TAO");
@@ -311,9 +270,6 @@ while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ )
print "-v = Script verbose Mode\n";
print "-s = Print status messages to STDERR\n";
print "-u = Tell MSVC to use the environment\n";
- print "-vc7 = Use MSVC 7 toolset\n";
- print "-vc8 = Use MSVC 8 toolset\n";
- print "-name_modifier <mod> = Use MPC name_modifier to match projects\n";
print "\n";
print "-CORE = Build the Core libraries\n";
print "-ACE = Build ACE and its programs\n";
@@ -348,16 +304,11 @@ if ($#directories < 0) {
@directories = ($ACE_ROOT);
}
-print "msvc_static_compile: Begin\n";
+print "msvc_auto_compile: Begin\n";
print STDERR "Beginning Core Build\n" if ($print_status == 1);
Build_Core if (!$use_custom_dir || $build_core_only);
print STDERR "Beginning Full Build\n" if ($print_status == 1);
-if ( $vc7 ) {
- Build_All_VC7 if !$build_core_only;
-}
-else {
- Build_All if !$build_core_only;
-}
+Build_All if !$build_core_only;
-print "msvc_static_compile: End\n";
+print "msvc_auto_compile: End\n";
print STDERR "End\n" if ($print_status == 1);