Changeset View
Changeset View
Standalone View
Standalone View
contrib/qt/convert-prl-libs-to-cmake.pl
Show All 27 Lines | |||||
use Text::ParseWords; | use Text::ParseWords; | ||||
use v5.10; | use v5.10; | ||||
use strict; | use strict; | ||||
use warnings; | use warnings; | ||||
my $qt_lib; | my $qt_lib; | ||||
my $qt_lib_install_dir; | |||||
my $component_name; | my $component_name; | ||||
my $out_name; | my $out_name; | ||||
my $compiler; | my $compiler; | ||||
processArgs(); | processArgs(); | ||||
sub processArgs { | sub processArgs { | ||||
GetOptions ( | GetOptions ( | ||||
"lib=s" => \$qt_lib, | "lib=s" => \$qt_lib, | ||||
# The installed Qt library directory might be different from the given | |||||
# library location. This is especially the case of the plugins wich are | |||||
# located in a separated 'plugin' directory. | |||||
# Let the caller set this installation dependent location rather than | |||||
# trying to determine it from the given library location. | |||||
"qt_lib_install_dir=s" => \$qt_lib_install_dir, | |||||
"component=s" => \$component_name, | "component=s" => \$component_name, | ||||
"out=s" => \$out_name, | "out=s" => \$out_name, | ||||
"compiler=s" => \$compiler | "compiler=s" => \$compiler | ||||
) | ) | ||||
} | } | ||||
my $qt_lib_dir = dirname($qt_lib); | my $qt_lib_dir = dirname($qt_lib); | ||||
my $qt_lib_base = fileparse($qt_lib, qr{\..*}); | my $qt_lib_base = fileparse($qt_lib, qr{\..*}); | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | sub squash_prl_libs { | ||||
my @libs = @_; | my @libs = @_; | ||||
my @result; | my @result; | ||||
for (my $i = 0; $i < scalar(@libs); ++$i) { | for (my $i = 0; $i < scalar(@libs); ++$i) { | ||||
my $lib = $libs[$i]; | my $lib = $libs[$i]; | ||||
if ($lib eq '-framework') { | if ($lib eq '-framework') { | ||||
$lib = "$libs[$i] $libs[$i + 1]"; | $lib = "$libs[$i] $libs[$i + 1]"; | ||||
++$i; | ++$i; | ||||
} | } | ||||
$lib =~ s"\$\$\[QT_INSTALL_LIBS\]"$qt_lib_dir"g; | $lib =~ s"\$\$\[QT_INSTALL_LIBS\]"$qt_lib_install_dir"g; | ||||
if (lc($compiler) eq 'msvc') { | if (lc($compiler) eq 'msvc') { | ||||
# convert backslashes | # convert backslashes | ||||
$lib =~ s"\\"/"g; | $lib =~ s"\\"/"g; | ||||
# MSVC doesn't support -L and -l arguments | # MSVC doesn't support -L and -l arguments | ||||
if ($lib =~ /^-L(.*)$/) { | if ($lib =~ /^-L(.*)$/) { | ||||
$lib = "-LIBPATH:$1" | $lib = "-LIBPATH:$1" | ||||
Show All 9 Lines |