summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-01-28 16:06:26 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2021-02-25 16:08:43 +0100
commit43c28aa9046967abeb4ad042c8be1aa23a19c282 (patch)
treeb8f4a53cd9aaaa819c853ee51e66ea100c1ae3d5 /qmake
parent5a3bbb55851b84aa6a46c23e5a6fb33b4860edc6 (diff)
Use Core library for qmake instead of the Bootstrap library
Move the qmake-specific logic of the QLibraryInfo class to qmake internals. 'qconfig.cpp.in' now stores information about the library info entries to keep them consistent between qmake and the Core library. qmake requires specific features enabled in the Core library, so building qmake will be skipped if the features are not enabled. All flags directly related to the qmake have been removed from Core lib. Remove all bootstrap related sections from qmake CMakeLists.txt Task-number: QTBUG-89369 Change-Id: I26de157d3bfd4a5526699296e9d46e1c180b89ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/CMakeLists.txt215
-rw-r--r--qmake/option.cpp12
-rw-r--r--qmake/property.cpp35
-rw-r--r--qmake/qmakelibraryinfo.cpp313
-rw-r--r--qmake/qmakelibraryinfo.h82
5 files changed, 446 insertions, 211 deletions
diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt
index 3897ea192c..08b23df587 100644
--- a/qmake/CMakeLists.txt
+++ b/qmake/CMakeLists.txt
@@ -4,131 +4,27 @@
## 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}
+")
+ return()
+endif()
+
qt_get_tool_target_name(target_name qmake)
qt_internal_add_tool(${target_name}
- NO_QT # special case
TOOLS_TARGET Core # special case
- # GUI # special case: remove this
SOURCES
- ../src/3rdparty/pcre2/src/config.h
- ../src/3rdparty/pcre2/src/pcre2.h
- ../src/3rdparty/pcre2/src/pcre2_auto_possess.c
- ../src/3rdparty/pcre2/src/pcre2_chartables.c
- ../src/3rdparty/pcre2/src/pcre2_compile.c
- ../src/3rdparty/pcre2/src/pcre2_config.c
- ../src/3rdparty/pcre2/src/pcre2_context.c
- ../src/3rdparty/pcre2/src/pcre2_dfa_match.c
- ../src/3rdparty/pcre2/src/pcre2_error.c
- ../src/3rdparty/pcre2/src/pcre2_extuni.c
- ../src/3rdparty/pcre2/src/pcre2_find_bracket.c
- ../src/3rdparty/pcre2/src/pcre2_internal.h
- ../src/3rdparty/pcre2/src/pcre2_intmodedep.h
- ../src/3rdparty/pcre2/src/pcre2_jit_compile.c
- ../src/3rdparty/pcre2/src/pcre2_maketables.c
- ../src/3rdparty/pcre2/src/pcre2_match.c
- ../src/3rdparty/pcre2/src/pcre2_match_data.c
- ../src/3rdparty/pcre2/src/pcre2_newline.c
- ../src/3rdparty/pcre2/src/pcre2_ord2utf.c
- ../src/3rdparty/pcre2/src/pcre2_pattern_info.c
- ../src/3rdparty/pcre2/src/pcre2_script_run.c
- ../src/3rdparty/pcre2/src/pcre2_serialize.c
- ../src/3rdparty/pcre2/src/pcre2_string_utils.c
- ../src/3rdparty/pcre2/src/pcre2_study.c
- ../src/3rdparty/pcre2/src/pcre2_substitute.c
- ../src/3rdparty/pcre2/src/pcre2_substring.c
- ../src/3rdparty/pcre2/src/pcre2_tables.c
- ../src/3rdparty/pcre2/src/pcre2_ucd.c
- ../src/3rdparty/pcre2/src/pcre2_ucp.h
- ../src/3rdparty/pcre2/src/pcre2_valid_utf.c
- ../src/3rdparty/pcre2/src/pcre2_xclass.c
- ../src/corelib/global/qcontainerinfo.h
- ../src/corelib/global/qendian.cpp # special case
- ../src/corelib/global/qglobal.cpp ../src/corelib/global/qglobal.h
- ../src/corelib/global/qlibraryinfo.cpp
- ../src/corelib/global/qlogging.cpp
- ../src/corelib/global/qmalloc.cpp
- ../src/corelib/global/qnumeric.cpp ../src/corelib/global/qnumeric.h
- ../src/corelib/global/qoperatingsystemversion.cpp # special case
- ../src/corelib/global/qrandom.cpp # special case
- ../src/corelib/io/qabstractfileengine.cpp ../src/corelib/io/qabstractfileengine_p.h
- ../src/corelib/io/qbuffer.cpp ../src/corelib/io/qbuffer.h
- ../src/corelib/io/qdebug.cpp # special case
- ../src/corelib/io/qdir.cpp ../src/corelib/io/qdir.h ../src/corelib/io/qdir_p.h
- ../src/corelib/io/qdiriterator.cpp ../src/corelib/io/qdiriterator.h
- ../src/corelib/io/qfile.cpp ../src/corelib/io/qfile.h
- ../src/corelib/io/qfiledevice.cpp
- ../src/corelib/io/qfileinfo.cpp ../src/corelib/io/qfileinfo.h
- ../src/corelib/io/qfilesystemengine.cpp
- ../src/corelib/io/qfilesystementry.cpp
- ../src/corelib/io/qfsfileengine.cpp
- ../src/corelib/io/qfsfileengine_iterator.cpp
- ../src/corelib/io/qiodevicebase.h
- ../src/corelib/io/qiodevice.cpp ../src/corelib/io/qiodevice.h
- ../src/corelib/io/qsettings.cpp
- ../src/corelib/io/qtemporaryfile.cpp ../src/corelib/io/qtemporaryfile.h
- ../src/corelib/kernel/qiterable.cpp ../src/corelib/kernel/qiterable.h
- ../src/corelib/kernel/qmetacontainer.cpp ../src/corelib/kernel/qmetacontainer.h
- ../src/corelib/kernel/qmetatype.cpp ../src/corelib/kernel/qmetatype.h
- ../src/corelib/kernel/qsystemerror.cpp ../src/corelib/kernel/qsystemerror_p.h
- ../src/corelib/kernel/qvariant.cpp
- ../src/corelib/plugin/quuid.cpp ../src/corelib/plugin/quuid.h
- ../src/corelib/serialization/qcborstreamwriter.cpp ../src/corelib/serialization/qcborstreamwriter.h
- ../src/corelib/serialization/qcborvalue.cpp ../src/corelib/serialization/qcborvalue.h ../src/corelib/serialization/qcborvalue_p.h
- ../src/corelib/serialization/qdatastream.cpp ../src/corelib/serialization/qdatastream.h
- ../src/corelib/serialization/qjson_p.h
- ../src/corelib/serialization/qjsonarray.cpp ../src/corelib/serialization/qjsonarray.h
- ../src/corelib/serialization/qjsoncbor.cpp
- ../src/corelib/serialization/qjsondocument.cpp ../src/corelib/serialization/qjsondocument.h
- ../src/corelib/serialization/qjsonobject.cpp ../src/corelib/serialization/qjsonobject.h
- ../src/corelib/serialization/qjsonparser.cpp ../src/corelib/serialization/qjsonparser_p.h
- ../src/corelib/serialization/qjsonvalue.cpp ../src/corelib/serialization/qjsonvalue.h
- ../src/corelib/serialization/qjsonwriter_p.h
- ../src/corelib/serialization/qtextstream.cpp ../src/corelib/serialization/qtextstream.h
- ../src/corelib/text/qbytearray.cpp ../src/corelib/text/qbytearray.h
- ../src/corelib/text/qbytearraylist.cpp ../src/corelib/text/qbytearraylist.h # special case
- ../src/corelib/text/qbytearraymatcher.cpp ../src/corelib/text/qbytearraymatcher.h
- ../src/corelib/text/qchar.h
- ../src/corelib/text/qlocale.cpp ../src/corelib/text/qlocale.h
- ../src/corelib/text/qlocale_tools.cpp ../src/corelib/text/qlocale_tools_p.h
- ../src/corelib/text/qregularexpression.cpp ../src/corelib/text/qregularexpression.h
- ../src/corelib/text/qstring.cpp ../src/corelib/text/qstring.h
- ../src/corelib/text/qstringbuilder.cpp ../src/corelib/text/qstringbuilder.h
- ../src/corelib/text/qstringconverter.cpp ../src/corelib/text/qstringconverter.h ../src/corelib/text/qstringconverter_p.h
- ../src/corelib/text/qstringlist.cpp ../src/corelib/text/qstringlist.h
- ../src/corelib/text/qstringmatcher.h
- ../src/corelib/text/qvsnprintf.cpp
- ../src/corelib/time/qcalendar.cpp ../src/corelib/time/qcalendar.h
- ../src/corelib/time/qcalendarbackend_p.h
- ../src/corelib/time/qcalendarmath_p.h
- ../src/corelib/time/qdatetime.cpp ../src/corelib/time/qdatetime.h ../src/corelib/time/qdatetime_p.h
- ../src/corelib/time/qgregoriancalendar.cpp ../src/corelib/time/qgregoriancalendar_p.h
- ../src/corelib/time/qromancalendar.cpp ../src/corelib/time/qromancalendar_p.h
- ../src/corelib/tools/qarraydata.cpp ../src/corelib/tools/qarraydata.h
- ../src/corelib/tools/qarraydataops.h
- ../src/corelib/tools/qarraydatapointer.h
- ../src/corelib/tools/qbitarray.cpp ../src/corelib/tools/qbitarray.h
- ../src/corelib/tools/qcryptographichash.cpp ../src/corelib/tools/qcryptographichash.h
- ../src/corelib/time/qcalendar.cpp ../src/corelib/time/qcalendar.h # special case
- ../src/corelib/time/qcalendarbackend_p.h ../src/corelib/time/qcalendarmath_p.h # special case
- ../src/corelib/time/qgregoriancalendar.cpp ../src/corelib/time/qgregoriancalendar_p.h # special case
- ../src/corelib/time/qromancalendar.cpp ../src/corelib/time/qromancalendar_p.h # special case
- ../src/corelib/time/qdatetime.cpp ../src/corelib/time/qdatetime.h ../src/corelib/time/qdatetime_p.h # special case
- ../src/corelib/tools/qduplicatetracker_p.h
- ../src/corelib/tools/qhash.cpp ../src/corelib/tools/qhash.h
- ../src/corelib/tools/qlist.h
- ../src/corelib/tools/qmap.h
- ../src/corelib/text/qlocale.cpp ../src/corelib/text/qlocale.h
- ../src/corelib/text/qlocale_tools.cpp ../src/corelib/text/qlocale_tools_p.h
- ../src/corelib/text/qregularexpression.cpp ../src/corelib/text/qregularexpression.h
- ../src/corelib/tools/qringbuffer.cpp # special case
- ../src/corelib/text/qstring.cpp ../src/corelib/text/qstring.h
- ../src/corelib/text/qstringbuilder.cpp ../src/corelib/text/qstringbuilder.h
- ../src/corelib/text/qstringconverter.cpp ../src/corelib/text/qstringconverter.h ../src/corelib/text/qstringconverter_p.h
- ../src/corelib/text/qstringlist.cpp ../src/corelib/text/qstringlist.h
- ../src/corelib/text/qstringmatcher.h
- ../src/corelib/tools/qvector.h
- ../src/corelib/tools/qversionnumber.cpp ../src/corelib/tools/qversionnumber.h
- ../src/corelib/text/qvsnprintf.cpp
cachekeys.h
generators/mac/pbuilder_pbx.cpp generators/mac/pbuilder_pbx.h
generators/makefile.cpp generators/makefile.h
@@ -153,6 +49,7 @@ qt_internal_add_tool(${target_name}
library/qmakeglobals.cpp library/qmakeglobals.h
library/qmakeparser.cpp library/qmakeparser.h
library/qmakevfs.cpp library/qmakevfs.h
+ qmakelibraryinfo.cpp qmakelibraryinfo.h
main.cpp
meta.cpp meta.h
option.cpp option.h
@@ -160,9 +57,7 @@ qt_internal_add_tool(${target_name}
property.cpp property.h
DEFINES
HAVE_CONFIG_H
- PCRE2_DISABLE_JIT
PROEVALUATOR_FULL
- QT_BOOTSTRAPPED
QT_BUILD_QMAKE
QT_USE_QSTRINGBUILDER
QT_NO_FOREACH
@@ -170,95 +65,38 @@ qt_internal_add_tool(${target_name}
QT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} # special case
QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case
QT_VERSION_PATCH=${PROJECT_VERSION_PATCH} # special case
- PCRE2_CODE_UNIT_WIDTH=16
- PCRE2_DISABLE_JIT
- HAVE_CONFIG_H
INCLUDE_DIRECTORIES
- # . # special case remove
generators
generators/mac
generators/unix
generators/win32
library
- $<TARGET_PROPERTY:Qt::Core,INCLUDE_DIRECTORIES> # special case
- "${PROJECT_BINARY_DIR}/src/corelib/global" # special case: for qconfig.cpp
+ "${CMAKE_CURRENT_BINARY_DIR}/library" # for qmakeconfig.cpp
PRECOMPILED_HEADER
"qmake_pch.h"
+ LIBRARIES
+ Qt::CorePrivate
)
+qt_generate_qconfig_cpp(../src/corelib/global/qconfig.cpp.in library/qmakeconfig.cpp)
+
#### Keys ignored in scope 1:.:.:qmake.pro:<TRUE>:
# _OPTION = "host_build"
## Scopes:
#####################################################################
-qt_internal_extend_target(${target_name} CONDITION WIN32
- SOURCES
- ../src/corelib/global/qoperatingsystemversion_win.cpp
- ../src/corelib/io/qfilesystemengine_win.cpp
- ../src/corelib/io/qfilesystemiterator_win.cpp
- ../src/corelib/io/qfsfileengine_win.cpp
- ../src/corelib/io/qsettings_win.cpp
- ../src/corelib/plugin/qsystemlibrary.cpp
- ../src/corelib/text/qlocale_win.cpp
- library/registry.cpp
- DEFINES
- UNICODE
- _CRT_SECURE_NO_WARNINGS
- _ENABLE_EXTENDED_ALIGNED_STORAGE
- _SCL_SECURE_NO_WARNINGS
- PUBLIC_DEFINES
- PCRE2_STATIC
- PUBLIC_LIBRARIES
- advapi32
- kernel32
- netapi32
- ole32
-)
-
-qt_internal_extend_target(${target_name} CONDITION UNIX
- SOURCES
- ../src/corelib/io/qfilesystemengine_unix.cpp
- ../src/corelib/io/qfilesystemiterator_unix.cpp
- ../src/corelib/io/qfsfileengine_unix.cpp
- ../src/corelib/kernel/qcore_unix.cpp
- ../src/corelib/text/qlocale_unix.cpp
-)
-
qt_internal_extend_target(${target_name} CONDITION MACOS
- SOURCES
- ../src/corelib/kernel/qcore_foundation.mm # special case
- ../src/corelib/kernel/qcore_mac.mm # special case
- ../src/corelib/global/qoperatingsystemversion_darwin.mm # special case
- ../src/corelib/io/qsettings_mac.cpp # special case
- PUBLIC_LIBRARIES
- ${FWApplicationServices}
- ${FWCoreServices}
- ${FWFoundation}
COMPILE_OPTIONS
"-fconstant-cfstrings"
)
# special case big
-qt_internal_extend_target(qmake CONDITION WIN32
+qt_internal_extend_target(${target_name} CONDITION WIN32
SOURCES
- ../src/corelib/io/qfilesystemengine_win.cpp
- ../src/corelib/io/qfilesystemiterator_win.cpp
- ../src/corelib/io/qfsfileengine_win.cpp
- ../src/corelib/text/qlocale_win.cpp
- ../src/corelib/io/qsettings_win.cpp
- # ../src/corelib/global/qoperatingsystemversion.cpp special case: remove this
- ../src/corelib/plugin/qsystemlibrary.cpp
library/registry.cpp
DEFINES
- UNICODE _ENABLE_EXTENDED_ALIGNED_STORAGE _CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS
- LIBRARIES
- ole32 advapi32 kernel32 netapi32
-)
-
-qt_internal_extend_target(${target_name} CONDITION MINGW AND WIN32
- PUBLIC_LIBRARIES
- uuid
+ _SCL_SECURE_NO_WARNINGS
)
qt_internal_extend_target(${target_name} CONDITION CLANG AND WIN32
@@ -275,10 +113,7 @@ set_target_properties(${target_name} PROPERTIES
)
qt_internal_apply_gc_binaries(${target_name} PRIVATE) # special case
-
-qt_set_msvc_cplusplus_options(${target_name} PUBLIC) # special case
qt_skip_warnings_are_errors(${target_name}) # special case
-qt_internal_apply_intel_cet(Bootstrap PUBLIC) # special case
# special case begin
qt_internal_add_docs(${target_name}
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 0d5746bb09..09d790c9c2 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -33,7 +33,7 @@
#include <qregularexpression.h>
#include <qhash.h>
#include <qdebug.h>
-#include <qlibraryinfo.h>
+#include <qmakelibraryinfo.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -218,7 +218,9 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
"QMake version %s\n"
"Using Qt version %s in %s\n",
QMAKE_VERSION_STR, QT_VERSION_STR,
- QLibraryInfo::path(QLibraryInfo::LibrariesPath).toLatin1().constData());
+ QMakeLibraryInfo::path(QLibraryInfo::LibrariesPath)
+ .toLatin1()
+ .constData());
#ifdef QMAKE_OPENSOURCE_VERSION
fprintf(stdout, "QMake is Open Source software from The Qt Company Ltd and/or its subsidiary(-ies).\n");
#endif
@@ -353,9 +355,9 @@ Option::init(int argc, char **argv)
}
if (Q_UNLIKELY(globals->qmake_abslocation.isNull())) {
// This is rather unlikely to ever happen on a modern system ...
- globals->qmake_abslocation = QLibraryInfo::rawLocation(
- QLibraryInfo::HostBinariesPath,
- QLibraryInfo::EffectivePaths)
+ globals->qmake_abslocation =
+ QMakeLibraryInfo::rawLocation(QMakeLibraryInfo::HostBinariesPath,
+ QMakeLibraryInfo::EffectivePaths)
#ifdef Q_OS_WIN
+ "/qmake.exe";
#else
diff --git a/qmake/property.cpp b/qmake/property.cpp
index 63048f906d..2487ecb5a9 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -31,7 +31,7 @@
#include <qdir.h>
#include <qsettings.h>
-#include <qlibraryinfo.h>
+#include <qmakelibraryinfo.h>
#include <qstringlist.h>
#include <stdio.h>
@@ -39,11 +39,11 @@ QT_BEGIN_NAMESPACE
static const struct {
const char *name;
- QLibraryInfo::LibraryPath loc;
+ int loc;
bool raw;
bool singular;
} propList[] = {
- { "QT_SYSROOT", QLibraryInfo::SysrootPath, true, true },
+ { "QT_SYSROOT", QMakeLibraryInfo::SysrootPath, true, true },
{ "QT_INSTALL_PREFIX", QLibraryInfo::PrefixPath, false, false },
{ "QT_INSTALL_ARCHDATA", QLibraryInfo::ArchDataPath, false, false },
{ "QT_INSTALL_DATA", QLibraryInfo::DataPath, false, false },
@@ -59,13 +59,13 @@ static const struct {
{ "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, false, false },
{ "QT_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, false, false },
{ "QT_INSTALL_DEMOS", QLibraryInfo::ExamplesPath, false, false }, // Just backwards compat
- { "QT_HOST_PREFIX", QLibraryInfo::HostPrefixPath, true, false },
- { "QT_HOST_DATA", QLibraryInfo::HostDataPath, true, false },
- { "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true, false },
- { "QT_HOST_LIBS", QLibraryInfo::HostLibrariesPath, true, false },
- { "QT_HOST_LIBEXECS", QLibraryInfo::HostLibraryExecutablesPath, true, false },
- { "QMAKE_SPEC", QLibraryInfo::HostSpecPath, true, true },
- { "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true, true },
+ { "QT_HOST_PREFIX", QMakeLibraryInfo::HostPrefixPath, true, false },
+ { "QT_HOST_DATA", QMakeLibraryInfo::HostDataPath, true, false },
+ { "QT_HOST_BINS", QMakeLibraryInfo::HostBinariesPath, true, false },
+ { "QT_HOST_LIBEXECS", QMakeLibraryInfo::HostLibraryExecutablesPath, true, false },
+ { "QT_HOST_LIBS", QMakeLibraryInfo::HostLibrariesPath, true, false },
+ { "QMAKE_SPEC", QMakeLibraryInfo::HostSpecPath, true, true },
+ { "QMAKE_XSPEC", QMakeLibraryInfo::TargetSpecPath, true, true },
};
QMakeProperty::QMakeProperty() : settings(nullptr)
@@ -75,17 +75,20 @@ QMakeProperty::QMakeProperty() : settings(nullptr)
void QMakeProperty::reload()
{
- QLibraryInfo::reload();
+ QMakeLibraryInfo::reload();
for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) {
QString name = QString::fromLatin1(propList[i].name);
if (!propList[i].singular) {
- m_values[ProKey(name + "/src")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectiveSourcePaths);
- m_values[ProKey(name + "/get")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectivePaths);
+ m_values[ProKey(name + "/src")] = QMakeLibraryInfo::rawLocation(
+ propList[i].loc, QMakeLibraryInfo::EffectiveSourcePaths);
+ m_values[ProKey(name + "/get")] = QMakeLibraryInfo::rawLocation(
+ propList[i].loc, QMakeLibraryInfo::EffectivePaths);
}
- QString val = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::FinalPaths);
+ QString val = QMakeLibraryInfo::rawLocation(propList[i].loc, QMakeLibraryInfo::FinalPaths);
if (!propList[i].raw) {
- m_values[ProKey(name + "/dev")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::DevicePaths);
- m_values[ProKey(name)] = QLibraryInfo::path(propList[i].loc);
+ m_values[ProKey(name + "/dev")] =
+ QMakeLibraryInfo::rawLocation(propList[i].loc, QMakeLibraryInfo::DevicePaths);
+ m_values[ProKey(name)] = QMakeLibraryInfo::path(propList[i].loc);
name += "/raw";
}
m_values[ProKey(name)] = val;
diff --git a/qmake/qmakelibraryinfo.cpp b/qmake/qmakelibraryinfo.cpp
new file mode 100644
index 0000000000..581d1ad086
--- /dev/null
+++ b/qmake/qmakelibraryinfo.cpp
@@ -0,0 +1,313 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module 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$
+**
+****************************************************************************/
+
+#include "qmakelibraryinfo.h"
+
+#include <qdir.h>
+#include <qfile.h>
+#include <qglobalstatic.h>
+#include <qsettings.h>
+#include <qscopedpointer.h>
+#include <qstringlist.h>
+
+#include <qmakeconfig.cpp>
+
+QT_BEGIN_NAMESPACE
+
+// qmake_libraryInfoFile and qmake_abslocation are defined in option.cpp
+QString qmake_libraryInfoFile();
+QString qmake_abslocation();
+
+struct QMakeLibrarySettings
+{
+ QMakeLibrarySettings() { load(); }
+
+ void load();
+
+ QScopedPointer<QSettings> settings;
+ bool haveDevicePaths;
+ bool haveEffectiveSourcePaths;
+ bool haveEffectivePaths;
+ bool havePaths;
+ bool reloadOnQAppAvailable;
+};
+Q_GLOBAL_STATIC(QMakeLibrarySettings, qmake_library_settings)
+
+QSettings *QMakeLibraryInfo::findConfiguration()
+{
+ QString qtconfig = qmake_libraryInfoFile();
+ if (!qtconfig.isEmpty())
+ return new QSettings(qtconfig, QSettings::IniFormat);
+ return nullptr; // no luck
+}
+
+QSettings *QMakeLibraryInfo::configuration()
+{
+ QMakeLibrarySettings *ls = qmake_library_settings();
+ return ls ? ls->settings.data() : nullptr;
+}
+
+void QMakeLibraryInfo::reload()
+{
+ if (qmake_library_settings.exists())
+ qmake_library_settings->load();
+}
+
+bool QMakeLibraryInfo::haveGroup(PathGroup group)
+{
+ QMakeLibrarySettings *ls = qmake_library_settings();
+ return ls
+ && (group == EffectiveSourcePaths ? ls->haveEffectiveSourcePaths
+ : group == EffectivePaths ? ls->haveEffectivePaths
+ : group == DevicePaths ? ls->haveDevicePaths
+ : ls->havePaths);
+}
+
+void QMakeLibrarySettings::load()
+{
+ settings.reset(QMakeLibraryInfo::findConfiguration());
+ if (settings) {
+ QStringList children = settings->childGroups();
+ haveDevicePaths = children.contains(QLatin1String("DevicePaths"));
+ haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths"));
+ haveEffectivePaths =
+ haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths"));
+ // Backwards compat: an existing but empty file is claimed to contain the Paths section.
+ havePaths = (!haveDevicePaths && !haveEffectivePaths
+ && !children.contains(QLatin1String(platformsSection)))
+ || children.contains(QLatin1String("Paths"));
+ } else {
+ haveDevicePaths = false;
+ haveEffectiveSourcePaths = false;
+ haveEffectivePaths = false;
+ havePaths = false;
+ }
+}
+
+void QMakeLibraryInfo::sysrootify(QString &path)
+{
+ // Acceptable values for SysrootifyPrefixPath are "true" and "false"
+ if (!QVariant::fromValue(rawLocation(SysrootifyPrefixPath, FinalPaths)).toBool())
+ return;
+
+ const QString sysroot = rawLocation(SysrootPath, FinalPaths);
+ if (sysroot.isEmpty())
+ return;
+
+ if (path.length() > 2 && path.at(1) == QLatin1Char(':')
+ && (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) {
+ path.replace(0, 2, sysroot); // Strip out the drive on Windows targets
+ } else {
+ path.prepend(sysroot);
+ }
+}
+
+static QString getPrefixFromHostBinDir(const char *hostBinDirToPrefixPath)
+{
+ const QString canonicalQMakePath = QFileInfo(qmake_abslocation()).canonicalPath();
+ return QDir::cleanPath(canonicalQMakePath + QLatin1Char('/')
+ + QLatin1String(hostBinDirToPrefixPath));
+}
+
+static QString getExtPrefixFromHostBinDir()
+{
+ return getPrefixFromHostBinDir(QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH);
+}
+
+static QString getHostPrefixFromHostBinDir()
+{
+ return getPrefixFromHostBinDir(QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH);
+}
+
+static QString getPrefix(QMakeLibraryInfo::PathGroup group)
+{
+#if QT_CONFIGURE_CROSSBUILD
+ if (group == QMakeLibraryInfo::DevicePaths)
+ return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH);
+#else
+ Q_UNUSED(group);
+#endif
+ return getExtPrefixFromHostBinDir();
+}
+
+QString QMakeLibraryInfo::path(int loc)
+{
+ QString ret = rawLocation(loc, QMakeLibraryInfo::FinalPaths);
+
+ // Automatically prepend the sysroot to target paths
+ if (loc < QMakeLibraryInfo::SysrootPath || loc > QMakeLibraryInfo::LastHostPath)
+ sysrootify(ret);
+
+ return ret;
+}
+
+QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group)
+{
+ QString ret;
+ bool fromConf = false;
+ // Logic for choosing the right data source: if EffectivePaths are requested
+ // and qt.conf with that section is present, use it, otherwise fall back to
+ // FinalPaths. For FinalPaths, use qt.conf if present and contains not only
+ // [EffectivePaths], otherwise fall back to builtins.
+ // EffectiveSourcePaths falls back to EffectivePaths.
+ // DevicePaths falls back to FinalPaths.
+ PathGroup orig_group = group;
+ if (QMakeLibraryInfo::haveGroup(group)
+ || (group == EffectiveSourcePaths
+ && (group = EffectivePaths, QMakeLibraryInfo::haveGroup(group)))
+ || ((group == EffectivePaths || group == DevicePaths)
+ && (group = FinalPaths, QMakeLibraryInfo::haveGroup(group)))
+ || (group = orig_group, false)) {
+ fromConf = true;
+
+ QString key;
+ QString defaultValue;
+ if (unsigned(loc) < sizeof(qtConfEntries) / sizeof(qtConfEntries[0])) {
+ key = QLatin1String(qtConfEntries[loc].key);
+ defaultValue = QLatin1String(qtConfEntries[loc].value);
+ }
+#ifndef Q_OS_WIN // On Windows we use the registry
+ else if (loc == QLibraryInfo::SettingsPath) {
+ key = QLatin1String("Settings");
+ defaultValue = QLatin1String(".");
+ }
+#endif
+ if (!key.isNull()) {
+ QSettings *config = QMakeLibraryInfo::configuration();
+ config->beginGroup(QLatin1String(group == DevicePaths ? "DevicePaths"
+ : group == EffectiveSourcePaths
+ ? "EffectiveSourcePaths"
+ : group == EffectivePaths ? "EffectivePaths"
+ : "Paths"));
+
+ ret = config->value(key, defaultValue).toString();
+
+ if (ret.isEmpty()) {
+ if (loc == HostPrefixPath)
+ ret = config->value(QLatin1String(qtConfEntries[QLibraryInfo::PrefixPath].key),
+ QLatin1String(
+ qtConfEntries[QLibraryInfo::PrefixPath].value))
+ .toString();
+ else if (loc == TargetSpecPath || loc == HostSpecPath
+ || loc == SysrootifyPrefixPath)
+ fromConf = false;
+ // The last case here is SysrootPath, which can be legitimately empty.
+ // All other keys have non-empty fallbacks to start with.
+ }
+
+ // TODO: Might be replaced by common for qmake and qtcore function
+ int startIndex = 0;
+ forever {
+ startIndex = ret.indexOf(QLatin1Char('$'), startIndex);
+ if (startIndex < 0)
+ break;
+ if (ret.length() < startIndex + 3)
+ break;
+ if (ret.at(startIndex + 1) != QLatin1Char('(')) {
+ startIndex++;
+ continue;
+ }
+ int endIndex = ret.indexOf(QLatin1Char(')'), startIndex + 2);
+ if (endIndex < 0)
+ break;
+ auto envVarName =
+ QStringView { ret }.mid(startIndex + 2, endIndex - startIndex - 2);
+ QString value =
+ QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
+ ret.replace(startIndex, endIndex - startIndex + 1, value);
+ startIndex += value.length();
+ }
+ config->endGroup();
+
+ ret = QDir::fromNativeSeparators(ret);
+ }
+ }
+
+ if (!fromConf) {
+ // "volatile" here is a hack to prevent compilers from doing a
+ // compile-time strlen() on "path". The issue is that Qt installers
+ // will binary-patch the Qt installation paths -- in such scenarios, Qt
+ // will be built with a dummy path, thus the compile-time result of
+ // strlen is meaningless.
+ const char *volatile path = nullptr;
+ if (loc == QLibraryInfo::PrefixPath) {
+ ret = getPrefix(group);
+ } else if (unsigned(loc)
+ <= sizeof(qt_configure_str_offsets) / sizeof(qt_configure_str_offsets[0])) {
+ path = qt_configure_strs + qt_configure_str_offsets[loc - 1];
+#ifndef Q_OS_WIN // On Windows we use the registry
+ } else if (loc == QLibraryInfo::SettingsPath) {
+ path = QT_CONFIGURE_SETTINGS_PATH;
+#endif
+ } else if (loc == HostPrefixPath) {
+ static const QByteArray hostPrefixPath = getHostPrefixFromHostBinDir().toLatin1();
+ path = hostPrefixPath.constData();
+ }
+
+ if (path)
+ ret = QString::fromLocal8Bit(path);
+ }
+
+ // These values aren't actually paths and thus need to be returned verbatim.
+ if (loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath)
+ return ret;
+
+ if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
+ QString baseDir;
+ if (loc == HostPrefixPath || loc == QLibraryInfo::PrefixPath || loc == SysrootPath) {
+ // We make the prefix/sysroot path absolute to the executable's directory.
+ // loc == PrefixPath while a sysroot is set would make no sense here.
+ // loc == SysrootPath only makes sense if qmake lives inside the sysroot itself.
+ baseDir = QFileInfo(qmake_libraryInfoFile()).absolutePath();
+ } else if (loc > SysrootPath && loc <= LastHostPath) {
+ // We make any other host path absolute to the host prefix directory.
+ baseDir = rawLocation(HostPrefixPath, group);
+ } else {
+ // we make any other path absolute to the prefix directory
+ baseDir = rawLocation(QLibraryInfo::PrefixPath, group);
+ if (group == EffectivePaths)
+ sysrootify(baseDir);
+ }
+ ret = QDir::cleanPath(baseDir + QLatin1Char('/') + ret);
+ }
+ return ret;
+}
+
+QT_END_NAMESPACE
diff --git a/qmake/qmakelibraryinfo.h b/qmake/qmakelibraryinfo.h
new file mode 100644
index 0000000000..69b62e9876
--- /dev/null
+++ b/qmake/qmakelibraryinfo.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module 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$
+**
+****************************************************************************/
+
+#ifndef QMAKELIBRARYINFO_H
+#define QMAKELIBRARYINFO_H
+
+#include <qlibraryinfo.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSettings;
+
+struct QMakeLibraryInfo
+{
+ static QSettings *findConfiguration();
+ static QSettings *configuration();
+ static QString path(int loc);
+ static QStringList platformPluginArguments(const QString &platformName);
+
+ /* This enum has to start after the last value in QLibraryInfo::LibraryPath(NOT SettingsPath!).
+ * See qconfig.cpp.in and QLibraryInfo for details.
+ */
+ enum LibraryPathQMakeExtras {
+ SysrootPath = QLibraryInfo::TestsPath + 1,
+ SysrootifyPrefixPath,
+ HostBinariesPath,
+ HostLibraryExecutablesPath,
+ HostLibrariesPath,
+ HostDataPath,
+ TargetSpecPath,
+ HostSpecPath,
+ HostPrefixPath,
+ LastHostPath = HostPrefixPath,
+ };
+ enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths };
+ static QString rawLocation(int loc, PathGroup group);
+ static void reload();
+ static bool haveGroup(PathGroup group);
+ static void sysrootify(QString &path);
+};
+
+QT_END_NAMESPACE
+
+#endif // QMAKELIBRARYINFO_H