mirror of
git://code.qt.io/qt/qt5.git
synced 2026-02-02 03:36:54 +08:00
Add --dry-run option to build script
The --dry-run option (-n for short) also allows levels of dry-run, where the first level just shows what the build script itself will do. However if you -n 2, then it will recurse the dry-run to the make as well, so you can get a full dry-run of everything. Change-Id: I3a3c8a844411219e7afe6a570bc9ef6718ba472f Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
3dffd4e710
commit
e400f9d6a6
39
build
39
build
@@ -64,6 +64,7 @@ sub parse_arguments
|
||||
'jobs' => -1,
|
||||
'force_qmake' => 0,
|
||||
'build-submodules' => [],
|
||||
'dry-run' => 0,
|
||||
);
|
||||
|
||||
GetOptionsFromArray(\@args,
|
||||
@@ -71,6 +72,7 @@ sub parse_arguments
|
||||
'continue' => \$self->{'continue'},
|
||||
'jobs|j:1' => \$self->{'jobs'},
|
||||
'force-qmake' => \$self->{'force_qmake'},
|
||||
'dry-run|n:1' => \$self->{'dry-run'},
|
||||
'help|?' => sub { pod2usage(1); },
|
||||
) || pod2usage(2);
|
||||
|
||||
@@ -86,8 +88,8 @@ sub exe
|
||||
|
||||
print "+ @cmd\n" unless ($self->{quiet});
|
||||
|
||||
if (system(@cmd) != 0) {
|
||||
confess "@cmd exited with status $CHILD_ERROR";
|
||||
if ($self->{'dry-run'} != 1) {
|
||||
confess "@cmd exited with status $CHILD_ERROR" if (system(@cmd) != 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -179,23 +181,32 @@ sub detect_configuration
|
||||
$exe = $self->which("jom.exe") if (defined $exe && $self->which("jom.exe"));
|
||||
$exe = $self->which("mingw32-make.exe") if (!defined $exe);
|
||||
|
||||
# Use the /MP compiler option, if using nmake, to use all CPU threads when compiling
|
||||
if ($exe =~ 'nmake') {
|
||||
my $cl = $ENV{'CL'};
|
||||
if (defined $cl) {
|
||||
$cl .= ' /MP';
|
||||
} else {
|
||||
$cl = '/MP';
|
||||
}
|
||||
$ENV{'CL'} = $cl;
|
||||
}
|
||||
if (defined $exe) {
|
||||
$self->{'MAKE'} = "\"$exe\"";
|
||||
|
||||
$self->{'MAKE'} = "\"$exe\"" if (defined $exe);
|
||||
$self->{'MAKEOPTS'} = "" if (defined $exe && $exe =~ /nmake/);
|
||||
if ($exe =~ 'nmake') {
|
||||
# Use the /MP compiler option if using nmake, to use all CPU threads when compiling
|
||||
my $cl = $ENV{'CL'};
|
||||
if (defined $cl) {
|
||||
$cl .= ' /MP';
|
||||
} else {
|
||||
$cl = '/MP';
|
||||
}
|
||||
$ENV{'CL'} = $cl;
|
||||
# Remove the -j option, since nmake cannot handle it.
|
||||
$self->{'MAKEOPTS'} = "";
|
||||
}
|
||||
|
||||
if ($exe =~ 'nmake|jom' && $self->{'dry-run'} > 1) {
|
||||
$self->{'MAKEOPTS'} = "/N $self->{'MAKEOPTS'}";
|
||||
}
|
||||
}
|
||||
|
||||
# Tools needed for building QtWebKit/Windows (Bison, Flex, gperf, iconv)
|
||||
my $abs_path = abs_path('gnuwin32/bin');
|
||||
unshift @PATH, "$abs_path";
|
||||
} else {
|
||||
$self->{'MAKEOPTS'} = "--dry-run $self->{'MAKEOPTS'}" if ($self->{'dry-run'} > 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user