Use the qmake based configuration system also on Windows

Adapt configure.exe to use qmake to do most of the work of configuring
Qt. This unifies a large part of our configuration system between Unix
and Windows. configure.exe is now still doing the license check,
creating qconfig.cpp, building qmake, and not much more.

On the way, re-implement the still missing Windows-specific tests with
the new system.

The opengles2 vs. opengl-desktop conditions got a bit convoluted, as
Unix prefers desktop GL, while Windows GLES2 (via ANGLE). Superficially,
there is a circular dependency, but the platform scopes are supposed to
break it.

Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: Ia1941f2c34b7f5bd4990a7673cd737361381c2e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Lars Knoll 2016-08-14 09:48:55 +02:00 committed by Oswald Buddenhagen
parent c027cffbef
commit 97b856b788
9 changed files with 257 additions and 2813 deletions

View File

@ -6,7 +6,6 @@ are mentioned in the descriptions of the options they relate to.
It is also possible to manipulate any QMAKE_* variable, to amend the values
from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3.
(Unix/MSys configure only)
Top-level installation directories:
-prefix <dir> ...... The deployment directory, as seen on the target device.

View File

@ -11,6 +11,8 @@
"DBUS_PATH": "dbus.prefix",
"MYSQL_PATH": "mysql.prefix",
"OPENSSL_LIBS": "openssl.libs",
"OPENSSL_LIBS_DEBUG": "openssl.libs.debug",
"OPENSSL_LIBS_RELEASE": "openssl.libs.release",
"OPENSSL_PATH": "openssl.prefix",
"PSQL_LIBS": "psql.libs",
"SYBASE": "tds.prefix",
@ -53,6 +55,7 @@
"accessibility": "boolean",
"alsa": "boolean",
"angle": "boolean",
"audio-backend": "boolean",
"avx": "boolean",
"avx2": "boolean",
@ -99,6 +102,7 @@
"iconv": { "type": "enum", "values": [ "no", "yes", "posix", "sun", "gnu" ] },
"icu": "boolean",
"imf": { "type": "boolean", "name": "qqnx_imf" },
"incredibuild-xge": { "type": "boolean", "name": "incredibuild_xge" },
"inotify": "boolean",
"journald": "boolean",
"lgmon": "boolean",
@ -111,13 +115,16 @@
"ltcg": "boolean",
"kms": "boolean",
"make": { "type": "addString", "values": [ "examples", "libs", "tests", "tools" ] },
"make-tool": "string",
"mips_dsp": "boolean",
"mips_dspr2": "boolean",
"mirclient": "boolean",
"mp": { "type": "boolean", "name": "msvc_mp" },
"mtdev": "boolean",
"mysql_config": "string",
"nomake": { "type": "addString", "values": [ "examples", "tests", "tools" ] },
"opengl": { "type": "optionalString", "values": [ "no", "yes", "desktop", "es2" ] },
"opengl": { "type": "optionalString", "values": [ "no", "yes", "desktop", "es2", "dynamic" ] },
"opengl-es-2": { "type": "void", "name": "opengl", "value": "es2" },
"opengles3": "boolean",
"opensource": { "type": "void", "name": "commercial", "value": "no" },
"openssl": { "type": "optionalString", "values": [ "no", "yes", "linked", "runtime" ] },
@ -129,6 +136,7 @@
"pcre": { "type": "enum", "values": [ "qt", "system" ] },
"pkg-config": "boolean",
"platform": "string",
"plugin-manifests": "boolean",
"pps": { "type": "boolean", "name": "qqnx_pps" },
"posix-ipc": { "type": "boolean", "name": "ipc_posix" },
"profile": "boolean",
@ -144,6 +152,7 @@
"reduce-relocations": { "type": "boolean", "name": "reduce_relocations" },
"release": { "type": "enum", "name": "debug", "values": { "yes": "no", "no": "yes" } },
"rpath": "boolean",
"rtti": "boolean",
"sanitize": "sanitize",
"sctp": "boolean",
"sdk": "string",
@ -172,6 +181,7 @@
"plugin-sql-sqlite": { "type": "void", "name": "sqlite" },
"plugin-sql-sqlite2": { "type": "void", "name": "sqlite2" },
"plugin-sql-tds": { "type": "void", "name": "tds" },
"qdbus": { "type": "boolean", "name": "dbus" },
"sqlite": { "type": "enum", "name": "system-sqlite", "values": { "qt": "no", "system": "yes" } },
"sse2": "boolean",
"sse3": "boolean",
@ -180,6 +190,7 @@
"ssl": "boolean",
"ssse3": "boolean",
"static": { "type": "enum", "name": "shared", "values": { "yes": "no", "no": "yes" } },
"static-runtime": { "type": "boolean", "name": "static_runtime" },
"strip": "boolean",
"style-windows": "boolean",
"style-windowsxp": "boolean",
@ -187,6 +198,7 @@
"style-fusion": "boolean",
"style-mac": "boolean",
"style-android": "boolean",
"syncqt": "boolean",
"syslog": "boolean",
"sysroot": "string",
"system-proxies": "boolean",
@ -196,6 +208,7 @@
"warnings-are-errors": { "type": "boolean", "name": "warnings_are_errors" },
"Werror": { "type": "boolean", "name": "warnings_are_errors" },
"widgets": "boolean",
"wmf-backend": "boolean",
"xcb": { "type": "enum", "values": [ "no", "yes", "qt", "system" ] },
"xcb-xlib": "boolean",
"xinput2": "boolean",
@ -304,6 +317,15 @@
"export": "",
"sources": [
{ "type": "openssl" },
{
"comment": "placeholder for OPENSSL_LIBS{,_{DEBUG,RELEASE}}",
"libs": "",
"builds": {
"debug": "",
"release": ""
},
"condition": "config.win32 && !features.shared"
},
{ "libs": "-lssleay32 -llibeay32", "condition": "config.win32 && features.shared" },
{ "libs": "-lssl -lcrypto", "condition": "!config.win32" }
]
@ -767,11 +789,13 @@
"detectPkgConfig": [ "cross_compile" ],
"library": [ "pkg-config" ],
"getPkgConfigVariable": [ "pkg-config" ],
"neon": [ "architecture" ]
"neon": [ "architecture" ],
"directX": [ "architecture", "sse2" ]
},
"testTypeAliases": {
"compile": [ "library", "architecture" ],
"files": [ "directX" ],
"getPkgConfigVariable": [ "xkbConfigRoot" ]
},
@ -1171,6 +1195,15 @@
"pkg-config-variable": "xkb_base",
"log": "value"
},
"directx": {
"description": "DirectX SDK",
"type": "directX",
"files": [
"d3dcompiler.h",
"d3d11.lib",
"fxc.exe"
]
},
"opengles3": {
"description": "OpenGL ES 3.0",
"type": "compile",
@ -1194,6 +1227,22 @@
"type": "files",
"files": [ "uxtheme.h" ]
},
"direct2d": {
"description": "Direct 2D",
"type": "compile",
"test": "qpa/direct2d",
"use": "direct2d"
},
"incredibuild_xge": {
"description": "IncrediBuild",
"type": "files",
"files": [ "BuildConsole.exe", "xgConsole.exe" ]
},
"wmf": {
"description": "WMF",
"type": "files",
"files": [ "mfapi.h", "mf.lib" ]
},
"qpa_default_platform": {
"description": "default QPA platform",
"type": "qpaDefaultPlatform",
@ -1236,7 +1285,7 @@
},
"use_gold_linker": {
"description": "Using gold linker",
"condition": "tests.use_gold_linker",
"condition": "!config.msvc && tests.use_gold_linker",
"output": [ "privateConfig", "useGoldLinker" ]
},
"architecture": {
@ -1245,7 +1294,7 @@
},
"pkg-config": {
"description": "Using pkg-config",
"autoDetect": "!config.darwin",
"autoDetect": "!config.darwin && !config.win32",
"condition": "tests.pkg-config",
"output": [
{ "type": "publicQtConfig", "negative": true },
@ -1342,8 +1391,7 @@
},
"largefile": {
"description": "Large file support",
"emitIf": "!config.win32",
"condition": "!config.android && !config.integrity",
"condition": "!config.android && !config.integrity && !config.winrt",
"output": [
"privateConfig",
{ "type": "define", "name": "QT_LARGEFILE_SUPPORT", "value": 64 }
@ -1395,6 +1443,12 @@
"condition": "tests.GNUmake",
"output": [ "privateConfig" ]
},
"plugin-manifests": {
"description": "Embed manifests in plugins",
"emitIf": "config.win32",
"autoDetect": false,
"output": [ { "type": "publicConfig", "negative": true, "name": "no_plugin_manifest" } ]
},
"profile": {
"description": "GNU profiling support",
"autoDetect": false,
@ -1435,7 +1489,7 @@
},
"precompile_header": {
"description": "Using precompiled headers",
"condition": "!config.uikit && tests.precompile_header",
"condition": "config.msvc || (!config.uikit && tests.precompile_header)",
"output": [
"privateConfig",
{ "type": "varRemove", "negative": true, "name": "CONFIG", "value": "'precompile_header'" }
@ -1461,7 +1515,7 @@
},
"reduce_relocations": {
"description": "Reduce amount of relocations",
"condition": "tests.reduce_relocations",
"condition": "!config.win32 && tests.reduce_relocations",
"output": [
"publicQtConfig",
{ "type": "define", "name": "QT_REDUCE_RELOCATIONS" }
@ -1777,21 +1831,25 @@
},
"poll_ppoll": {
"description": "Native ppoll()",
"emitIf": "!config.win32",
"condition": "tests.ppoll",
"output": [ "publicQtConfig" ]
},
"poll_pollts": {
"description": "Native pollts()",
"emitIf": "!config.win32",
"condition": "!features.poll_ppoll && tests.pollts",
"output": [ "publicQtConfig" ]
},
"poll_poll": {
"description": "Native poll()",
"emitIf": "!config.win32",
"condition": "!features.poll_ppoll && !features.poll_pollts && tests.poll",
"output": [ "publicQtConfig" ]
},
"poll_select": {
"description": "Emulated poll()",
"emitIf": "!config.win32",
"condition": "!features.poll_ppoll && !features.poll_pollts && !features.poll_poll",
"output": [
"publicQtConfig",
@ -1800,6 +1858,7 @@
},
"ipc_posix": {
"description": "Using POSIX IPC",
"autoDetect": "!config.win32",
"condition": "!tests.ipc_sysv && tests.ipc_posix",
"output": [ { "type": "define", "name": "QT_POSIX_IPC" } ]
},
@ -1845,6 +1904,7 @@
"description": "OpenSSL",
"enable": "input.openssl == 'yes' || input.openssl == 'linked' || input.openssl == 'runtime'",
"disable": "input.openssl == 'no' || input.ssl == 'no'",
"autoDetect": "!config.winrt",
"condition": "!features.securetransport && tests.openssl",
"output": [
{ "type": "publicQtConfig", "condition": "!features.openssl-linked" },
@ -1859,12 +1919,16 @@
"output": [
"publicQtConfig",
{ "type": "varAssign", "name": "OPENSSL_LIBS", "value": "libs.openssl.libs", "eval": "true" },
{ "type": "varAssign", "name": "OPENSSL_LIBS_DEBUG", "value": "libs.openssl.builds.debug.libs",
"eval": "true", "condition": "config.win32" },
{ "type": "varAssign", "name": "OPENSSL_LIBS_RELEASE", "value": "libs.openssl.builds.release.libs",
"eval": "true", "condition": "config.win32" },
{ "type": "define", "name": "QT_LINKED_OPENSSL" }
]
},
"ssl": {
"description": "SSL",
"condition": "features.securetransport || features.openssl",
"condition": "config.winrt || features.securetransport || features.openssl",
"output": [ "feature" ]
},
"sctp": {
@ -1885,6 +1949,7 @@
},
"glib": {
"description": "GLib",
"autoDetect": "!config.win32",
"condition": "libs.glib",
"output": [ "feature" ]
},
@ -1991,7 +2056,7 @@
},
"fontconfig": {
"description": "Fontconfig",
"condition": "features.system-freetype && libs.fontconfig",
"condition": "!config.win32 && features.system-freetype && libs.fontconfig",
"output": [ "feature" ]
},
"harfbuzz": {
@ -2002,7 +2067,7 @@
"description": " Using system HarfBuzz",
"enable": "input.harfbuzz == 'system'",
"disable": "input.harfbuzz == 'qt'",
"autoDetect": "!config.darwin",
"autoDetect": "!config.darwin && !config.win32",
"condition": "features.harfbuzz && libs.harfbuzz",
"output": [ "publicQtConfig" ]
},
@ -2012,7 +2077,7 @@
},
"dbus": {
"description": "Qt D-Bus",
"autoDetect": "!config.android",
"autoDetect": "!config.android && !config.winrt",
"output": [ "feature" ]
},
"dbus-linked": {
@ -2057,7 +2122,7 @@
},
"egl": {
"description": "EGL",
"condition": "features.opengl && libs.egl",
"condition": "features.opengl && (features.angle || libs.egl)",
"output": [ "feature" ]
},
"egl_x11": {
@ -2067,7 +2132,7 @@
},
"eglfs": {
"description": "EGLFS",
"autoDetect": "!config.android",
"autoDetect": "!config.android && !config.win32",
"condition": "features.egl",
"output": [ "feature" ]
},
@ -2228,11 +2293,17 @@
"emitIf": "features.xcb",
"output": [ { "type": "varAssign", "name": "QMAKE_X11_PREFIX", "value": "tests.x11prefix.value" } ]
},
"angle": {
"description": "ANGLE",
"autoDetect": "features.opengles2 || features.opengl-dynamic",
"condition": "config.win32 && tests.directx",
"output": [ "publicQtConfig" ]
},
"opengles2": {
"description": "OpenGL ES 2.0",
"enable": "input.opengl == 'es2'",
"disable": "input.opengl == 'desktop' || input.opengl == 'no'",
"condition": "!features.opengl-desktop && libs.opengl_es2",
"disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'",
"condition": "config.win32 || (!features.opengl-desktop && libs.opengl_es2)",
"output": [
"publicQtConfig",
{ "type": "define", "name": "QT_OPENGL_ES" },
@ -2241,7 +2312,7 @@
},
"opengles3": {
"description": "OpenGL ES 3.0",
"condition": "features.opengles2 && tests.opengles3",
"condition": "features.opengles2 && !features.angle && tests.opengles3",
"output": [ { "type": "define", "name": "QT_OPENGL_ES_3" } ]
},
"opengles31": {
@ -2252,12 +2323,23 @@
"opengl-desktop": {
"description": "Desktop OpenGL",
"enable": "input.opengl == 'desktop'",
"disable": "input.opengl == 'es2' || input.opengl == 'no'",
"condition": "libs.opengl"
"disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'",
"condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
|| (!config.win32 && libs.opengl)"
},
"opengl-dynamic": {
"description": "Dynamic OpenGL",
"enable": "input.opengl == 'dynamic'",
"autoDetect": false,
"condition": "config.win32 && !config.winrt",
"output": [
{ "type": "feature", "name": "dynamicgl" },
{ "type": "define", "name": "QT_OPENGL_DYNAMIC" }
]
},
"opengl": {
"description": "OpenGL",
"condition": "features.opengl-desktop || features.opengles2",
"condition": "features.opengl-desktop || features.opengl-dynamic || features.opengles2",
"output": [ "feature" ]
},
"db2": {
@ -2364,6 +2446,12 @@
"condition": "features.directwrite && tests.directwrite2",
"output": [ "publicQtConfig" ]
},
"direct2d": {
"description": "Direct 2D",
"autoDetect": false,
"condition": "tests.direct2d",
"output": [ "publicQtConfig" ]
},
"sessionmanager": {
"description": "Session Management",
"output": [ "feature" ]
@ -2376,6 +2464,32 @@
"description": "Compile examples",
"output": [ "privateConfig" ]
},
"incredibuild_xge": {
"description": "IncrediBuild",
"emitIf": "var.QMAKE_HOST.os == 'Windows'",
"condition": "tests.incredibuild_xge",
"output": [ "publicConfig" ]
},
"msvc_mp": {
"description": "Use multiple processors when compiling with MSVC",
"emitIf": "config.msvc",
"autoDetect": "false",
"output": [ "privateConfig" ]
},
"static_runtime": {
"description": "Statically link the C/C++ runtime library",
"emitIf": "config.win32",
"autoDetect": false,
"condition": "!features.shared",
"output": [ "publicConfig", "publicQtConfig" ]
},
"wmf-backend": {
"description": "Windows Media Foundation backend for Qt Multimedia",
"emitIf": "config.win32",
"autoDetect": false,
"condition": "tests.wmf",
"output": [ "publicQtConfig" ]
},
"qpa_default_platform": {
"description": "QPA default platform",
"condition": "features.gui",
@ -2442,6 +2556,13 @@ or are able to read the logged output from journald, syslog or slog2."
"condition": "features.release_tools && (!features.debug || features.debug_and_release)",
"message": "-optimized-tools is not useful in -release mode."
},
{
"type": "warning",
"condition": "config.win32 && !config.msvc && features.oci",
"message": "Qt does not support compiling the Oracle database driver with
MinGW, due to lack of such support from Oracle. Consider disabling the
Oracle driver, as the current build will most likely fail."
},
{
"type": "warning",
"condition": "features.gui && config.linux && !features.xcb && !features.eglfs && !features.directfb && !features.linuxfb && !features.mirclient",
@ -2465,7 +2586,7 @@ XKB configuration data. This is required for keyboard input support."
{
"type": "note",
"condition": "features.openssl-linked && libs.openssl.source != 0
&& input.openssl.prefix == '' && input.openssl.libs == ''",
&& input.openssl.prefix == '' && input.openssl.libs == '' && input.openssl.libs.debug == ''",
"message": "When linking against OpenSSL, you can override the default
library names through OPENSSL_LIBS.
For example:
@ -2481,6 +2602,13 @@ For example:
"condition": "!features.accessibility",
"message": "Accessibility disabled. This configuration of Qt is unsupported."
},
{
"type": "warning",
"condition": "config.win32 && (features.opengles2 || features.opengl-dynamic) && !features.angle",
"message": "Using OpenGL ES 2.0 on Windows without ANGLE.
The build will most likely fail.
Specify -opengl desktop to use regular OpenGL."
},
{
"type": "note",
"condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge",
@ -2493,7 +2621,7 @@ For example:
},
{
"type": "error",
"condition": "features.gui && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2",
"condition": "features.gui && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2 && !features.opengl-dynamic",
"message": "The OpenGL functionality tests failed!
You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform."
@ -2662,8 +2790,18 @@ Please apply the patch corresponding to your Standard Library vendor, found in
{
"section": "OpenGL",
"entries": [
{
"type": "feature",
"args": "angle",
"condition": "config.win32"
},
"egl",
"opengl-desktop",
{
"type": "feature",
"args": "opengl-dynamic",
"condition": "config.win32"
},
"opengles2",
"opengles3",
"opengles31"

View File

@ -10,6 +10,9 @@ defineTest(qtConfCommandline_qmakeArgs) {
}
defineTest(qtConfCommandline_cxxstd) {
msvc: \
qtConfAddError("Command line option -c++std is not supported with MSVC compilers.")
arg = $${1}
val = $${2}
isEmpty(val): val = $$qtConfGetNextCommandlineArg()
@ -372,6 +375,33 @@ defineTest(qtConfLibrary_sybaseEnv) {
return(true)
}
# Check for Direct X SDK (include, lib, and direct shader compiler 'fxc').
# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
# the Windows SDK. Checking for the header is not sufficient, since it
# is also present in MinGW.
defineTest(qtConfTest_directX) {
dxdir = $$getenv("DXSDK_DIR")
!isEmpty(dxdir) {
EXTRA_INCLUDEPATH += $$dxdir/include
arch = $$qtConfEvaluate("tests.architecture.arch")
equals(arch, x86_64): \
EXTRA_LIBDIR += $$dxdir/lib/x64
else: \
EXTRA_LIBDIR += $$dxdir/lib/x86
EXTRA_PATH += $$dxdir/Utilities/bin/x86
}
$$qtConfEvaluate("features.sse2") {
ky = $$size($${1}.files._KEYS_)
$${1}.files._KEYS_ += $$ky
# Not present on MinGW-32
$${1}.files.$${ky} = "intrin.h"
}
qtConfTest_files($${1}): return(true)
return(false)
}
defineTest(qtConfTest_xkbConfigRoot) {
qtConfTest_getPkgConfigVariable($${1}): return(true)
@ -390,6 +420,7 @@ defineTest(qtConfTest_qpaDefaultPlatform) {
name =
!isEmpty(config.input.qpa_default_platform): name = $$config.input.qpa_default_platform
else: !isEmpty(QT_QPA_DEFAULT_PLATFORM): name = $$QT_QPA_DEFAULT_PLATFORM
else: winrt: name = winrt
else: win32: name = windows
else: android: name = android
else: osx: name = cocoa

View File

@ -312,7 +312,7 @@ defineReplace(qtConfFindInPathList) {
defineReplace(qtConfFindInPath) {
ensurePathEnv()
return($$qtConfFindInPathList($$1, $$QMAKE_PATH_ENV))
return($$qtConfFindInPathList($$1, $$2 $$QMAKE_PATH_ENV))
}
defineReplace(qtConfPkgConfigEnv) {
@ -694,7 +694,7 @@ defineTest(qtConfTest_files) {
file = $$qtConfFindInPathList($$f, $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS)
} else {
# assume we're looking for an executable
file = $$qtConfFindInPath($$f)
file = $$qtConfFindInPath($$f, $$EXTRA_PATH)
}
isEmpty(file) {
qtLog(" Not found.");

File diff suppressed because it is too large Load Diff

View File

@ -44,76 +44,32 @@ public:
void parseCmdLine();
QString defaultTo(const QString &option);
bool checkAvailability(const QString &part);
void generateQConfigCpp();
void buildQmake();
void autoDetection();
bool verifyConfiguration();
void generateOutputVars();
void prepareConfigureInput();
void configure();
void generateHeaders();
void generateCachefile();
void displayConfig();
void generateMakefiles();
void generateConfigfiles();
void detectArch();
void generateQConfigPri();
void generateQDevicePri();
void prepareConfigTests();
void showSummary();
bool showLicense(QString licenseFile);
void readLicense();
QString addDefine(QString def);
bool isDone();
bool isOk();
int platform() const;
QString platformName() const;
QString qpaPlatformName() const;
private:
bool checkAngleAvailability(QString *errorMessage = 0) const;
QString checkAvx512Availability();
int verbose;
// Our variable dictionaries
QMap<QString,QString> dictionary;
QStringList allBuildParts;
QStringList defaultBuildParts;
QStringList buildParts;
QStringList nobuildParts;
QStringList skipModules;
QStringList disabledModules;
QStringList enabledModules;
QStringList modules;
QStringList configCmdLine;
QStringList qmakeConfig;
QStringList qtConfig;
QStringList qmakeSql;
QStringList qmakeStyles;
QStringList qmakeVars;
QStringList qmakeDefines;
QStringList qmakeIncludes;
QStringList qmakeLibs;
QString opensslLibs;
QString opensslLibsDebug;
QString opensslLibsRelease;
QString opensslPath;
QString dbusPath;
QString dbusHostPath;
QString mysqlPath;
QString psqlLibs;
QString zlibLibs;
QString sybase;
QString sybaseLibs;
QString outputLine;
@ -132,19 +88,10 @@ private:
void addConfStr(int group, const QString &val);
QString formatPath(const QString &path);
QString formatPaths(const QStringList &paths);
QString locateFile(const QString &fileName) const;
bool findFile(const QString &fileName) const { return !locateFile(fileName).isEmpty(); }
static QString findFileInPaths(const QString &fileName, const QStringList &paths);
void reloadCmdLine(int idx);
void saveCmdLine();
void addSysroot(QString *command);
bool tryCompileProject(const QString &projectPath, const QString &extraOptions = QString(),
bool distClean = true);
bool compilerSupportsFlag(const QString &compilerAndArgs);
void applySpecSpecifics();
QString formatConfigPath(const char *var);

View File

@ -118,35 +118,6 @@ QString Environment::detectQMakeSpec()
return spec;
}
Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec)
{
if (qmakeSpec == QLatin1String("win32-msvc2015"))
return CC_MSVC2015;
if (qmakeSpec == QLatin1String("win32-msvc2013"))
return CC_MSVC2013;
if (qmakeSpec == QLatin1String("win32-msvc2012"))
return CC_MSVC2012;
if (qmakeSpec == QLatin1String("win32-icc"))
return CC_INTEL;
if (qmakeSpec == QLatin1String("win32-g++"))
return CC_MINGW;
if (qmakeSpec == QLatin1String("win32-borland"))
return CC_BORLAND;
return CC_UNKNOWN;
}
QString Environment::gccVersion()
{
CompilerInfo *info = compilerInfo(CC_MINGW);
int returnValue = 0;
QString version = execute(QStringLiteral("%1 -dumpversion").arg(info->executable), &returnValue);
if (returnValue != 0) {
cout << "Could not get mingw version" << returnValue << qPrintable(version);
version.resize(0);
}
return version;
}
/*!
Returns the enum of the compiler which was detected on the system.
The compilers are detected in the order as entered into the
@ -431,126 +402,4 @@ QString Environment::execute(const QString &command, int *returnCode)
return output;
}
static QStringList splitPathList(const QString &path)
{
#if defined(Q_OS_WIN)
QRegExp splitReg(QStringLiteral("[;,]"));
#else
QRegExp splitReg(QStringLiteral("[:]"));
#endif
QStringList result = path.split(splitReg, QString::SkipEmptyParts);
const QStringList::iterator end = result.end();
for (QStringList::iterator it = result.begin(); it != end; ++it) {
// Remove any leading or trailing ", this is commonly used in the environment
// variables
if (it->startsWith('"'))
it->remove(0, 1);
if (it->endsWith('"'))
it->chop(1);
*it = QDir::cleanPath(*it);
if (it->endsWith(QLatin1Char('/')))
it->chop(1);
}
return result;
}
QString Environment::findFileInPaths(const QString &fileName, const QStringList &paths)
{
if (!paths.isEmpty()) {
QDir d;
const QChar separator = QDir::separator();
foreach (const QString &path, paths)
if (d.exists(path + separator + fileName))
return path;
}
return QString();
}
QStringList Environment::path()
{
return splitPathList(QString::fromLocal8Bit(qgetenv("PATH")));
}
static QStringList mingwPaths(const QString &mingwPath, const QString &pathName)
{
QStringList ret;
QDir mingwDir(mingwPath);
const QFileInfoList subdirs = mingwDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i = 0 ;i < subdirs.length(); ++i) {
const QFileInfo &fi = subdirs.at(i);
const QString name = fi.fileName();
if (name == pathName)
ret += fi.absoluteFilePath();
else if (name.contains(QLatin1String("mingw"))) {
ret += fi.absoluteFilePath() + QLatin1Char('/') + pathName;
}
}
return ret;
}
// Return MinGW location from "c:\mingw\bin" -> "c:\mingw"
static inline QString detectMinGW()
{
const QString gcc = QStandardPaths::findExecutable(QLatin1String("g++.exe"));
return gcc.isEmpty() ?
gcc : QFileInfo(QFileInfo(gcc).absolutePath()).absolutePath();
}
// Detect Direct X SDK up tp June 2010. Included in Windows Kit 8.
QString Environment::detectDirectXSdk()
{
const QByteArray directXSdkEnv = qgetenv("DXSDK_DIR");
if (directXSdkEnv.isEmpty())
return QString();
QString directXSdk = QDir::cleanPath(QString::fromLocal8Bit(directXSdkEnv));
if (directXSdk.endsWith(QLatin1Char('/')))
directXSdk.truncate(directXSdk.size() - 1);
return directXSdk;
}
QStringList Environment::headerPaths(Compiler compiler)
{
QStringList headerPaths;
if (compiler == CC_MINGW) {
const QString mingwPath = detectMinGW();
headerPaths = mingwPaths(mingwPath, QLatin1String("include"));
// Additional compiler paths
const QFileInfoList mingwConfigs = QDir(mingwPath + QLatin1String("/lib/gcc")).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i = 0; i < mingwConfigs.length(); ++i) {
const QDir mingwLibDir = mingwConfigs.at(i).absoluteFilePath();
foreach (const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
headerPaths += version.absoluteFilePath() + QLatin1String("/include");
}
} else {
headerPaths = splitPathList(QString::fromLocal8Bit(getenv("INCLUDE")));
}
// Add Direct X SDK for ANGLE
const QString directXSdk = detectDirectXSdk();
if (!directXSdk.isEmpty()) // Add Direct X SDK for ANGLE
headerPaths += directXSdk + QLatin1String("/include");
return headerPaths;
}
QStringList Environment::libraryPaths(Compiler compiler)
{
QStringList libraryPaths;
if (compiler == CC_MINGW) {
libraryPaths = mingwPaths(detectMinGW(), "lib");
} else {
libraryPaths = splitPathList(QString::fromLocal8Bit(qgetenv("LIB")));
}
// Add Direct X SDK for ANGLE
const QString directXSdk = detectDirectXSdk();
if (!directXSdk.isEmpty()) {
#ifdef Q_OS_WIN64
libraryPaths += directXSdk + QLatin1String("/lib/x64");
#else
libraryPaths += directXSdk + QLatin1String("/lib/x86");
#endif
}
return libraryPaths;
}
QT_END_NAMESPACE

View File

@ -50,19 +50,10 @@ class Environment
public:
static Compiler detectCompiler();
static QString detectQMakeSpec();
static Compiler compilerFromQMakeSpec(const QString &qmakeSpec);
static QString gccVersion();
static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
static QString execute(const QString &command, int *returnCode = 0);
static QString findFileInPaths(const QString &fileName, const QStringList &paths);
static QStringList path();
static QString detectDirectXSdk();
static QStringList headerPaths(Compiler compiler);
static QStringList libraryPaths(Compiler compiler);
private:
static Compiler detectedCompiler;

View File

@ -75,29 +75,12 @@ int runConfigure( int argc, char** argv )
if (!app.isOk())
return 3;
// Auto-detect modules and settings.
app.autoDetection();
// After reading all command-line arguments, and doing all the
// auto-detection, it's time to do some last minute validation.
// If the validation fails, we cannot continue.
if (!app.verifyConfiguration())
// run qmake based configure
app.configure();
if (!app.isOk())
return 3;
app.generateOutputVars();
if( !app.isDone() )
app.generateCachefile();
if( !app.isDone() )
app.generateConfigfiles();
if (!app.isDone())
app.generateQConfigPri();
if (!app.isDone())
app.displayConfig();
if( !app.isDone() )
app.generateMakefiles();
if( !app.isDone() )
app.showSummary();
app.generateMakefiles();
if( !app.isOk() )
return 2;