winemaker: Fix dll compiling in project files.
This commit is contained in:
parent
11f7b5ba5a
commit
c0bd2912db
|
@ -20,7 +20,7 @@ use strict;
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
# 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 Cwd;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
@ -525,8 +525,6 @@ sub source_scan_project_file($$$)
|
||||||
|
|
||||||
# reference to the project for this file. May not be used
|
# reference to the project for this file. May not be used
|
||||||
my $project;
|
my $project;
|
||||||
# list of targets found in the current file
|
|
||||||
my %targets;
|
|
||||||
# list of sources found in the current file
|
# list of sources found in the current file
|
||||||
my @sources_c=();
|
my @sources_c=();
|
||||||
my @sources_cxx=();
|
my @sources_cxx=();
|
||||||
|
@ -583,8 +581,7 @@ sub source_scan_project_file($$$)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^\# Microsoft Developer Studio Project File - Name=\"([^\"]+)/) {
|
if (/^\# Microsoft Developer Studio Project File - Name=\"([^\"]+)/) {
|
||||||
$prj_name="$1.exe";
|
$prj_name="$1";
|
||||||
$targets{$prj_name}=1;
|
|
||||||
#print $prj_name;
|
#print $prj_name;
|
||||||
next;
|
next;
|
||||||
} elsif (/^# TARGTYPE/) {
|
} elsif (/^# TARGTYPE/) {
|
||||||
|
@ -780,9 +777,7 @@ sub source_scan_project_file($$$)
|
||||||
} elsif (/^SOURCE=(.*)$/) {
|
} elsif (/^SOURCE=(.*)$/) {
|
||||||
my @components=split /[\/\\]+/, $1;
|
my @components=split /[\/\\]+/, $1;
|
||||||
$sfilet=search_from($path, \@components);
|
$sfilet=search_from($path, \@components);
|
||||||
if ($sfilet =~ /\.(exe|dll)$/i) {
|
if ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
|
||||||
$targets{$sfilet}=1;
|
|
||||||
} elsif ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
|
|
||||||
push @sources_c,$sfilet;
|
push @sources_c,$sfilet;
|
||||||
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
|
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
|
||||||
if ($sfilet =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
|
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 ($project_xml->findnodes('/VisualStudioProject')) {
|
||||||
foreach my $vc_project_attr ($vc_project->attributes) {
|
foreach my $vc_project_attr ($vc_project->attributes) {
|
||||||
if ($vc_project_attr->getName eq "Name") {
|
if ($vc_project_attr->getName eq "Name") {
|
||||||
$targets{$vc_project_attr->getValue.".exe"}=1;
|
$prj_name=$vc_project_attr->getValue;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,9 +865,7 @@ sub source_scan_project_file($$$)
|
||||||
$sfilet=~s/\\\\/\\/g; #remove double backslash
|
$sfilet=~s/\\\\/\\/g; #remove double backslash
|
||||||
$sfilet=~s/^\.\\//; #remove starting 'this directory'
|
$sfilet=~s/^\.\\//; #remove starting 'this directory'
|
||||||
$sfilet=~s/\\/\//g; #make slashes out of backslashes
|
$sfilet=~s/\\/\//g; #make slashes out of backslashes
|
||||||
if ($sfilet =~ /\.(exe|dll)$/i) {
|
if ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
|
||||||
$targets{$sfilet}=1;
|
|
||||||
} elsif ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
|
|
||||||
push @sources_c,$sfilet;
|
push @sources_c,$sfilet;
|
||||||
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
|
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
|
||||||
if ($sfilet =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
|
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;
|
push @{@$project_settings[$T_DEFINES]},$prj_target_defines;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $target_count;
|
|
||||||
$target_count=keys %targets;
|
|
||||||
|
|
||||||
|
|
||||||
# Add this project to the project list, except for
|
# Add this project to the project list, except for
|
||||||
# the main project which is already in the list.
|
# the main project which is already in the list.
|
||||||
if ($is_sub_project == 1) {
|
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_dlls=();
|
||||||
my @local_depends=();
|
my @local_depends=();
|
||||||
my @exe_list=();
|
my @exe_list=();
|
||||||
foreach my $target_name (map (lc, (sort { $b cmp $a } keys %targets))) {
|
|
||||||
# Create the target...
|
# Create the target...
|
||||||
my $target=[];
|
my $target=[];
|
||||||
target_init($target);
|
target_init($target);
|
||||||
@$target[$T_NAME]=$target_name;
|
|
||||||
@$target[$T_FLAGS]|=@$project_settings[$T_FLAGS];
|
if ($prj_target_type!=3) {
|
||||||
if ($target_name =~ /\.dll$/) {
|
$prj_name=lc($prj_name.".exe");
|
||||||
@$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 {
|
|
||||||
@$target[$T_TYPE]=$opt_target_type;
|
@$target[$T_TYPE]=$opt_target_type;
|
||||||
push @exe_list,$target;
|
push @exe_list,$target;
|
||||||
push @{@$target[$T_LDFLAGS]},(@$target[$T_TYPE] == $TT_CUIEXE ? "-mconsole" : "-mwindows");
|
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
|
# This is the default link list of Visual Studio
|
||||||
my @std_imports=qw(odbc32 ole32 oleaut32 winspool odbccp32);
|
my @std_imports=qw(odbc32 ole32 oleaut32 winspool odbccp32);
|
||||||
my @std_libraries=qw(uuid);
|
my @std_libraries=qw(uuid);
|
||||||
|
@ -1043,7 +1031,7 @@ sub source_scan_project_file($$$)
|
||||||
$flag_desc.=")";
|
$flag_desc.=")";
|
||||||
}
|
}
|
||||||
print "* Specify any link option (-P/-i/-L/-l/--mfc) specific to the target\n";
|
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) {
|
while (1) {
|
||||||
my $options=<STDIN>;
|
my $options=<STDIN>;
|
||||||
chomp $options;
|
chomp $options;
|
||||||
|
@ -1067,29 +1055,24 @@ sub source_scan_project_file($$$)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Match sources...
|
# Match sources...
|
||||||
if ($target_count == 1) {
|
|
||||||
push @{@$target[$T_SOURCES_C]},@{@$project_settings[$T_SOURCES_C]},@sources_c;
|
push @{@$target[$T_SOURCES_C]},@{@$project_settings[$T_SOURCES_C]},@sources_c;
|
||||||
@$project_settings[$T_SOURCES_C]=[];
|
@$project_settings[$T_SOURCES_C]=[];
|
||||||
@sources_c=();
|
@sources_c=();
|
||||||
|
|
||||||
push @{@$target[$T_SOURCES_CXX]},@{@$project_settings[$T_SOURCES_CXX]},@sources_cxx;
|
push @{@$target[$T_SOURCES_CXX]},@{@$project_settings[$T_SOURCES_CXX]},@sources_cxx;
|
||||||
@$project_settings[$T_SOURCES_CXX]=[];
|
@$project_settings[$T_SOURCES_CXX]=[];
|
||||||
@sources_cxx=();
|
@sources_cxx=();
|
||||||
|
|
||||||
push @{@$target[$T_SOURCES_RC]},@{@$project_settings[$T_SOURCES_RC]},@sources_rc;
|
push @{@$target[$T_SOURCES_RC]},@{@$project_settings[$T_SOURCES_RC]},@sources_rc;
|
||||||
@$project_settings[$T_SOURCES_RC]=[];
|
@$project_settings[$T_SOURCES_RC]=[];
|
||||||
@sources_rc=();
|
@sources_rc=();
|
||||||
|
|
||||||
push @{@$target[$T_SOURCES_MISC]},@{@$project_settings[$T_SOURCES_MISC]},@sources_misc;
|
push @{@$target[$T_SOURCES_MISC]},@{@$project_settings[$T_SOURCES_MISC]},@sources_misc;
|
||||||
# No need for sorting these sources
|
|
||||||
@$project_settings[$T_SOURCES_MISC]=[];
|
@$project_settings[$T_SOURCES_MISC]=[];
|
||||||
@sources_misc=();
|
@sources_misc=();
|
||||||
}
|
|
||||||
@$target[$T_SOURCES_C]=[sort @{@$target[$T_SOURCES_C]}];
|
@$target[$T_SOURCES_C]=[sort @{@$target[$T_SOURCES_C]}];
|
||||||
@$target[$T_SOURCES_CXX]=[sort @{@$target[$T_SOURCES_CXX]}];
|
@$target[$T_SOURCES_CXX]=[sort @{@$target[$T_SOURCES_CXX]}];
|
||||||
@$target[$T_SOURCES_RC]=[sort @{@$target[$T_SOURCES_RC]}];
|
@$target[$T_SOURCES_RC]=[sort @{@$target[$T_SOURCES_RC]}];
|
||||||
@$target[$T_SOURCES_MISC]=[sort @{@$target[$T_SOURCES_MISC]}];
|
@$target[$T_SOURCES_MISC]=[sort @{@$target[$T_SOURCES_MISC]}];
|
||||||
}
|
|
||||||
if ($opt_ask_target_options == $OPT_ASK_SKIP) {
|
if ($opt_ask_target_options == $OPT_ASK_SKIP) {
|
||||||
$opt_ask_target_options=$OPT_ASK_YES;
|
$opt_ask_target_options=$OPT_ASK_YES;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue