blob: aed738bece783ba7f61bb0c85c3754acf2eac28a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "utils_global.h"
#include "osspecificaspects.h"
#include <optional>
#ifdef Q_OS_WIN
#define QTC_HOST_EXE_SUFFIX QTC_WIN_EXE_SUFFIX
#else
#define QTC_HOST_EXE_SUFFIX ""
#endif // Q_OS_WIN
namespace Utils { class FilePath; }
// The "Host" is the machine QtCreator is running on.
namespace Utils::HostOsInfo {
QTCREATOR_UTILS_EXPORT constexpr OsType hostOs()
{
#if defined(Q_OS_WIN)
return OsTypeWindows;
#elif defined(Q_OS_LINUX)
return OsTypeLinux;
#elif defined(Q_OS_MAC)
return OsTypeMac;
#elif defined(Q_OS_UNIX)
return OsTypeOtherUnix;
#else
return OsTypeOther;
#endif
}
//! Returns the architecture of the host system.
QTCREATOR_UTILS_EXPORT OsArch hostArchitecture();
//! Returns the architecture the running binary was compiled for.
QTCREATOR_UTILS_EXPORT OsArch binaryArchitecture();
QTCREATOR_UTILS_EXPORT constexpr bool isWindowsHost() { return hostOs() == OsTypeWindows; }
QTCREATOR_UTILS_EXPORT constexpr bool isLinuxHost() { return hostOs() == OsTypeLinux; }
QTCREATOR_UTILS_EXPORT constexpr bool isMacHost() { return hostOs() == OsTypeMac; }
QTCREATOR_UTILS_EXPORT constexpr bool isAnyUnixHost()
{
#ifdef Q_OS_UNIX
return true;
#else
return false;
#endif
}
QTCREATOR_UTILS_EXPORT QString withExecutableSuffix(const QString &executable);
QTCREATOR_UTILS_EXPORT void setOverrideFileNameCaseSensitivity(Qt::CaseSensitivity sensitivity);
QTCREATOR_UTILS_EXPORT void unsetOverrideFileNameCaseSensitivity();
QTCREATOR_UTILS_EXPORT Qt::CaseSensitivity fileNameCaseSensitivity();
QTCREATOR_UTILS_EXPORT constexpr QChar pathListSeparator()
{
return OsSpecificAspects::pathListSeparator(hostOs());
}
QTCREATOR_UTILS_EXPORT constexpr Qt::KeyboardModifier controlModifier()
{
return OsSpecificAspects::controlModifier(hostOs());
}
QTCREATOR_UTILS_EXPORT std::optional<quint64> totalMemoryInstalledInBytes();
QTCREATOR_UTILS_EXPORT const FilePath &root(); // Do not use.
} // namespace Utils::HostOsInfo
|