44 #if QT_CONFIG(settings)
53 #include "private/qglobal_p.h"
55 #include "qconfig.cpp"
58 # include "private/qcore_mac_p.h"
61 #if QT_CONFIG(relocatable) && QT_CONFIG(dlopen) && !QT_CONFIG(framework)
65 #if QT_CONFIG(relocatable) && defined(Q_OS_WIN)
73 #if QT_CONFIG(settings)
77 struct QLibrarySettings
86 bool reloadOnQAppAvailable;
90 QLibrarySettings::QLibrarySettings() :
paths(
false), reloadOnQAppAvailable(
false)
95 QSettings *QLibrarySettings::configuration()
102 bool QLibrarySettings::havePaths()
112 settings.reset(findConfiguration());
126 if (QLibraryInfoPrivate::qtconfManualPath)
133 CFBundleRef bundleRef = CFBundleGetMainBundle();
140 QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
159 const QString *QLibraryInfoPrivate::qtconfManualPath =
nullptr;
161 QSettings *QLibraryInfoPrivate::configuration()
163 QLibrarySettings *ls = qt_library_settings();
164 return ls ? ls->configuration() :
nullptr;
167 void QLibraryInfoPrivate::reload()
169 if (qt_library_settings.exists())
170 qt_library_settings->load();
173 static bool havePaths() {
174 QLibrarySettings *ls = qt_library_settings();
175 return ls && ls->havePaths();
205 QLibraryInfo::QLibraryInfo()
208 #if defined(Q_CC_INTEL)
209 # ifdef __INTEL_CLANG_COMPILER
210 # define ICC_COMPAT "Clang"
211 # elif defined(__INTEL_MS_COMPAT_LEVEL)
212 # define ICC_COMPAT "Microsoft"
213 # elif defined(__GNUC__)
214 # define ICC_COMPAT "GCC"
216 # define ICC_COMPAT "no"
218 # if __INTEL_COMPILER == 1300
219 # define ICC_VERSION "13.0"
220 # elif __INTEL_COMPILER == 1310
221 # define ICC_VERSION "13.1"
222 # elif __INTEL_COMPILER == 1400
223 # define ICC_VERSION "14.0"
224 # elif __INTEL_COMPILER == 1500
225 # define ICC_VERSION "15.0"
227 # define ICC_VERSION QT_STRINGIFY(__INTEL_COMPILER)
229 # ifdef __INTEL_COMPILER_UPDATE
230 # define COMPILER_STRING "Intel(R) C++ " ICC_VERSION "." QT_STRINGIFY(__INTEL_COMPILER_UPDATE) \
231 " build " QT_STRINGIFY(__INTEL_COMPILER_BUILD_DATE) " [" \
232 ICC_COMPAT " compatibility]"
234 # define COMPILER_STRING "Intel(R) C++ " ICC_VERSION \
235 " build " QT_STRINGIFY(__INTEL_COMPILER_BUILD_DATE) " [" \
236 ICC_COMPAT " compatibility]"
238 #elif defined(Q_CC_CLANG)
239 # ifdef __apple_build_version__
240 # define COMPILER_STRING "Clang " __clang_version__ " (Apple)"
242 # define COMPILER_STRING "Clang " __clang_version__
244 #elif defined(Q_CC_GHS)
245 # define COMPILER_STRING "GHS " QT_STRINGIFY(__GHS_VERSION_NUMBER)
246 #elif defined(Q_CC_GNU)
247 # define COMPILER_STRING "GCC " __VERSION__
248 #elif defined(Q_CC_MSVC)
250 # define COMPILER_STRING "MSVC 2015"
251 # elif _MSC_VER < 1917
252 # define COMPILER_STRING "MSVC 2017"
253 # elif _MSC_VER < 1930
254 # define COMPILER_STRING "MSVC 2019"
255 # elif _MSC_VER < 2000
256 # define COMPILER_STRING "MSVC 2022"
258 # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER)
261 # define COMPILER_STRING "<unknown compiler>"
264 # define DEBUG_STRING " release"
266 # define DEBUG_STRING " debug"
269 # define SHARED_STRING " shared (dynamic)"
271 # define SHARED_STRING " static"
273 #define QT_BUILD_STR "Qt " QT_VERSION_STR " (" ARCH_FULL SHARED_STRING DEBUG_STRING " build; by " COMPILER_STRING ")"
311 return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH);
314 static QString prefixFromAppDirHelper()
320 CFBundleRef bundleRef = CFBundleGetMainBundle();
324 QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
327 if (
QDir(bundleContentsDir).exists())
344 #if QT_CONFIG(relocatable)
345 #if !defined(QT_STATIC) && !(defined(Q_OS_DARWIN) && QT_CONFIG(framework)) \
346 && (QT_CONFIG(dlopen) || defined(Q_OS_WIN))
347 static QString prefixFromQtCoreLibraryHelper(
const QString &qtCoreLibraryPath)
357 #if defined(Q_OS_WIN)
358 static HMODULE getWindowsModuleHandle()
362 GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
368 static QString getRelocatablePrefix()
374 #if defined(QT_STATIC)
375 prefixPath = prefixFromAppDirHelper();
376 #elif defined(Q_OS_DARWIN) && QT_CONFIG(framework)
378 #define QT_LIBINFIX ""
380 auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR(
"org.qt-project.QtCore" QT_LIBINFIX));
387 auto allBundles = CFBundleGetAllBundles();
388 auto bundleCount = CFArrayGetCount(allBundles);
389 for (
int i = 0;
i < bundleCount; ++
i) {
390 auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles,
i));
393 if (CFStringHasSuffix(
path, CFSTR(
"/QtCore" QT_LIBINFIX
".framework"))) {
409 const QCFString libDirCFString = CFURLCopyFileSystemPath(libDirCFPath, kCFURLPOSIXPathStyle);
415 #elif QT_CONFIG(dlopen)
420 #elif defined(Q_OS_WIN)
421 HMODULE hModule = getWindowsModuleHandle();
422 const int kBufferSize = 4096;
423 wchar_t buffer[kBufferSize];
424 DWORD pathSize = GetModuleFileName(hModule,
buffer, kBufferSize);
427 pathSize = GetModuleFileName(
NULL,
buffer, kBufferSize);
436 #if defined(Q_CC_MINGW)
443 const QString qtCoreImpLibFileName = implibPrefix
445 const QString qtCoreImpLibPath = qtCoreDirPath
446 + slash +
QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH)
448 + slash + qtCoreImpLibFileName;
456 prefixPath = prefixFromQtCoreLibraryHelper(qtCoreFilePath);
458 #error "The chosen platform / config does not support querying for a dynamic prefix."
461 #if defined(Q_OS_LINUX) && !defined(QT_STATIC) && defined(__GLIBC__)
467 QDir prefixDir(prefixPath);
468 while (!prefixDir.exists(libdir)) {
470 prefixPath = prefixDir.absolutePath();
471 if (prefixDir.isRoot()) {
479 "Failed to find the Qt prefix path.");
486 #if QT_CONFIG(relocatable)
487 return getRelocatablePrefix();
503 "Documentation",
"doc",
504 "Headers",
"include",
507 "LibraryExecutables",
"bin",
509 "LibraryExecutables",
"libexec",
512 "Plugins",
"plugins",
518 "Translations",
"translations",
519 "Examples",
"examples",
523 static_assert(dot.size() == 1);
524 static_assert(dot[0] ==
'.');
528 if (
int(
loc) < qtConfEntries.count()) {
531 if (
result.key ==
u"QmlImports")
532 result.fallbackKey =
u"Qml2Imports"_qs;
557 bool fromConf =
false;
558 #if QT_CONFIG(settings)
563 if (!li.key.isNull()) {
568 if (li.fallbackKey.isNull()) {
569 ret =
config->value(li.key, li.defaultValue).toString();
573 v =
config->value(li.fallbackKey, li.defaultValue);
582 if (
ret.length() < startIndex + 3)
591 auto envVarName =
QStringView{
ret}.mid(startIndex + 2, endIndex - startIndex - 2);
593 ret.replace(startIndex, endIndex - startIndex + 1,
value);
594 startIndex +=
value.length();
607 }
else if (
int(
loc) <= qt_configure_strs.count()) {
615 const char *
volatile path = QT_CONFIGURE_SETTINGS_PATH;
624 baseDir = prefixFromAppDirHelper();
649 #if QT_CONFIG(settings)
697 #if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
702 #include "private/qcoreapplication_p.h"
709 # if defined(Q_OS_LINUX)
712 # ifdef QT_ELF_NOTE_OS_TYPE
715 static_assert(
sizeof(Elf32_Nhdr) ==
sizeof(Elf64_Nhdr),
716 "The size of an ELF note is wrong (should be 12 bytes)");
721 # ifdef QT_ELF_NOTE_OS_PATCH
727 .n_namesz =
sizeof(
name),
728 .n_descsz =
sizeof(Payload),
729 .n_type = NT_GNU_ABI_TAG
731 char name[
sizeof ELF_NOTE_GNU] = ELF_NOTE_GNU;
735 extern constexpr ElfNoteAbiTag QT_MANGLE_NAMESPACE(qt_abi_tag) = {};
738 extern const char qt_core_interpreter[]
__attribute__((section(
".interp")))
741 extern "C" void qt_core_boilerplate()
__attribute__((force_align_arg_pointer));
742 void qt_core_boilerplate()
744 printf(
"This is the QtCore library version " QT_BUILD_STR "\n"
745 "Copyright (C) 2016 The Qt Company Ltd.\n"
746 "Contact: http://www.qt.io/licensing/\n"
748 "Installation prefix: %s\n"
751 QT_CONFIGURE_PREFIX_PATH,
small capitals from c petite p scientific f u
small capitals from c petite p scientific i
[1]
const QByteArray payload("Qt rocks!")
static QCoreApplication * instance()
static QString applicationDirPath()
The QDir class provides access to directory structures and their contents.
static bool isRelativePath(const QString &path)
static QString fromNativeSeparators(const QString &pathName)
static QString cleanPath(const QString &path)
static QString currentPath()
The QFileInfo class provides system-independent file information.
QString completeBaseName() const
QString absolutePath() const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
The QLibraryInfo class provides information about the Qt library.
static bool isDebugBuild()
static QStringList platformPluginArguments(const QString &platformName)
static QString path(LibraryPath p)
static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION
static const char * build() noexcept
static LocationInfo locationInfo(QLibraryInfo::LibraryPath loc)
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
The QSettings class provides persistent platform-independent application settings.
QVariant value(const QString &key, const QVariant &defaultValue) const
QStringList childGroups() const
The QString class provides a Unicode character string.
static QString fromLocal8Bit(QByteArrayView ba)
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
The QStringList class provides a list of strings.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
The QVariant class acts like a union for the most common Qt data types.
QStringList toStringList() const
The QVersionNumber class contains a version number with an arbitrary number of segments.
backing_store_ptr info
[4]
#define QT_ELF_NOTE_OS_PATCH
#define QT_ELF_NOTE_OS_TYPE
#define QT_ELF_NOTE_OS_MINOR
#define QT_ELF_NOTE_OS_MAJOR
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_DISABLE_CLANG(text)
QList< QString > QStringList
EGLOutputLayerEXT EGLint EGLAttrib value
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
QT_BEGIN_NAMESPACE void qDumpCPUFeatures()
constexpr auto qOffsetStringArray(const char(&...strings)[Nx]) noexcept
GLsizei const GLfloat * v
[13]
GLsizei const GLuint * paths
GLsizei const GLchar *const * path
#define Q_ASSERT_X(cond, x, msg)
Int aligned(Int v, Int byteAlign)
int QT_PREPEND_NAMESPACE(QSharedMemoryPrivate)
#define QStringLiteral(str)
QSettings settings("MySoft", "Star Runner")
[0]
QUrl url("http://www.example.com/List of holidays.xml")
[0]
QHttpRequestHeader header("GET", QUrl::toPercentEncoding("/index.html"))
[1]
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.