winemaker: Fix dll compiling in project files.

This commit is contained in:
André Hentschel 2009-08-29 13:10:01 +02:00 committed by Alexandre Julliard
parent 11f7b5ba5a
commit c0bd2912db
1 changed files with 92 additions and 109 deletions

View File

@ -20,7 +20,7 @@ use strict;
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
my $version="0.7.3";
my $version="0.7.4";
use Cwd;
use File::Basename;
@ -525,8 +525,6 @@ sub source_scan_project_file($$$)
# reference to the project for this file. May not be used
my $project;
# list of targets found in the current file
my %targets;
# list of sources found in the current file
my @sources_c=();
my @sources_cxx=();
@ -583,8 +581,7 @@ sub source_scan_project_file($$$)
}
if (/^\# Microsoft Developer Studio Project File - Name=\"([^\"]+)/) {
$prj_name="$1.exe";
$targets{$prj_name}=1;
$prj_name="$1";
#print $prj_name;
next;
} elsif (/^# TARGTYPE/) {
@ -780,9 +777,7 @@ sub source_scan_project_file($$$)
} elsif (/^SOURCE=(.*)$/) {
my @components=split /[\/\\]+/, $1;
$sfilet=search_from($path, \@components);
if ($sfilet =~ /\.(exe|dll)$/i) {
$targets{$sfilet}=1;
} elsif ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
if ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
push @sources_c,$sfilet;
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
if ($sfilet =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
@ -856,7 +851,7 @@ sub source_scan_project_file($$$)
foreach my $vc_project ($project_xml->findnodes('/VisualStudioProject')) {
foreach my $vc_project_attr ($vc_project->attributes) {
if ($vc_project_attr->getName eq "Name") {
$targets{$vc_project_attr->getValue.".exe"}=1;
$prj_name=$vc_project_attr->getValue;
last;
}
}
@ -870,9 +865,7 @@ sub source_scan_project_file($$$)
$sfilet=~s/\\\\/\\/g; #remove double backslash
$sfilet=~s/^\.\\//; #remove starting 'this directory'
$sfilet=~s/\\/\//g; #make slashes out of backslashes
if ($sfilet =~ /\.(exe|dll)$/i) {
$targets{$sfilet}=1;
} elsif ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
if ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
push @sources_c,$sfilet;
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
if ($sfilet =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
@ -953,10 +946,6 @@ sub source_scan_project_file($$$)
push @{@$project_settings[$T_DEFINES]},$prj_target_defines;
}
my $target_count;
$target_count=keys %targets;
# Add this project to the project list, except for
# the main project which is already in the list.
if ($is_sub_project == 1) {
@ -991,32 +980,31 @@ sub source_scan_project_file($$$)
}
}
# - Create the targets
# - Check if we have both libraries and programs
# - Match each target with source files (sort in reverse
# alphabetical order to get the longest matches first)
my @local_dlls=();
my @local_depends=();
my @exe_list=();
foreach my $target_name (map (lc, (sort { $b cmp $a } keys %targets))) {
# Create the target...
my $target=[];
target_init($target);
@$target[$T_NAME]=$target_name;
@$target[$T_FLAGS]|=@$project_settings[$T_FLAGS];
if ($target_name =~ /\.dll$/) {
@$target[$T_TYPE]=$TT_DLL;
push @local_depends,"$target_name.so";
push @local_dlls,$target_name;
my $canon=canonize($target_name);
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:%=%.spec)");
} else {
if ($prj_target_type!=3) {
$prj_name=lc($prj_name.".exe");
@$target[$T_TYPE]=$opt_target_type;
push @exe_list,$target;
push @{@$target[$T_LDFLAGS]},(@$target[$T_TYPE] == $TT_CUIEXE ? "-mconsole" : "-mwindows");
} else {
$prj_name=lc($prj_name.".dll");
@$target[$T_TYPE]=$TT_DLL;
push @local_depends,"$prj_name.so";
push @local_dlls,$prj_name;
my $canon=canonize($prj_name);
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:%=%.spec)");
}
my $basename=$target_name;
$basename=~ s/\.(dll|exe)$//i;
@$target[$T_NAME]=$prj_name;
@$target[$T_FLAGS]|=@$project_settings[$T_FLAGS];
# This is the default link list of Visual Studio
my @std_imports=qw(odbc32 ole32 oleaut32 winspool odbccp32);
my @std_libraries=qw(uuid);
@ -1043,7 +1031,7 @@ sub source_scan_project_file($$$)
$flag_desc.=")";
}
print "* Specify any link option (-P/-i/-L/-l/--mfc) specific to the target\n";
print "* \"$target_name\"$flag_desc or 'never' to not be asked this question again:\n";
print "* \"$prj_name\"$flag_desc or 'never' to not be asked this question again:\n";
while (1) {
my $options=<STDIN>;
chomp $options;
@ -1067,29 +1055,24 @@ sub source_scan_project_file($$$)
}
# Match sources...
if ($target_count == 1) {
push @{@$target[$T_SOURCES_C]},@{@$project_settings[$T_SOURCES_C]},@sources_c;
@$project_settings[$T_SOURCES_C]=[];
@sources_c=();
push @{@$target[$T_SOURCES_CXX]},@{@$project_settings[$T_SOURCES_CXX]},@sources_cxx;
@$project_settings[$T_SOURCES_CXX]=[];
@sources_cxx=();
push @{@$target[$T_SOURCES_RC]},@{@$project_settings[$T_SOURCES_RC]},@sources_rc;
@$project_settings[$T_SOURCES_RC]=[];
@sources_rc=();
push @{@$target[$T_SOURCES_MISC]},@{@$project_settings[$T_SOURCES_MISC]},@sources_misc;
# No need for sorting these sources
@$project_settings[$T_SOURCES_MISC]=[];
@sources_misc=();
}
@$target[$T_SOURCES_C]=[sort @{@$target[$T_SOURCES_C]}];
@$target[$T_SOURCES_CXX]=[sort @{@$target[$T_SOURCES_CXX]}];
@$target[$T_SOURCES_RC]=[sort @{@$target[$T_SOURCES_RC]}];
@$target[$T_SOURCES_MISC]=[sort @{@$target[$T_SOURCES_MISC]}];
}
if ($opt_ask_target_options == $OPT_ASK_SKIP) {
$opt_ask_target_options=$OPT_ASK_YES;
}