Merge integration refs/builds/qtci/dev/1616675134

bb10
Qt CI Bot 2021-03-25 16:40:07 +00:00
commit 2220ddddf0
7 changed files with 122 additions and 53 deletions

View File

@ -498,9 +498,7 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
endif()
# Generate metatypes
set(QT_MODULE_HAS_META_TYPES_FILE FALSE)
if (${arg_GENERATE_METATYPES})
set(QT_MODULE_HAS_META_TYPES_FILE TRUE)
set(metatypes_install_dir ${INSTALL_LIBDIR}/metatypes)
set(args)
if (NOT QT_WILL_INSTALL)

View File

@ -66,6 +66,23 @@ function(qt_generate_qconfig_cpp in_file out_file)
"${lib_location_absolute_path}" "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
set(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH "${from_lib_location_to_prefix}")
# Ensure Windows drive letter is prepended to the install prefix hardcoded
# into qconfig.cpp, otherwise qmake can't find Qt modules in a static Qt
# build if there's no qt.conf. Mostly relevant for CI.
# Given input like
# \work/qt/install
# or
# \work\qt\install
# Expected output is something like
# C:/work/qt/install
# so it includes a drive letter and forward slashes.
set(QT_CONFIGURE_PREFIX_PATH_STR "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
if(WIN32)
get_filename_component(
QT_CONFIGURE_PREFIX_PATH_STR
"${QT_CONFIGURE_PREFIX_PATH_STR}" REALPATH)
endif()
configure_file(${in_file} ${out_file} @ONLY)
endfunction()

View File

@ -27,7 +27,6 @@ endif()
#####################################################################
qt_internal_add_module(Core
GENERATE_METATYPES
QMAKE_MODULE_CONFIG moc resources
EXCEPTIONS
SOURCES
@ -44,7 +43,7 @@ qt_internal_add_module(Core
global/qlibraryinfo.cpp global/qlibraryinfo.h global/qlibraryinfo_p.h
global/qlogging.cpp global/qlogging.h
global/qmalloc.cpp
# global/qnamespace.h # special case
global/qnamespace.h # this header is specified on purpose so AUTOMOC processes it
global/qnumeric.cpp global/qnumeric.h global/qnumeric_p.h
global/qoperatingsystemversion.cpp global/qoperatingsystemversion.h global/qoperatingsystemversion_p.h
global/qprocessordetection.h
@ -110,7 +109,7 @@ qt_internal_add_module(Core
kernel/qmetaobjectbuilder.cpp kernel/qmetaobjectbuilder_p.h
kernel/qmetatype.cpp kernel/qmetatype.h kernel/qmetatype_p.h
kernel/qmimedata.cpp kernel/qmimedata.h
# kernel/qobject.cpp kernel/qobject.h kernel/qobject_p.h # special case
kernel/qobject.cpp kernel/qobject.h kernel/qobject_p.h
kernel/qobject_impl.h
kernel/qobjectcleanuphandler.cpp kernel/qobjectcleanuphandler.h
kernel/qobjectdefs.h
@ -245,6 +244,7 @@ qt_internal_add_module(Core
QT_NO_USING_NAMESPACE
INCLUDE_DIRECTORIES
"${CMAKE_CURRENT_BINARY_DIR}/global" # special case
"${CMAKE_CURRENT_BINARY_DIR}/kernel" # for moc_qobject.cpp to be found by qobject.cpp
# ../3rdparty/md4 # special case remove
# ../3rdparty/md5 # special case remove
# ../3rdparty/sha3 # special case remove
@ -288,49 +288,31 @@ if(QT_FEATURE_thread)
target_link_libraries(Platform INTERFACE Threads::Threads)
endif()
# Handle QObject: Automoc does not work for this as it would
# require to spill internals into users:
qt_internal_add_module(Core_qobject STATIC
NO_SYNC_QT
NO_CONFIG_HEADER_FILE
NO_MODULE_HEADERS
INTERNAL_MODULE
SKIP_DEPENDS_INCLUDE
)
set_target_properties(Core_qobject PROPERTIES AUTOMOC OFF)
qt_manual_moc(qobject_moc_files OUTPUT_MOC_JSON_FILES core_qobject_metatypes_json_list kernel/qobject.h global/qnamespace.h)
# Skip AUTOMOC processing of qobject.cpp and its headers.
# We do this on purpose, because qobject.cpp contains a bunch of Q_GADGET, Q_NAMESPACE, etc
# keywords and AUTOMOC gets confused about wanting to compile a qobject.moc file as well.
# Instead use manual moc.
set_source_files_properties(kernel/qobject.cpp kernel/qobject.h kernel/qobject_p.h
PROPERTIES SKIP_AUTOMOC TRUE)
qt_manual_moc(qobject_moc_files
OUTPUT_MOC_JSON_FILES core_qobject_metatypes_json_list
kernel/qobject.h)
# The moc file is included directly by qobject.cpp
set_source_files_properties(${qobject_moc_files} PROPERTIES HEADER_FILE_ONLY ON)
target_sources(Core_qobject PRIVATE
global/qnamespace.h
kernel/qobject.cpp kernel/qproperty.cpp kernel/qproperty.h kernel/qproperty_p.h kernel/qobject.h kernel/qobject_p.h ${qobject_moc_files})
set_target_properties(Core_qobject PROPERTIES
COMPILE_OPTIONS $<TARGET_PROPERTY:Core,COMPILE_OPTIONS>
COMPILE_DEFINITIONS $<TARGET_PROPERTY:Core,COMPILE_DEFINITIONS>
INCLUDE_DIRECTORIES $<TARGET_PROPERTY:Core,INCLUDE_DIRECTORIES>
)
target_include_directories(Core_qobject PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/kernel") # for moc_qobject.cpp
target_link_libraries(Core_qobject PRIVATE Qt::Platform Qt::GlobalConfig)
qt_internal_extend_target(Core LIBRARIES Qt::Core_qobject)
add_dependencies(Core_qobject ${QT_CMAKE_EXPORT_NAMESPACE}::moc)
set(core_qobject_metatypes_json_args)
set(core_metatype_args MANUAL_MOC_JSON_FILES ${core_qobject_metatypes_json_list})
set(metatypes_install_dir ${INSTALL_LIBDIR}/metatypes)
if (NOT QT_WILL_INSTALL)
set(core_qobject_metatypes_json_args INSTALL_DIR "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/metatypes")
list(APPEND core_metatype_args
COPY_OVER_INSTALL INSTALL_DIR "${QT_BUILD_DIR}/${metatypes_install_dir}")
else()
list(APPEND core_metatype_args INSTALL_DIR "${metatypes_install_dir}")
endif()
qt6_extract_metatypes(Core_qobject
MANUAL_MOC_JSON_FILES ${core_qobject_metatypes_json_list}
${core_qobject_metatypes_json_args}
)
# Core_qobject is never exported so we need to duplicate the metatypes file
# interface on Core
get_target_property(core_qobject_metatypes_file_genex_build Core_qobject QT_MODULE_META_TYPES_FILE_GENEX_BUILD)
get_target_property(core_qobject_metatypes_file_genex_install Core_qobject QT_MODULE_META_TYPES_FILE_GENEX_INSTALL)
target_sources(Core INTERFACE
${core_qobject_metatypes_file_genex_build}
${core_qobject_metatypes_file_genex_install}
)
# Use qt6_extract_metatypes instead of GENERATE_METATYPES so that we can manually pass the
# additional json files.
qt6_extract_metatypes(Core ${core_metatype_args})
set_property(TARGET Core APPEND PROPERTY
PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig.h")
@ -1341,11 +1323,6 @@ endif()
# special case end
qt_internal_create_tracepoints(Core qtcore.tracepoints)
# special case begin
if(TARGET Core_tracepoints_header)
add_dependencies(Core_qobject Core_tracepoints_header)
endif()
# special case end
qt_internal_add_docs(Core
doc/qtcore.qdocconf
)

View File

@ -13,7 +13,7 @@
/* Installation date */
static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20";
/* Installation Info */
static const char qt_configure_prefix_path_str [12+256] = "qt_prfxpath=@QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX@";
static const char qt_configure_prefix_path_str [12+256] = "qt_prfxpath=@QT_CONFIGURE_PREFIX_PATH_STR@";
static const short qt_configure_str_offsets[] = {
@QT_CONFIG_STR_OFFSETS_FIRST@
};

View File

@ -5243,5 +5243,4 @@ bool QMetaObject::Connection::isConnected_helper() const
QT_END_NAMESPACE
#include "moc_qnamespace.cpp"
#include "moc_qobject.cpp"

View File

@ -12,11 +12,18 @@ qt_internal_add_tool(${target_name}
qtpaths.cpp
DEFINES
QT_NO_FOREACH
QTPATHS_VERSION_STR="2.0"
)
## Scopes:
#####################################################################
qt_internal_extend_target(${target_name} CONDITION QT_FEATURE_settings
LIBRARIES
QtLibraryInfo
Qt::CorePrivate
)
if(WIN32 AND TARGET ${target_name})
set_target_properties(${target_name} PROPERTIES
WIN32_EXECUTABLE FALSE

View File

@ -58,6 +58,13 @@
#include <stdio.h>
#if QT_CONFIG(settings)
# include <private/qlibraryinfo_p.h>
# include <qmakelibraryinfo.h>
# include <propertyprinter.h>
# include <property.h>
#endif
QT_USE_NAMESPACE
/**
@ -162,7 +169,7 @@ static QString searchStringOrError(QCommandLineParser *parser)
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
app.setApplicationVersion("1.0");
app.setApplicationVersion(QTPATHS_VERSION_STR);
#ifdef Q_OS_WIN
const QLatin1Char pathsep(';');
@ -171,8 +178,10 @@ int main(int argc, char **argv)
#endif
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::translate("qtpaths", "Command line client to QStandardPaths"));
parser.setApplicationDescription(QCoreApplication::translate("qtpaths", "Command line client to QStandardPaths and QLibraryInfo"));
parser.addPositionalArgument(QCoreApplication::translate("qtpaths", "[name]"), QCoreApplication::tr("Name of file or directory"));
parser.addPositionalArgument(QCoreApplication::translate("qtpaths", "[properties]"), QCoreApplication::tr("List of the Qt properties to query by the --qt-query argument."));
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
parser.addHelpOption();
parser.addVersionOption();
@ -216,23 +225,51 @@ int main(int argc, char **argv)
parser.addOption(testmode);
QCommandLineOption qtversion(QStringLiteral("qt-version"), QCoreApplication::translate("qtpaths", "Qt version."));
qtversion.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(qtversion);
QCommandLineOption installprefix(QStringLiteral("install-prefix"), QCoreApplication::translate("qtpaths", "Installation prefix for Qt."));
installprefix.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(installprefix);
QCommandLineOption bindir(QStringList() << QStringLiteral("binaries-dir") << QStringLiteral("binaries-directory"),
QCoreApplication::translate("qtpaths", "Location of Qt executables."));
bindir.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(bindir);
QCommandLineOption plugindir(QStringList() << QStringLiteral("plugin-dir") << QStringLiteral("plugin-directory"),
QCoreApplication::translate("qtpaths", "Location of Qt plugins."));
plugindir.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(plugindir);
QCommandLineOption query(
QStringList() << QStringLiteral("qt-query") << QStringLiteral("query"),
QCoreApplication::translate("qtpaths",
"List of Qt properties. Can be used standalone or with the "
"--query-format and --qtconf options."));
parser.addOption(query);
QCommandLineOption queryformat(QStringLiteral("query-format"),
QCoreApplication::translate("qtpaths", "Output format for --qt-query.\nSupported formats: qmake (default), json"),
QCoreApplication::translate("qtpaths", "format"));
queryformat.setDefaultValue("qmake");
parser.addOption(queryformat);
QCommandLineOption qtconf(QStringLiteral("qtconf"),
QCoreApplication::translate("qtpaths", "Path to qt.conf file that will be used to override the queried Qt properties."),
QCoreApplication::translate("qtpaths", "path"));
parser.addOption(qtconf);
parser.process(app);
QStandardPaths::setTestModeEnabled(parser.isSet(testmode));
#if QT_CONFIG(settings)
if (parser.isSet(qtconf)) {
QLibraryInfoPrivate::qtconfManualPath = parser.value(qtconf);
}
#endif
QStringList results;
if (parser.isSet(qtversion)) {
QString qtversionstring = QString::fromLatin1(qVersion());
@ -310,6 +347,40 @@ int main(int argc, char **argv)
QStringList paths = QStandardPaths::locateAll(location.enumvalue, searchitem, QStandardPaths::LocateFile);
results << location.mapName(paths.join(pathsep));
}
#if !QT_CONFIG(settings)
if (parser.isSet(query) || parser.isSet(qtconf) || parser.isSet(queryformat)) {
error(QStringLiteral("--qt-query, --qtconf and --query-format options are not supported. The 'settings' feature is missing."));
}
#else
if (parser.isSet(query)) {
if (!results.isEmpty()) {
QString errorMessage = QCoreApplication::translate("qtpaths", "Several options given, only one is supported at a time.");
error(errorMessage);
}
PropertyPrinter printer;
if (parser.isSet(queryformat)) {
QString formatValue = parser.value(queryformat);
if (formatValue == "json") {
printer = jsonPropertyPrinter;
} else if (formatValue != "qmake") {
QString errorMessage = QCoreApplication::translate("qtpaths", "Invalid output format %1. Supported formats: qmake, json").arg(formatValue);
error(errorMessage);
}
}
QStringList optionProperties = parser.positionalArguments();
QMakeProperty prop;
if (printer) {
return prop.queryProperty(optionProperties, printer);
}
return prop.queryProperty(optionProperties);
} else if (parser.isSet(queryformat)) {
error(QCoreApplication::translate("qtpaths", "--query-format is set, but --qt-query is not requested."));
}
#endif
if (results.isEmpty()) {
parser.showHelp();
} else if (results.size() == 1) {