Merge "Remove win32_system_libs feature from src/corelib/configure.json"

This commit is contained in:
Joerg Bornemann 2021-02-25 15:46:32 +01:00 committed by Qt CI Bot
commit 94d5c1bfe0
14 changed files with 78 additions and 275 deletions

View File

@ -1,179 +0,0 @@
#!/usr/bin/env perl
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the porting tools of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see https://www.qt.io/terms-conditions. For further
## information use the contact form at https://www.qt.io/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 3 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL3 included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 3 requirements
## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 2.0 or (at your option) the GNU General
## Public license version 3 or any later version approved by the KDE Free
## Qt Foundation. The licenses are as published by the Free Software
## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-2.0.html and
## https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################
use Cwd;
use File::Find;
use File::Spec;
use IO::File;
use Getopt::Long;
use strict;
use warnings;
my $dry_run = 0;
my $help = 0;
my $stripModule = 0;
my $fixedFileCount = 0;
my $fileCount = 0;
my $verbose = 0;
my $qtdir;
my $qtIncludeDir;
my $USAGE=<<EOF;
This script replaces all Qt 4 style includes with Qt 5 includes.
Usage: $0 [options]
Options:
--dry-run : Do not replace anything, just print what would be replaced
--strip-modules : Strip the module headers for writing portable code
--verbose : Verbose
--qtdir <directory> : Point to Qt 5's qtbase directory
EOF
if (!GetOptions('dry-run' => \$dry_run, 'help' => \$help,
'strip-modules' => \$stripModule, 'verbose' => \$verbose, 'qtdir:s' => \$qtdir)
|| $help) {
print $USAGE;
exit (1);
}
my %headerSubst = ();
my $cwd = getcwd();
sub fixHeaders
{
my $fileName = $File::Find::name;
my $relFileName = File::Spec->abs2rel($fileName, $cwd);
# only check sources, also ignore symbolic links and directories
return unless -f $fileName && $fileName =~ /(\.h|\.cpp|\/C|\.cc|\.CC)$/;
my $inFile = new IO::File('<' . $fileName) or die ('Unable to open ' . $fileName . ': ' . $!);
$fileCount++;
my @affectedClasses;
my @outLines;
while (my $line = <$inFile>) {
if ($line =~ /^#(\s*)include(\s*)<.*?\/(.*?)>(.*)/) {
my $newHeader = $headerSubst{$3};
if ($newHeader) {
$line = '#' . $1 . 'include' . $2 . '<' . $newHeader . '>' . $4 . "\n";
push(@affectedClasses, $3);
}
} elsif ($line =~ /^#(\s*)include(\s*)<QtGui>(.*)/) {
$line = '#' . $1 . 'include' . $2 . '<QtWidgets>' . $3 . "\n";
push(@affectedClasses, 'QtGui');
}
push(@outLines, $line);
}
$inFile->close();
if (scalar(@affectedClasses)) {
$fixedFileCount++;
print $relFileName, ': ', join(', ', @affectedClasses), "\n" if ($verbose || $dry_run);
if (!$dry_run) {
my $outFile = new IO::File('>' . $fileName) or die ('Unable to open ' . $fileName . ': ' . $!);
map { print $outFile $_; } @outLines;
$outFile->close();
}
} else {
print $relFileName, ": no modification.\n" if ($verbose || $dry_run);
}
}
sub findQtHeaders
{
my ($dirName,$includeDir) = @_;
local (*DIR);
my $moduleIncludeDir = $includeDir . '/' . $dirName;
opendir(DIR, $moduleIncludeDir) || die ('Unable to open ' . $moduleIncludeDir . ': ' . $!);
my @headers = readdir(DIR);
closedir(DIR);
foreach my $header (@headers) {
next if (-d ($moduleIncludeDir . '/' . $header) || $header =~ /\.pri$/);
$headerSubst{$header} = $stripModule ? $header : ($dirName . '/' . $header);
}
}
# -------- MAIN
if ($qtdir) {
$qtIncludeDir = $qtdir . '/include';
} else {
$qtIncludeDir = `qmake -query QT_INSTALL_HEADERS`;
chop($qtIncludeDir);
}
die "The location of the Qt 5 include files could not be determined.\n"
."Please ensure qmake can be found in PATH or pass the command line option --qtdir.\n"
unless -d $qtIncludeDir;
findQtHeaders('QtCore', $qtIncludeDir);
findQtHeaders('QtConcurrent', $qtIncludeDir);
findQtHeaders('QtWidgets', $qtIncludeDir);
findQtHeaders('QtPrintSupport', $qtIncludeDir);
if (-d $qtIncludeDir . '/include/QtMultimedia') {
findQtHeaders('QtMultimedia', $qtIncludeDir);
findQtHeaders('QtMultimediaWidgets', $qtIncludeDir);
} elsif (-d $qtIncludeDir . '/../qtmultimedia' ) {
# This is the case if QTDIR points to a source tree instead of an installed Qt
findQtHeaders('QtMultimedia', $qtIncludeDir . '/../qtmultimedia');
findQtHeaders('QtMultimediaWidgets', $qtIncludeDir . '/../qtmultimedia');
}
# Support porting from "Qt 4.99" QtDeclarative to QtQuick (QQuickItem et al)
if (-d $qtIncludeDir . '/include/QtQuick') {
findQtHeaders('QtQuick', $qtIncludeDir);
} elsif (-d $qtIncludeDir . '/../qtdeclarative' ) {
# This is the case if QTDIR points to a source tree instead of an installed Qt
findQtHeaders('QtQuick', $qtIncludeDir . '/../qtdeclarative');
}
# special case
$headerSubst{'QtGui'} = 'QtWidgets/QtWidgets';
find({ wanted => \&fixHeaders, no_chdir => 1}, $cwd);
print 'Done. ', ($dry_run ? 'Checked' : 'Modified'), ' ', $fixedFileCount, ' of ', $fileCount, " file(s).\n";

View File

@ -14,6 +14,37 @@ function(qt_auto_detect_cmake_generator)
endif()
endfunction()
# Peek into CMAKE_TOOLCHAIN_FILE before it is actually loaded.
#
# Usage:
# qt_autodetect_read_toolchain_file(tcf VARIABLES CMAKE_SYSTEM_NAME)
# if(tcf_CMAKE_SYSTEM_NAME STREQUAL "Android")
# ...we have detected Android
# endif()
#
function(qt_auto_detect_read_toolchain_file prefix)
cmake_parse_arguments(arg "" "" "VARIABLES" ${ARGN})
set(script_path "${CMAKE_CURRENT_LIST_DIR}/QtLoadFilePrintVars.cmake")
execute_process(
COMMAND "${CMAKE_COMMAND}" "-DIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-DVARIABLES=${arg_VARIABLES}" -P "${script_path}"
RESULT_VARIABLE exit_code
OUTPUT_VARIABLE output
ERROR_VARIABLE ignore)
if(NOT exit_code EQUAL 0)
message(FATAL_ERROR "Executing CMake script ${script_path} failed with code ${exit_code}.")
endif()
string(REGEX REPLACE "^.*---QtLoadFilePrintVars---\n" "" output "${output}")
string(REPLACE ";" "\;" output "${output}")
string(REPLACE "\n" ";" output "${output}")
foreach(line IN LISTS output)
string(REGEX MATCH "-- ([^ ]+) (.*)" m "${line}")
if(CMAKE_MATCH_1 IN_LIST arg_VARIABLES)
set(${prefix}_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" PARENT_SCOPE)
endif()
endforeach()
endfunction()
function(qt_auto_detect_android)
# Auto-detect NDK root
if(NOT DEFINED CMAKE_ANDROID_NDK_ROOT AND DEFINED ANDROID_SDK_ROOT)
@ -37,10 +68,8 @@ function(qt_auto_detect_android)
endif()
if(DEFINED CMAKE_TOOLCHAIN_FILE AND NOT DEFINED QT_AUTODETECT_ANDROID)
file(READ ${CMAKE_TOOLCHAIN_FILE} toolchain_file_content OFFSET 0 LIMIT 80)
string(FIND "${toolchain_file_content}" "The Android Open Source Project" find_result REVERSE)
if (NOT ${find_result} EQUAL -1)
qt_auto_detect_read_toolchain_file(tcf VARIABLES CMAKE_SYSTEM_NAME)
if(tcf_CMAKE_SYSTEM_NAME STREQUAL "Android")
set(android_detected TRUE)
else()
set(android_detected FALSE)

View File

@ -0,0 +1,15 @@
# Load a file and print variables and their values
#
# IN_FILE: path to a file to be included
# VARIABLES: list of variables to be printed
cmake_minimum_required(VERSION 3.16)
include("${IN_FILE}")
# Print a magic comment that the caller must look for
message(STATUS "---QtLoadFilePrintVars---")
# Print the variables
foreach(v IN LISTS VARIABLES)
message(STATUS "${v} ${${v}}")
endforeach()

View File

@ -15,7 +15,7 @@ function(qt_ensure_sync_qt)
endif()
# When building qtbase, use the source syncqt, otherwise use the installed one.
set(SYNCQT_FROM_SOURCE "${QtBase_SOURCE_DIR}/bin/syncqt.pl")
set(SYNCQT_FROM_SOURCE "${QtBase_SOURCE_DIR}/libexec/syncqt.pl")
if(NOT ("${QtBase_SOURCE_DIR}" STREQUAL "") AND EXISTS "${SYNCQT_FROM_SOURCE}")
set(QT_SYNCQT "${SYNCQT_FROM_SOURCE}" CACHE FILEPATH "syncqt script")
message(STATUS "Using source syncqt found at: ${QT_SYNCQT}")
@ -23,10 +23,6 @@ function(qt_ensure_sync_qt)
qt_path_join(syncqt_install_dir ${QT_INSTALL_DIR} ${INSTALL_LIBEXECDIR})
qt_copy_or_install(PROGRAMS "${SYNCQT_FROM_SOURCE}"
DESTINATION "${syncqt_install_dir}")
qt_path_join(syncqt_install_dir ${QT_INSTALL_DIR} ${INSTALL_BINDIR})
qt_copy_or_install(PROGRAMS "${SYNCQT_FROM_SOURCE}"
DESTINATION "${syncqt_install_dir}")
elseif(NOT "${QT_HOST_PATH}" STREQUAL "")
get_filename_component(syncqt_absolute_path
"${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}/syncqt.pl"

View File

@ -12,7 +12,7 @@
load(qt_build_paths)
!build_pass:git_build {
qtPrepareTool(QMAKE_SYNCQT, syncqt, , system)
qtPrepareLibExecTool(QMAKE_SYNCQT, syncqt, , system)
minimal_syncqt {
QMAKE_SYNCQT += -minimal $$QMAKE_SYNCQT_OPTIONS
} else {

View File

@ -4,20 +4,11 @@
## qmake Tool:
#####################################################################
# TODO: Probably it's time to introduce QT_FEATURE_qmake?
if(NOT (QT_FEATURE_settings AND QT_FEATURE_alloca AND (QT_FEATURE_alloca_malloc_h OR NOT WIN32) AND
QT_FEATURE_cborstreamwriter AND QT_FEATURE_datestring AND QT_FEATURE_regularexpression AND
QT_FEATURE_temporaryfile))
message(WARNING "Skip building qmake in specified configuration.\
Required features:
QT_FEATURE_settings ${QT_FEATURE_settings}
QT_FEATURE_alloca ${QT_FEATURE_alloca}
QT_FEATURE_cborstreamwriter ${QT_FEATURE_cborstreamwriter}
QT_FEATURE_datestring ${QT_FEATURE_datestring}
QT_FEATURE_getauxval ${QT_FEATURE_getauxval}
QT_FEATURE_regularexpression ${QT_FEATURE_regularexpression}
QT_FEATURE_temporaryfile ${QT_FEATURE_temporaryfile}
")
# qmake is out of any module, so we manually evaluate the required features.
include("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
if(NOT QT_FEATURE_qmake)
return()
endif()

12
qmake/configure.cmake Normal file
View File

@ -0,0 +1,12 @@
qt_feature("qmake" PRIVATE
SECTION "Core tools"
LABEL "qmake tool"
PURPOSE "The qmake tool helps simplify the build process for development projects across different platforms"
CONDITION QT_FEATURE_settings AND QT_FEATURE_alloca AND
(QT_FEATURE_alloca_malloc_h OR NOT WIN32) AND QT_FEATURE_cborstreamwriter AND
QT_FEATURE_datestring AND QT_FEATURE_regularexpression AND QT_FEATURE_temporaryfile
)
qt_configure_add_summary_section(NAME "Core tools")
qt_configure_add_summary_entry(ARGS "qmake")
qt_configure_end_summary_section()

View File

@ -7,6 +7,7 @@ qt_commandline_subconfig(src/widgets)
qt_commandline_subconfig(src/printsupport)
qt_commandline_subconfig(src/plugins/sqldrivers)
qt_commandline_subconfig(src/testlib)
qt_commandline_subconfig(qmake) # special case
qt_commandline_custom(qmakeArgs)
qt_commandline_option(prefix TYPE string)
qt_commandline_option(hostprefix TYPE optionalString)

View File

@ -194,6 +194,11 @@
\snippet code/src_concurrent_qtconcurrentrun.cpp 11
\note There's no need to call QPromise::start() and QPromise::finish() to
indicate the beginning and the end of computation (like you would normally do when
using QPromise). QtConcurrent::run() will always call them before starting and
after finishing the execution.
\section2 Suspending and canceling the execution
The QPromise API also enables suspending and canceling the computation, if requested:
@ -215,6 +220,10 @@
call to \c promise.isCanceled() will return \c true and
\c aFunction will return immediately without any further result reporting.
\note There's no need to call QPromise::finish() to stop the computation
after the cancellation (like you would normally do when using QPromise).
QtConcurrent::run() will always call it after finishing the execution.
\section2 Progress reporting
It's also possible to report the progress of a task

View File

@ -892,10 +892,6 @@ qt_feature("forkfd_pidfd" PRIVATE
LABEL "CLONE_PIDFD support in forkfd"
CONDITION LINUX
)
qt_feature("win32_system_libs"
LABEL "Windows System Libraries"
CONDITION WIN32 AND libs.advapi32 AND libs.gdi32 AND libs.kernel32 AND libs.netapi32 AND libs.ole32 AND libs.shell32 AND libs.uuid AND libs.user32 AND libs.winmm AND libs.ws2_32 OR FIXME
)
qt_feature("cborstreamreader" PUBLIC
SECTION "Utilities"
LABEL "CBOR stream reading"

View File

@ -898,10 +898,6 @@ qt_feature("forkfd_pidfd" PRIVATE
LABEL "CLONE_PIDFD support in forkfd"
CONDITION LINUX
)
qt_feature("win32_system_libs"
LABEL "Windows System Libraries"
CONDITION WIN32 AND libs.advapi32 AND libs.gdi32 AND libs.kernel32 AND libs.netapi32 AND libs.ole32 AND libs.shell32 AND libs.uuid AND libs.user32 AND libs.winmm AND libs.ws2_32 OR FIXME
)
qt_feature("cborstreamreader" PUBLIC
SECTION "Utilities"
LABEL "CBOR stream reading"

View File

@ -185,66 +185,6 @@
"sources": [
"-lslog2"
]
},
"advapi32": {
"label": "advapi32",
"sources": [
"-ladvapi32"
]
},
"gdi32": {
"label": "gdi32",
"sources": [
"-lgdi32"
]
},
"kernel32": {
"label": "kernel32",
"sources": [
"-lkernel32"
]
},
"netapi32": {
"label": "netapi32",
"sources": [
"-lnetapi32"
]
},
"ole32": {
"label": "ole32",
"sources": [
"-lole32"
]
},
"shell32": {
"label": "shell32",
"sources": [
"-lshell32"
]
},
"uuid": {
"label": "uuid",
"sources": [
"-luuid"
]
},
"user32": {
"label": "user32",
"sources": [
"-luser32"
]
},
"winmm": {
"label": "winmm",
"sources": [
"-lwinmm"
]
},
"ws2_32": {
"label": "ws2_32",
"sources": [
"-lws2_32"
]
}
},
@ -1019,10 +959,6 @@
"condition": "config.linux",
"output": [ "privateFeature" ]
},
"win32_system_libs": {
"label": "Windows System Libraries",
"condition": "config.win32 && libs.advapi32 && libs.gdi32 && libs.kernel32 && libs.netapi32 && libs.ole32 && libs.shell32 && libs.uuid && libs.user32 && libs.winmm && libs.ws2_32"
},
"cborstreamreader": {
"label": "CBOR stream reading",
"purpose": "Provides support for reading the CBOR binary format.

View File

@ -28,3 +28,4 @@ android
android
[QTBUG_89082_actionTipsHide]
macos ci # Can't move cursor (QTBUG-76312)
windows-10 ci