From 97b856b78859861f16304debad29889f691d9eb7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 14 Aug 2016 09:48:55 +0200 Subject: [PATCH] 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 Change-Id: Ia1941f2c34b7f5bd4990a7673cd737361381c2e7 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- config_help.txt | 1 - configure.json | 182 +- configure.pri | 31 + mkspecs/features/qt_configure.prf | 4 +- tools/configure/configureapp.cpp | 2608 +---------------------------- tools/configure/configureapp.h | 59 +- tools/configure/environment.cpp | 151 -- tools/configure/environment.h | 9 - tools/configure/main.cpp | 25 +- 9 files changed, 257 insertions(+), 2813 deletions(-) diff --git a/config_help.txt b/config_help.txt index 9cd70672b09..fa18bf39641 100644 --- a/config_help.txt +++ b/config_help.txt @@ -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 ...... The deployment directory, as seen on the target device. diff --git a/configure.json b/configure.json index 2b56279b278..5874d8abaaf 100644 --- a/configure.json +++ b/configure.json @@ -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" diff --git a/configure.pri b/configure.pri index 0e785349d71..4b98335dd7c 100644 --- a/configure.pri +++ b/configure.pri @@ -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 diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index c87c65289e7..5a3f8410a26 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -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."); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 059d2b15e77..83807cef2b1 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -76,7 +76,7 @@ static inline void promptKeyPress() exit(0); // Exit cleanly for Ctrl+C } -Configure::Configure(int& argc, char** argv) : verbose(0) +Configure::Configure(int& argc, char** argv) { // Default values for indentation optionIndent = 4; @@ -117,11 +117,9 @@ Configure::Configure(int& argc, char** argv) : verbose(0) QDir(buildPath).mkpath("bin"); buildDir.mkpath("mkspecs"); + buildDir.mkpath("config.tests"); } - defaultBuildParts << QStringLiteral("libs") << QStringLiteral("tools") << QStringLiteral("examples"); - allBuildParts = defaultBuildParts; - allBuildParts << QStringLiteral("tests"); dictionary[ "QT_INSTALL_PREFIX" ] = installPath; dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC"); @@ -132,50 +130,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "QMAKESPEC_FROM" ] = "env"; } - dictionary[ "WIDGETS" ] = "yes"; - dictionary[ "GUI" ] = "yes"; - dictionary[ "RTTI" ] = "yes"; - dictionary[ "STRIP" ] = "yes"; - dictionary[ "PCH" ] = "yes"; - dictionary[ "SEPARATE_DEBUG_INFO" ] = "no"; - dictionary[ "SSE2" ] = "auto"; - dictionary[ "SSE3" ] = "auto"; - dictionary[ "SSSE3" ] = "auto"; - dictionary[ "SSE4_1" ] = "auto"; - dictionary[ "SSE4_2" ] = "auto"; - dictionary[ "AVX" ] = "auto"; - dictionary[ "AVX2" ] = "auto"; - dictionary[ "AVX512" ] = "auto"; dictionary[ "SYNCQT" ] = "auto"; - dictionary[ "WMF_BACKEND" ] = "no"; - dictionary[ "QML_DEBUG" ] = "yes"; - dictionary[ "PLUGIN_MANIFESTS" ] = "no"; - dictionary[ "DIRECTWRITE" ] = "auto"; - dictionary[ "DIRECTWRITE2" ] = "auto"; - dictionary[ "DIRECT2D" ] = "no"; - dictionary[ "NIS" ] = "no"; - dictionary[ "NEON" ] = "auto"; - dictionary[ "LARGE_FILE" ] = "yes"; - dictionary[ "FONT_CONFIG" ] = "no"; - dictionary[ "POSIX_IPC" ] = "no"; - dictionary[ "QT_GLIB" ] = "no"; - dictionary[ "QT_ICONV" ] = "auto"; - dictionary[ "QT_EVDEV" ] = "auto"; - dictionary[ "QT_MTDEV" ] = "auto"; - dictionary[ "QT_TSLIB" ] = "auto"; - dictionary[ "QT_INOTIFY" ] = "auto"; - dictionary[ "QT_EVENTFD" ] = "auto"; - dictionary[ "QT_CUPS" ] = "auto"; - dictionary[ "CFG_GCC_SYSROOT" ] = "yes"; - dictionary[ "SLOG2" ] = "no"; - dictionary[ "QNX_IMF" ] = "no"; - dictionary[ "PPS" ] = "no"; - dictionary[ "LGMON" ] = "no"; - dictionary[ "SYSTEM_PROXIES" ] = "yes"; - dictionary[ "SCTP" ] = "no"; - dictionary[ "WERROR" ] = "auto"; - dictionary[ "QREAL" ] = "double"; - dictionary[ "ATOMIC64" ] = "auto"; //Only used when cross compiling. dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg"; @@ -210,70 +165,8 @@ Configure::Configure(int& argc, char** argv) : verbose(0) dictionary[ "REDO" ] = "no"; - dictionary[ "BUILD" ] = "debug"; - dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly - dictionary[ "FORCEDEBUGINFO" ] = "no"; - dictionary[ "RELEASE_TOOLS" ] = "no"; - dictionary[ "BUILDTYPE" ] = "none"; - dictionary[ "BUILDDEV" ] = "no"; - - dictionary[ "COMPILE_EXAMPLES" ] = "yes"; - - dictionary[ "C++STD" ] = "auto"; - - dictionary[ "USE_GOLD_LINKER" ] = "no"; - - dictionary[ "ENABLE_NEW_DTAGS" ] = "no"; - - dictionary[ "SHARED" ] = "yes"; - - dictionary[ "STATIC_RUNTIME" ] = "no"; - - dictionary[ "SYSTEM_ZLIB" ] = "auto"; - - dictionary[ "PCRE" ] = "auto"; - - dictionary[ "ICU" ] = "no"; - - dictionary[ "ANGLE" ] = "auto"; - dictionary[ "DYNAMICGL" ] = "no"; - - dictionary[ "GIF" ] = "yes"; - dictionary[ "JPEG" ] = "yes"; - dictionary[ "PNG" ] = "yes"; - dictionary[ "LIBJPEG" ] = "auto"; - dictionary[ "LIBPNG" ] = "auto"; - dictionary[ "DOUBLECONVERSION" ] = "auto"; - dictionary[ "FREETYPE" ] = "yes"; - dictionary[ "FREETYPE_FROM" ] = "default"; - dictionary[ "HARFBUZZ" ] = "qt"; - - dictionary[ "ACCESSIBILITY" ] = "yes"; - dictionary[ "OPENGL" ] = "yes"; - dictionary[ "OPENGL_ES_2" ] = "yes"; - dictionary[ "SSL" ] = "auto"; - dictionary[ "OPENSSL" ] = "auto"; - dictionary[ "LIBPROXY" ] = "no"; - dictionary[ "DBUS" ] = "auto"; - - dictionary[ "STYLE_WINDOWS" ] = "yes"; - dictionary[ "STYLE_WINDOWSXP" ] = "auto"; - dictionary[ "STYLE_WINDOWSVISTA" ] = "auto"; - dictionary[ "STYLE_FUSION" ] = "yes"; - - dictionary[ "SQL_MYSQL" ] = "no"; - dictionary[ "SQL_ODBC" ] = "no"; - dictionary[ "SQL_OCI" ] = "no"; - dictionary[ "SQL_PSQL" ] = "no"; - dictionary[ "SQL_TDS" ] = "no"; - dictionary[ "SQL_DB2" ] = "no"; - dictionary[ "SQL_SQLITE" ] = "auto"; - dictionary[ "SQL_SQLITE_LIB" ] = "qt"; - dictionary[ "SQL_SQLITE2" ] = "no"; - dictionary[ "SQL_IBASE" ] = "no"; - QString tmp = dictionary[ "QMAKESPEC" ]; if (tmp.contains("\\")) { tmp = tmp.mid(tmp.lastIndexOf("\\") + 1); @@ -281,18 +174,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0) tmp = tmp.mid(tmp.lastIndexOf("/") + 1); } dictionary[ "QMAKESPEC" ] = tmp; - - dictionary[ "INCREDIBUILD_XGE" ] = "auto"; - dictionary[ "LTCG" ] = "no"; - dictionary[ "MSVC_MP" ] = "no"; - - if (dictionary["QMAKESPEC"].startsWith("win32-g++")) { - const QString zero = QStringLiteral("0"); - const QStringList parts = Environment::gccVersion().split(QLatin1Char('.')); - dictionary["QT_GCC_MAJOR_VERSION"] = parts.value(0, zero); - dictionary["QT_GCC_MINOR_VERSION"] = parts.value(1, zero); - dictionary["QT_GCC_PATCH_VERSION"] = parts.value(2, zero); - } } Configure::~Configure() @@ -310,17 +191,6 @@ QString Configure::formatPath(const QString &path) return ret; } -QString Configure::formatPaths(const QStringList &paths) -{ - QString ret; - foreach (const QString &path, paths) { - if (!ret.isEmpty()) - ret += QLatin1Char(' '); - ret += formatPath(path); - } - return ret; -} - // #### somehow I get a compiler error about vc++ reaching the nesting limit without // undefining the ansi for scoping. #ifdef for @@ -364,111 +234,12 @@ void Configure::parseCmdLine() } for (; i::iterator i = dictionary.begin(); i != dictionary.end(); ++i) { - if (i.value() == "auto") - i.value() = defaultTo(i.key()); - } - - cout << "Done running configuration tests." << endl; -} - -bool Configure::verifyConfiguration() -{ - bool prompt = false; - if (dictionary["C++STD"] != "auto" - && dictionary["QMAKESPEC"].contains("msvc")) { - cout << "WARNING: It is not possible to change the C++ standard edition with MSVC compilers. " - "Therefore, the option -c++std " << dictionary["C++STD"] << " was ignored." << endl << endl; - dictionary["C++STD"] = "auto"; - } - - if (dictionary["STATIC_RUNTIME"] == "yes" && dictionary["SHARED"] == "yes") { - cout << "ERROR: -static-runtime requires -static" << endl << endl; - dictionary[ "DONE" ] = "error"; - } - - if (dictionary["SEPARATE_DEBUG_INFO"] == "yes") { - if (dictionary[ "SHARED" ] == "no") { - cout << "ERROR: -separate-debug-info is incompatible with -static" << endl << endl; - dictionary[ "DONE" ] = "error"; - } else if (dictionary[ "BUILD" ] != "debug" - && dictionary[ "BUILDALL" ] == "no" - && dictionary[ "FORCEDEBUGINFO" ] == "no") { - cout << "ERROR: -separate-debug-info needs -debug, -debug-and-release, or -force-debug-info" << endl << endl; - dictionary[ "DONE" ] = "error"; - } else if (dictionary["SEPARATE_DEBUG_INFO"] == "yes" && !checkAvailability("OBJCOPY")) { - cout << "ERROR: -separate-debug-info was requested but this binutils does not support it." << endl; - dictionary[ "DONE" ] = "error"; - } - } - - if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") { - cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl - << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl; - dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue - prompt = true; - } - if (dictionary["QMAKESPEC"].endsWith("-g++") - && dictionary["SQL_OCI"] != "no") { - cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl - << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl - << "Oracle driver, as the current build will most likely fail." << endl; - prompt = true; - } - if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) { - cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl - << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl - << "files such as headers and libraries." << endl; - prompt = true; - } - - if (dictionary["DIRECT2D"] == "yes" && !checkAvailability("DIRECT2D")) { - cout << "WARNING: To be able to build the Direct2D platform plugin you will" << endl - << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl - << "files such as headers and libraries." << endl; - prompt = true; - } - - if (dictionary["ANGLE"] == "no") { - if (dictionary["ANGLE_FROM"] == "detected") { - QString errorMessage = dictionary["ANGLE_ERR"]; - cout << "WARNING: The DirectX SDK could not be detected:" << endl - << " " << qPrintable(errorMessage) << endl - << "Disabling the ANGLE backend." << endl; - prompt = true; - } - if (dictionary["OPENGL_ES_2"] == "yes" - && (platform() == WINDOWS || platform() == WINDOWS_RT)) { - cout << endl << "WARNING: Using OpenGL ES 2.0 without ANGLE." << endl - << "Specify -opengl desktop to use Open GL." << endl - << "The build will most likely fail." << endl; - prompt = true; - } - } else if (dictionary["ANGLE_FROM"] == "commandline") { - QString errorMessage; - if (!checkAngleAvailability(&errorMessage)) { - cout << "WARNING: ANGLE specified, but the DirectX SDK could not be detected:" << endl - << " " << qPrintable(errorMessage) << endl - << "The build will most likely fail." << endl; - } - } - - if (dictionary["OPENGL"] == "no" || dictionary["OPENGL_ES_2"] == "no") { - if (dictionary.value("XQMAKESPEC").startsWith("winphone") || - dictionary.value("XQMAKESPEC").startsWith("winrt")) { - cout << "ERROR: Only '-opengl es2' is valid for WinRT." << endl; - dictionary[ "DONE" ] = "error"; - } - } - - if ((dictionary["FONT_CONFIG"] == "yes") && (dictionary["FREETYPE_FROM"] == "commandline")) { - if (dictionary["FREETYPE"] == "yes") { - cout << "WARNING: Bundled FreeType can't be used." - " FontConfig use requires system FreeType." << endl; - dictionary["FREETYPE"] = "system"; - dictionary["FREETYPE_FROM"] = "override"; - prompt = true; - } else if (dictionary["FREETYPE"] == "no") { - cout << "WARNING: FreeType can't be disabled." - " FontConfig use requires system FreeType." << endl; - dictionary["FREETYPE"] = "system"; - dictionary["FREETYPE_FROM"] = "override"; - prompt = true; - } - } - - if (prompt) - promptKeyPress(); - - return true; } void Configure::prepareConfigTests() @@ -2001,650 +574,6 @@ void Configure::prepareConfigTests() } } -void Configure::generateOutputVars() -{ - // Generate variables for output - QString build = dictionary[ "BUILD" ]; - bool buildAll = (dictionary[ "BUILDALL" ] == "yes"); - if (build == "debug") { - if (buildAll) - qtConfig += "debug_and_release build_all release"; - qtConfig += "debug"; - } else if (build == "release") { - if (buildAll) - qtConfig += "debug_and_release build_all debug"; - qtConfig += "release"; - } - if (dictionary[ "RELEASE_TOOLS" ] == "yes") - qtConfig += "release_tools"; - - if (dictionary[ "PCH" ] == "yes") - qmakeConfig += "precompile_header"; - else - qmakeVars += "CONFIG -= precompile_header"; - - if (dictionary[ "C++STD" ] == "c++11") - qtConfig += "c++11"; - else if (dictionary[ "C++STD" ] == "c++14") - qtConfig += "c++11 c++14"; - else if (dictionary[ "C++STD" ] == "c++1z") - qtConfig += "c++11 c++14 c++1z"; - - if (dictionary[ "USE_GOLD_LINKER" ] == "yes") - qmakeConfig += "use_gold_linker"; - - if (dictionary[ "ENABLE_NEW_DTAGS" ] == "yes") - qmakeConfig += "enable_new_dtags"; - - if (dictionary[ "SHARED" ] == "no") - qtConfig += "static"; - else - qtConfig += "shared"; - - if (dictionary[ "STATIC_RUNTIME" ] == "yes") - qtConfig += "static_runtime"; - - if (dictionary[ "GUI" ] == "no") { - qtConfig += "no-gui"; - dictionary [ "WIDGETS" ] = "no"; - } - - if (dictionary[ "WIDGETS" ] == "no") - qtConfig += "no-widgets"; - - // Compression -------------------------------------------------- - if (dictionary[ "SYSTEM_ZLIB" ] == "yes") - qtConfig += "system-zlib"; - - // PCRE --------------------------------------------------------- - if (dictionary[ "PCRE" ] == "qt") - qmakeConfig += "pcre"; - - // ICU --------------------------------------------------------- - if (dictionary[ "ICU" ] == "yes") - qtConfig += "icu"; - - // ANGLE -------------------------------------------------------- - if (dictionary[ "ANGLE" ] != "no") { - qtConfig += "angle"; - } - - // Dynamic OpenGL loading --------------------------------------- - if (dictionary[ "DYNAMICGL" ] != "no") { - qtConfig += "dynamicgl"; - } - - // Image formates ----------------------------------------------- - if (dictionary[ "GIF" ] == "yes") - qtConfig += "gif"; - - if (dictionary[ "JPEG" ] == "yes") - qtConfig += "jpeg"; - if (dictionary[ "LIBJPEG" ] == "system") - qtConfig += "system-jpeg"; - - if (dictionary[ "PNG" ] == "yes") - qtConfig += "png"; - if (dictionary[ "LIBPNG" ] == "system") - qtConfig += "system-png"; - - // Double conversion ----------------------------------------------- - if (dictionary[ "DOUBLECONVERSION" ] != "no") - qtConfig += "doubleconversion"; - if (dictionary[ "DOUBLECONVERSION" ] == "system") - qtConfig += "system-doubleconversion"; - - // Text rendering -------------------------------------------------- - if (dictionary[ "FREETYPE" ] != "no") - qtConfig += "freetype"; - if (dictionary[ "FREETYPE" ] == "system") - qtConfig += "system-freetype"; - - if (dictionary[ "HARFBUZZ" ] != "no") - qtConfig += "harfbuzz"; - if (dictionary[ "HARFBUZZ" ] == "system") - qtConfig += "system-harfbuzz"; - - // Styles ------------------------------------------------------- - if (dictionary[ "STYLE_WINDOWS" ] == "yes") - qmakeStyles += "windows"; - - if (dictionary[ "STYLE_FUSION" ] == "yes") - qmakeStyles += "fusion"; - - if (dictionary[ "STYLE_WINDOWSXP" ] == "yes") - qmakeStyles += "windowsxp"; - - if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes") - qmakeStyles += "windowsvista"; - - if (dictionary[ "STYLE_ANDROID" ] == "yes") - qmakeStyles += "android"; - - // Databases ---------------------------------------------------- - if (dictionary[ "SQL_MYSQL" ] == "yes") - qmakeSql += "mysql"; - if (dictionary[ "SQL_ODBC" ] == "yes") - qmakeSql += "odbc"; - if (dictionary[ "SQL_OCI" ] == "yes") - qmakeSql += "oci"; - if (dictionary[ "SQL_PSQL" ] == "yes") - qmakeSql += "psql"; - if (dictionary[ "SQL_TDS" ] == "yes") - qmakeSql += "tds"; - if (dictionary[ "SQL_DB2" ] == "yes") - qmakeSql += "db2"; - if (dictionary[ "SQL_SQLITE2" ] == "yes") - qmakeSql += "sqlite2"; - if (dictionary[ "SQL_IBASE" ] == "yes") - qmakeSql += "ibase"; - if (dictionary[ "SQL_SQLITE" ] == "yes") - qmakeSql += "sqlite"; - - if (dictionary[ "SQL_SQLITE_LIB" ] == "system") - qmakeConfig += "system-sqlite"; - - // Other options ------------------------------------------------ - if (dictionary[ "BUILDALL" ] == "yes") { - qtConfig += "build_all"; - } - if (dictionary[ "SEPARATE_DEBUG_INFO" ] == "yes") - qtConfig += "separate_debug_info"; - if (dictionary[ "FORCEDEBUGINFO" ] == "yes") - qmakeConfig += "force_debug_info"; - qmakeConfig += dictionary[ "BUILD" ]; - - if (buildParts.isEmpty()) { - buildParts = defaultBuildParts; - - if (dictionary["BUILDDEV"] == "yes") - buildParts += "tests"; - } - while (!nobuildParts.isEmpty()) - buildParts.removeAll(nobuildParts.takeFirst()); - if (!buildParts.contains("libs")) - buildParts += "libs"; - buildParts.removeDuplicates(); - if (dictionary[ "COMPILE_EXAMPLES" ] == "yes") - qmakeConfig += "compile_examples"; - - if (dictionary["MSVC_MP"] == "yes") - qmakeConfig += "msvc_mp"; - - if (dictionary["ATOMIC64"] == "libatomic") - qmakeConfig += "atomic64-libatomic"; - - if (dictionary[ "ACCESSIBILITY" ] == "yes") - qtConfig += "accessibility"; - - if (!qmakeLibs.isEmpty()) - qmakeVars += "EXTRA_LIBDIR += " + formatPaths(qmakeLibs); - - if (!dictionary["QMAKE_LIBS_SQLITE"].isEmpty()) - qmakeVars += "QMAKE_LIBS_SQLITE += " + dictionary["QMAKE_LIBS_SQLITE"]; - - if (dictionary[ "OPENGL" ] == "yes") - qtConfig += "opengl"; - - if (dictionary["OPENGL_ES_2"] == "yes") { - qtConfig += "opengles2"; - qtConfig += "egl"; - } - - if (dictionary[ "SSL" ] == "yes") - qtConfig += "ssl"; - - if (dictionary[ "OPENSSL" ] == "yes") - qtConfig += "openssl"; - else if (dictionary[ "OPENSSL" ] == "linked") - qtConfig += "openssl-linked"; - - if (dictionary[ "LIBPROXY" ] == "yes") - qtConfig += "libproxy"; - - if (dictionary[ "DBUS" ] == "runtime") - qtConfig += "dbus"; - else if (dictionary[ "DBUS" ] == "linked") - qtConfig += "dbus dbus-linked"; - - if (dictionary["QML_DEBUG"] == "no") - qtConfig += "no-qml-debug"; - - if (dictionary["WMF_BACKEND"] == "yes") - qtConfig += "wmf-backend"; - - if (dictionary["DIRECTWRITE"] == "yes") - qtConfig += "directwrite"; - - if (dictionary["DIRECTWRITE2"] == "yes") - qtConfig += "directwrite2"; - - if (dictionary["DIRECT2D"] == "yes") - qtConfig += "direct2d"; - - if (dictionary["NIS"] == "yes") - qtConfig += "nis"; - - if (dictionary["QT_CUPS"] == "yes") - qtConfig += "cups"; - - if (dictionary["QT_ICONV"] != "no") - qtConfig += "iconv"; - if (dictionary["QT_ICONV"] == "sun") - qtConfig += "sun-libiconv"; - else if (dictionary["QT_ICONV"] == "gnu") - qtConfig += "gnu-libiconv"; - - if (dictionary["QT_EVDEV"] == "yes") - qtConfig += "evdev"; - - if (dictionary["QT_MTDEV"] == "yes") - qtConfig += "mtdev"; - - if (dictionary[ "QT_TSLIB" ] == "yes") - qtConfig += "tslib"; - - if (dictionary["QT_INOTIFY"] == "yes") - qtConfig += "inotify"; - - if (dictionary["QT_EVENTFD"] == "yes") - qtConfig += "eventfd"; - - if (dictionary["FONT_CONFIG"] == "yes") { - qtConfig += "fontconfig"; - qmakeVars += "QMAKE_CFLAGS_FONTCONFIG ="; - qmakeVars += "QMAKE_LIBS_FONTCONFIG = -lfreetype -lfontconfig"; - } - - if (dictionary["QT_GLIB"] == "yes") - qtConfig += "glib"; - - if (dictionary["STACK_PROTECTOR_STRONG"] == "yes") - qtConfig += "stack-protector-strong"; - - if (dictionary["REDUCE_EXPORTS"] == "yes") - qtConfig += "reduce_exports"; - - if (!dictionary["POLL"].isEmpty()) - qtConfig += "poll_" + dictionary["POLL"]; - - // We currently have no switch for QtConcurrent, so add it unconditionally. - qtConfig += "concurrent"; - - if (dictionary[ "SYSTEM_PROXIES" ] == "yes") - qtConfig += "system-proxies"; - - if (dictionary[ "SCTP" ] == "yes") - qtConfig += "sctp"; - - if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"])) { - qmakeConfig += "cross_compile"; - dictionary["CROSS_COMPILE"] = "yes"; - } - - // Directories and settings for .qmake.cache -------------------- - - if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux")) - qtConfig += "rpath"; - - if (!qmakeDefines.isEmpty()) - qmakeVars += QString("EXTRA_DEFINES += ") + qmakeDefines.join(' '); - if (!qmakeIncludes.isEmpty()) - qmakeVars += QString("EXTRA_INCLUDEPATH += ") + formatPaths(qmakeIncludes); - if (!opensslLibs.isEmpty()) - qmakeVars += opensslLibs; - if (dictionary[ "OPENSSL" ] == "linked") { - if (!opensslLibsDebug.isEmpty() || !opensslLibsRelease.isEmpty()) { - if (opensslLibsDebug.isEmpty() || opensslLibsRelease.isEmpty()) { - cout << "Error: either both or none of OPENSSL_LIBS_DEBUG/_RELEASE must be defined." << endl; - exit(1); - } - qmakeVars += opensslLibsDebug; - qmakeVars += opensslLibsRelease; - } else if (opensslLibs.isEmpty()) { - qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32"); - } - if (!opensslPath.isEmpty()) { - qmakeVars += QString("OPENSSL_CFLAGS += -I%1/include").arg(opensslPath); - qmakeVars += QString("OPENSSL_LIBS += -L%1/lib").arg(opensslPath); - } - } - if (dictionary[ "DBUS" ] == "linked") { - if (!dbusPath.isEmpty()) { - qmakeVars += QString("QMAKE_CFLAGS_DBUS = -I%1/include").arg(dbusPath); - qmakeVars += QString("QMAKE_LIBS_DBUS = -L%1/lib").arg(dbusPath); - if (dbusHostPath.isEmpty()) - qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusPath); - } - if (!dbusHostPath.isEmpty()) - qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusHostPath); - } - if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty()) { - qmakeVars += QString("QMAKE_CFLAGS_MYSQL = -I%1/include").arg(mysqlPath); - qmakeVars += QString("QMAKE_LIBS_MYSQL = -L%1/lib").arg(mysqlPath); - } - if (!psqlLibs.isEmpty()) - qmakeVars += QString("QMAKE_LIBS_PSQL=") + psqlLibs.section("=", 1); - if (!zlibLibs.isEmpty()) - qmakeVars += zlibLibs; - - { - QStringList lflagsTDS; - if (!sybase.isEmpty()) - lflagsTDS += QString("-L") + formatPath(sybase.section("=", 1) + "/lib"); - if (!sybaseLibs.isEmpty()) - lflagsTDS += sybaseLibs.section("=", 1); - if (!lflagsTDS.isEmpty()) - qmakeVars += QString("QMAKE_LIBS_TDS=") + lflagsTDS.join(' '); - } - - if (!qmakeSql.isEmpty()) - qmakeVars += QString("sql-drivers += ") + qmakeSql.join(' '); - if (!qmakeStyles.isEmpty()) - qmakeVars += QString("styles += ") + qmakeStyles.join(' '); - - if (!dictionary[ "QMAKESPEC" ].length()) { - cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl - << "be defined as an environment variable, or specified as an" << endl - << "argument with -platform" << endl; - - QStringList winPlatforms; - QDir mkspecsDir(sourcePath + "/mkspecs"); - const QFileInfoList &specsList = mkspecsDir.entryInfoList(); - for (int i = 0; i < specsList.size(); ++i) { - const QFileInfo &fi = specsList.at(i); - if (fi.fileName().left(5) == "win32") { - winPlatforms += fi.fileName(); - } - } - cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl; - dictionary[ "DONE" ] = "error"; - } -} - -void Configure::generateCachefile() -{ - // Generate qmodule.pri, which is loaded only by Qt modules - { - FileWriter moduleStream(buildPath + "/mkspecs/qmodule.pri"); - - moduleStream << "QT_BUILD_PARTS += " << buildParts.join(' ') << endl; - if (!skipModules.isEmpty()) - moduleStream << "QT_SKIP_MODULES += " << skipModules.join(' ') << endl; - moduleStream << endl; - - moduleStream << "host_build {" << endl; - moduleStream << " QT_CPU_FEATURES." << dictionary["QT_HOST_ARCH"] << - " = " << dictionary["QT_HOST_CPU_FEATURES"] << endl; - moduleStream << "} else {" << endl; - moduleStream << " QT_CPU_FEATURES." << dictionary["QT_ARCH"] << - " = " << dictionary["QT_CPU_FEATURES"] << endl; - moduleStream << "}" << endl; - moduleStream << "QT_COORD_TYPE += " << dictionary["QREAL"] << endl; - - if (dictionary["QT_XKBCOMMON"] == "no") - moduleStream << "DEFINES += QT_NO_XKBCOMMON" << endl; - - moduleStream << "CONFIG += " << qmakeConfig.join(' '); - if (dictionary[ "SSE2" ] == "yes") - moduleStream << " sse2"; - if (dictionary[ "SSE3" ] == "yes") - moduleStream << " sse3"; - if (dictionary[ "SSSE3" ] == "yes") - moduleStream << " ssse3"; - if (dictionary[ "SSE4_1" ] == "yes") - moduleStream << " sse4_1"; - if (dictionary[ "SSE4_2" ] == "yes") - moduleStream << " sse4_2"; - if (dictionary[ "AVX" ] == "yes") - moduleStream << " avx"; - if (dictionary[ "AVX2" ] == "yes") - moduleStream << " avx2"; - if (!dictionary[ "AVX512" ].isEmpty()) - moduleStream << ' ' << dictionary[ "AVX512" ]; - if (dictionary[ "NEON" ] == "yes") - moduleStream << " neon"; - if (dictionary[ "LARGE_FILE" ] == "yes") - moduleStream << " largefile"; - if (dictionary[ "STRIP" ] == "no") - moduleStream << " nostrip"; - if (dictionary[ "LTCG" ] == "yes") - moduleStream << " ltcg"; - moduleStream << endl; - - for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var) - moduleStream << (*var) << endl; - - if (!moduleStream.flush()) - dictionary[ "DONE" ] = "error"; - } -} - -void Configure::addSysroot(QString *command) -{ - const QString &sysroot = dictionary["CFG_SYSROOT"]; - if (!sysroot.isEmpty() && dictionary["CFG_GCC_SYSROOT"] == "yes") { - command->append(" QMAKE_LFLAGS+=--sysroot=" + sysroot); - command->append(" QMAKE_CXXFLAGS+=--sysroot=" + sysroot); - } -} - -struct ArchData { - bool isHost; - const char *qmakespec; - const char *key; - const char *subarchKey; - const char *type; - ArchData() {} - ArchData(bool h, const char *t, const char *qm, const char *k, const char *sak) - : isHost(h), qmakespec(qm), key(k), subarchKey(sak), type(t) - {} -}; - -/* - Runs qmake on config.tests/arch/arch.pro, which will detect the target arch - for the compiler we are using -*/ -void Configure::detectArch() -{ - QString oldpwd = QDir::currentPath(); - - QString newpwd = QString("%1/config.tests/arch").arg(buildPath); - if (!QDir().exists(newpwd) && !QDir().mkpath(newpwd)) { - cout << "Failed to create directory " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl; - dictionary["DONE"] = "error"; - return; - } - if (!QDir::setCurrent(newpwd)) { - cout << "Failed to change working directory to " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl; - dictionary["DONE"] = "error"; - return; - } - - QVector qmakespecs; - if (dictionary.contains("XQMAKESPEC")) - qmakespecs << ArchData(false, "target", "XQMAKESPEC", "QT_ARCH", "QT_CPU_FEATURES"); - qmakespecs << ArchData(true, "host", "QMAKESPEC", "QT_HOST_ARCH", "QT_HOST_CPU_FEATURES"); - - for (int i = 0; i < qmakespecs.count(); ++i) { - const ArchData &data = qmakespecs.at(i); - QString qmakespec = dictionary.value(data.qmakespec); - QString key = data.key; - QString subarchKey = data.subarchKey; - - // run qmake - QString command = QString("%1 -spec %2 %3") - .arg(QDir::toNativeSeparators(QDir(newpwd).relativeFilePath(buildPath + "/bin/qmake.exe")), - QDir::toNativeSeparators(qmakespec), - QDir::toNativeSeparators(sourcePath + "/config.tests/arch/arch" - + (data.isHost ? "_host" : "") + ".pro")); - - if (!data.isHost) { - if (qmakespec.startsWith("winrt") || qmakespec.startsWith("winphone")) - command.append(" QMAKE_LFLAGS+=/ENTRY:main"); - addSysroot(&command); - } - - int returnValue = 0; - Environment::execute(command, &returnValue); - if (returnValue != 0) { - cout << "QMake failed!" << endl; - dictionary["DONE"] = "error"; - return; - } - - // compile - command = dictionary[ "MAKE" ]; - if (command.contains("nmake") || command.contains("jom")) - command += " /NOLOGO"; - command += " -s"; - Environment::execute(command); - - // find the executable that was generated - QString arch_exe; - if (qmakespec.startsWith("android")) { - arch_exe = "libarch.so"; - } else { - arch_exe = "arch.exe"; - } - QFile exe(arch_exe); - if (!exe.open(QFile::ReadOnly)) { // no Text, this is binary - exe.setFileName("arch"); - if (!exe.open(QFile::ReadOnly)) { - cout << "Could not find output file '" << qPrintable(arch_exe) << "' or 'arch' in " << qPrintable(newpwd) << " : " << qPrintable(exe.errorString()) << endl; - dictionary["DONE"] = "error"; - return; - } - } - QByteArray exeContents = exe.readAll(); - exe.close(); - - static const char archMagic[] = "==Qt=magic=Qt== Architecture:"; - int magicPos = exeContents.indexOf(archMagic); - if (magicPos == -1) { - cout << "Internal error, could not find the architecture of the " - << data.type << " executable" << endl; - dictionary["DONE"] = "error"; - return; - } - //cout << "Found magic at offset 0x" << hex << magicPos << endl; - - // the conversion from QByteArray will stop at the ending NUL anyway - QString arch = QString::fromLatin1(exeContents.constData() + magicPos - + sizeof(archMagic) - 1); - dictionary[key] = arch; - - static const char subarchMagic[] = "==Qt=magic=Qt== Sub-architecture:"; - magicPos = exeContents.indexOf(subarchMagic); - if (magicPos == -1) { - cout << "Internal error, could not find the sub-architecture of the " - << data.type << " executable" << endl; - dictionary["DONE"] = "error"; - return; - } - - QString subarch = QString::fromLatin1(exeContents.constData() + magicPos - + sizeof(subarchMagic) - 1); - dictionary[subarchKey] = subarch; - - //cout << "Detected arch '" << qPrintable(arch) << "'\n"; - //cout << "Detected sub-arch '" << qPrintable(subarch) << "'\n"; - - // clean up - Environment::execute(command + " distclean"); - } - - if (!dictionary.contains("QT_HOST_ARCH")) - dictionary["QT_HOST_ARCH"] = "unknown"; - if (!dictionary.contains("QT_ARCH")) { - dictionary["QT_ARCH"] = dictionary["QT_HOST_ARCH"]; - dictionary["QT_CPU_FEATURES"] = dictionary["QT_HOST_CPU_FEATURES"]; - } - - QDir::setCurrent(oldpwd); -} - -bool Configure::tryCompileProject(const QString &projectPath, const QString &extraOptions, - bool distClean) -{ - QString oldpwd = QDir::currentPath(); - - QString newpwd = QString("%1/config.tests/%2").arg(buildPath, projectPath); - if (!QDir().exists(newpwd) && !QDir().mkpath(newpwd)) { - cout << "Failed to create directory " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl; - dictionary["DONE"] = "error"; - return false; - } - if (!QDir::setCurrent(newpwd)) { - cout << "Failed to change working directory to " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl; - dictionary["DONE"] = "error"; - return false; - } - - // run qmake - QString command = QString("%1 %2 %3") - .arg(QDir::toNativeSeparators(QDir(newpwd).relativeFilePath(buildPath + "/bin/qmake.exe")), - QDir::toNativeSeparators(sourcePath + "/config.tests/" + projectPath), - extraOptions); - - if (dictionary.contains("XQMAKESPEC")) { - const QString qmakespec = dictionary["XQMAKESPEC"]; - if (qmakespec.startsWith("winrt") || qmakespec.startsWith("winphone")) - command.append(" QMAKE_LFLAGS+=/ENTRY:main"); - addSysroot(&command); - } - - if (verbose) - cout << qPrintable(command) << endl; - else - command += " 2>&1"; - - int code = 0; - QString output = Environment::execute(command, &code); - //cout << output << endl; - - if (code == 0) { - // compile - command = dictionary[ "MAKE" ]; - if (command.contains("nmake") || command.contains("jom")) - command += " /NOLOGO"; - if (verbose) - cout << qPrintable(command) << endl; - else - command += " -s 2>&1"; - output = Environment::execute(command, &code); - //cout << output << endl; - - // clean up - if (distClean) - Environment::execute(command + " distclean 2>&1"); - } - - QDir::setCurrent(oldpwd); - return code == 0; -} - -bool Configure::compilerSupportsFlag(const QString &compilerAndArgs) -{ - QFile file("conftest.cpp"); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - cout << "could not open temp file for writing" << endl; - return false; - } - if (!file.write("int main() { return 0; }\r\n")) { - cout << "could not write to temp file" << endl; - return false; - } - file.close(); - // compilerAndArgs contains compiler because there is no way to query it - QString command = compilerAndArgs + " -o conftest-out.o conftest.cpp"; - int code = 0; - QString output = Environment::execute(command, &code); - file.remove(); - QFile::remove("conftest-out.o"); - return code == 0; -} - void Configure::generateQDevicePri() { FileWriter deviceStream(buildPath + "/mkspecs/qdevice.pri"); @@ -2687,240 +616,6 @@ void Configure::generateQDevicePri() dictionary[ "DONE" ] = "error"; } -void Configure::generateQConfigPri() -{ - // Generate qconfig.pri - { - FileWriter configStream(buildPath + "/mkspecs/qconfig.pri"); - - configStream << "CONFIG+= "; - configStream << dictionary[ "BUILD" ]; - configStream << (dictionary[ "SHARED" ] == "no" ? " static" : " shared"); - - if (dictionary["STATIC_RUNTIME"] == "yes") - configStream << " static_runtime"; - if (dictionary[ "RTTI" ] == "yes") - configStream << " rtti"; - if (dictionary["INCREDIBUILD_XGE"] == "yes") - configStream << " incredibuild_xge"; - if (dictionary["PLUGIN_MANIFESTS"] == "no") - configStream << " no_plugin_manifest"; - if (dictionary["CROSS_COMPILE"] == "yes") - configStream << " cross_compile"; - - if (dictionary[ "SLOG2" ] == "yes") - configStream << " slog2"; - - if (dictionary[ "QNX_IMF" ] == "yes") - configStream << " qqnx_imf"; - - if (dictionary[ "PPS" ] == "yes") - configStream << " qqnx_pps"; - - if (dictionary[ "LGMON" ] == "yes") - configStream << " lgmon"; - - if (dictionary["ANDROID_STYLE_ASSETS"] == "yes") - configStream << " android-style-assets"; - - configStream << endl; - configStream << "host_build {" << endl; - configStream << " QT_ARCH = " << dictionary["QT_HOST_ARCH"] << endl; - configStream << " QT_TARGET_ARCH = " << dictionary["QT_ARCH"] << endl; - configStream << "} else {" << endl; - configStream << " QT_ARCH = " << dictionary["QT_ARCH"] << endl; - configStream << "}" << endl; - configStream << "QT_CONFIG += " << qtConfig.join(' ') << endl; - - configStream << "#versioning " << endl - << "QT_VERSION = " << dictionary["VERSION"] << endl - << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl - << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl - << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; - - configStream << endl - << "QT_EDITION = " << dictionary["EDITION"] << endl; - - if (dictionary["EDITION"] != "OpenSource" && dictionary["EDITION"] != "Preview") { - configStream << "QT_LICHECK = " << dictionary["LICHECK"] << endl; - configStream << "QT_RELEASE_DATE = " << dictionary["RELEASEDATE"] << endl; - } - - if (!dictionary["CFG_SYSROOT"].isEmpty() && dictionary["CFG_GCC_SYSROOT"] == "yes") { - configStream << endl - << "# sysroot" << endl - << "!host_build {" << endl - << " QMAKE_CFLAGS += --sysroot=$$[QT_SYSROOT]" << endl - << " QMAKE_CXXFLAGS += --sysroot=$$[QT_SYSROOT]" << endl - << " QMAKE_LFLAGS += --sysroot=$$[QT_SYSROOT]" << endl - << "}" << endl; - } - - if (!dictionary["QT_LIBINFIX"].isEmpty()) - configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl; - - if (!dictionary["QT_NAMESPACE"].isEmpty()) - configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl; - - if (dictionary[ "SHARED" ] == "no") - configStream << "QT_DEFAULT_QPA_PLUGIN = q" << qpaPlatformName() << endl; - - if (!dictionary["QT_GCC_MAJOR_VERSION"].isEmpty()) { - configStream << "QT_GCC_MAJOR_VERSION = " << dictionary["QT_GCC_MAJOR_VERSION"] << endl - << "QT_GCC_MINOR_VERSION = " << dictionary["QT_GCC_MINOR_VERSION"] << endl - << "QT_GCC_PATCH_VERSION = " << dictionary["QT_GCC_PATCH_VERSION"] << endl; - } - - if (!configStream.flush()) - dictionary[ "DONE" ] = "error"; - } -} - -QString Configure::addDefine(QString def) -{ - QString result, defNeg, defD = def; - - defD.replace(QRegExp("=.*"), ""); - def.replace(QRegExp("="), " "); - - if (def.startsWith("QT_NO_")) { - defNeg = defD; - defNeg.replace("QT_NO_", "QT_"); - } else if (def.startsWith("QT_")) { - defNeg = defD; - defNeg.replace("QT_", "QT_NO_"); - } - - if (defNeg.isEmpty()) { - result = "#ifndef $DEFD\n" - "# define $DEF\n" - "#endif\n\n"; - } else { - result = "#if defined($DEFD) && defined($DEFNEG)\n" - "# undef $DEFD\n" - "#elif !defined($DEFD)\n" - "# define $DEF\n" - "#endif\n\n"; - } - result.replace("$DEFNEG", defNeg); - result.replace("$DEFD", defD); - result.replace("$DEF", def); - return result; -} - -void Configure::generateConfigfiles() -{ - { - FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig.h"); - - tmpStream << "#define QT_VERSION_MAJOR " << dictionary["VERSION_MAJOR"] << endl - << "#define QT_VERSION_MINOR " << dictionary["VERSION_MINOR"] << endl - << "#define QT_VERSION_PATCH " << dictionary["VERSION_PATCH"] << endl - << "#define QT_VERSION_STR \"" << dictionary["VERSION"] << "\"\n" - << endl; - tmpStream << endl; - - if (dictionary[ "SHARED" ] == "no") { - tmpStream << "/* Qt was configured for a static build */" << endl - << "#if !defined(QT_SHARED) && !defined(QT_STATIC)" << endl - << "# define QT_STATIC" << endl - << "#endif" << endl - << endl; - } - tmpStream << "/* License information */" << endl; - tmpStream << "#define QT_PRODUCT_LICENSEE \"" << dictionary[ "LICENSEE" ] << "\"" << endl; - tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl; - tmpStream << endl; - if (dictionary["BUILDDEV"] == "yes") { - tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl; - tmpStream << "#define QT_BUILD_INTERNAL" << endl; - tmpStream << endl; - } - - tmpStream << endl << "// Compiler sub-arch support" << endl; - if (dictionary[ "SSE2" ] == "yes") - tmpStream << "#define QT_COMPILER_SUPPORTS_SSE2 1" << endl; - if (dictionary[ "SSE3" ] == "yes") - tmpStream << "#define QT_COMPILER_SUPPORTS_SSE3 1" << endl; - if (dictionary[ "SSSE3" ] == "yes") - tmpStream << "#define QT_COMPILER_SUPPORTS_SSSE3 1" << endl; - if (dictionary[ "SSE4_1" ] == "yes") - tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_1 1" << endl; - if (dictionary[ "SSE4_2" ] == "yes") - tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_2 1" << endl; - if (dictionary[ "AVX" ] == "yes") - tmpStream << "#define QT_COMPILER_SUPPORTS_AVX 1" << endl; - if (dictionary[ "AVX2" ] == "yes") - tmpStream << "#define QT_COMPILER_SUPPORTS_AVX2 1" << endl; - foreach (const QString &avx512feature, dictionary[ "AVX512" ].split(' ', QString::SkipEmptyParts)) - tmpStream << "#define QT_COMPILER_SUPPRTS_" << avx512feature.toUpper() << " 1" << endl; - - if (dictionary["QREAL"] != "double") { - tmpStream << "#define QT_COORD_TYPE " << dictionary["QREAL"] << endl; - tmpStream << "#define QT_COORD_TYPE_STRING " << dictionary["QREAL_STRING"] << endl; - } - - tmpStream << endl << "// Compile time features" << endl; - - QStringList qconfigList; - if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG"; - - if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY"; - if (dictionary["WIDGETS"] == "no") qconfigList += "QT_NO_WIDGETS"; - if (dictionary["GUI"] == "no") qconfigList += "QT_NO_GUI"; - if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL"; - if (dictionary["SSL"] == "no") qconfigList += "QT_NO_SSL"; - if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL"; - if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL"; - if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS"; - if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE"; - if (dictionary["HARFBUZZ"] == "no") qconfigList += "QT_NO_HARFBUZZ"; - - if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES"; - if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2"; - if (dictionary["DYNAMICGL"] == "yes") qconfigList += "QT_OPENGL_DYNAMIC"; - - if (dictionary["POSIX_IPC"] == "yes") - qconfigList += "QT_POSIX_IPC"; - else if ((platform() != ANDROID) && (platform() != WINDOWS) && (platform() != WINDOWS_RT)) - qconfigList << "QT_NO_SYSTEMSEMAPHORE" << "QT_NO_SHAREDMEMORY"; - - if (dictionary["FONT_CONFIG"] == "no") qconfigList += "QT_NO_FONTCONFIG"; - - if (dictionary["NIS"] == "yes") - qconfigList += "QT_NIS"; - else - qconfigList += "QT_NO_NIS"; - - if (dictionary["SCTP"] == "no") qconfigList += "QT_NO_SCTP"; - - if (dictionary["LARGE_FILE"] == "yes") qconfigList += "QT_LARGEFILE_SUPPORT=64"; - if (dictionary["QT_CUPS"] == "no") qconfigList += "QT_NO_CUPS"; - if (dictionary["QT_ICONV"] == "no") qconfigList += "QT_NO_ICONV"; - if (dictionary["QT_EVDEV"] == "no") qconfigList += "QT_NO_EVDEV"; - if (dictionary["QT_MTDEV"] == "no") qconfigList += "QT_NO_MTDEV"; - if (dictionary["QT_TSLIB"] == "no") qconfigList += "QT_NO_TSLIB"; - if (dictionary["QT_GLIB"] == "no") qconfigList += "QT_NO_GLIB"; - if (dictionary["QT_INOTIFY"] == "no") qconfigList += "QT_NO_INOTIFY"; - if (dictionary["QT_EVENTFD"] == "no") qconfigList += "QT_NO_EVENTFD"; - if (dictionary["ATOMIC64"] == "no") qconfigList += "QT_NO_STD_ATOMIC64"; - - if (dictionary["REDUCE_EXPORTS"] == "yes") qconfigList += "QT_VISIBILITY_AVAILABLE"; - if (dictionary["REDUCE_RELOCATIONS"] == "yes") qconfigList += "QT_REDUCE_RELOCATIONS"; - if (dictionary["QT_GETIFADDRS"] == "no") qconfigList += "QT_NO_GETIFADDRS"; - - qconfigList.sort(); - for (int i = 0; i < qconfigList.count(); ++i) - tmpStream << addDefine(qconfigList.at(i)); - - tmpStream<<"#define QT_QPA_DEFAULT_PLATFORM_NAME \"" << qpaPlatformName() << "\""<" : "SSE2") - << (dictionary[ "SSE3" ] == "no" ? "" : " SSE3") - << (dictionary[ "SSSE3" ] == "no" ? "" : " SSSE3") - << (dictionary[ "SSE4_1" ] == "no" ? "" : " SSE4.1") - << (dictionary[ "SSE4_2" ] == "no" ? "" : " SSE4.2") - << endl; - sout << "AVX support................." - << (dictionary[ "AVX" ] == "no" ? "" : "AVX") - << (dictionary[ "AVX2" ] == "no" ? "" : " AVX2") - << endl; - sout << "AVX512 support.............." - << (dictionary[ "AVX512" ].isEmpty() ? QString("") : dictionary[ "AVX512" ].toUpper()) << endl; - sout << "NEON support................" << dictionary[ "NEON" ] << endl; - sout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl; - sout << "NIS support................." << dictionary[ "NIS" ] << endl; - sout << "Iconv support..............." << dictionary[ "QT_ICONV" ] << endl; - sout << "Evdev support..............." << dictionary[ "QT_EVDEV" ] << endl; - sout << "Mtdev support..............." << dictionary[ "QT_MTDEV" ] << endl; - sout << "Inotify support............." << dictionary[ "QT_INOTIFY" ] << endl; - sout << "eventfd(7) support.........." << dictionary[ "QT_EVENTFD" ] << endl; - sout << "Glib support................" << dictionary[ "QT_GLIB" ] << endl; - sout << "CUPS support................" << dictionary[ "QT_CUPS" ] << endl; - sout << "SSL support................." << dictionary[ "SSL" ] << endl; - sout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl; - sout << "libproxy support............" << dictionary[ "LIBPROXY" ] << endl; - sout << "Qt D-Bus support............" << dictionary[ "DBUS" ] << endl; - sout << "Qt Widgets module support..." << dictionary[ "WIDGETS" ] << endl; - sout << "Qt GUI module support......." << dictionary[ "GUI" ] << endl; - sout << "QML debugging..............." << dictionary[ "QML_DEBUG" ] << endl; - sout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl; - sout << "DirectWrite 2 support......." << dictionary[ "DIRECTWRITE2" ] << endl; - sout << "Use system proxies.........." << dictionary[ "SYSTEM_PROXIES" ] << endl; - sout << "SCTP support................" << dictionary[ "SCTP" ] << endl; - sout << endl; - - sout << "QPA Backends:" << endl; - sout << " GDI....................." << "yes" << endl; - sout << " Direct2D................" << dictionary[ "DIRECT2D" ] << endl; - sout << endl; - - sout << "Third Party Libraries:" << endl; - sout << " ZLIB support............" << (dictionary[ "SYSTEM_ZLIB" ] == QLatin1String("yes") ? QLatin1String("system") : QLatin1String("qt")) << endl; - sout << " GIF support............." << dictionary[ "GIF" ] << endl; - sout << " JPEG support............" << dictionary[ "JPEG" ] << " (" << dictionary[ "LIBJPEG" ] << ")" << endl; - sout << " PNG support............." << dictionary[ "PNG" ] << " (" << dictionary[ "LIBPNG" ] << ")" << endl; - sout << " DoubleConversion........" << dictionary[ "DOUBLECONVERSION" ] << endl; - sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl; - sout << " Fontconfig support......" << dictionary[ "FONT_CONFIG" ] << endl; - sout << " HarfBuzz support........" << dictionary[ "HARFBUZZ" ] << endl; - sout << " PCRE support............" << dictionary[ "PCRE" ] << endl; - sout << " ICU support............." << dictionary[ "ICU" ] << endl; - if (platform() == QNX) { - sout << " SLOG2 support..........." << dictionary[ "SLOG2" ] << endl; - sout << " IMF support............." << dictionary[ "QNX_IMF" ] << endl; - sout << " PPS support............." << dictionary[ "PPS" ] << endl; - sout << " LGMON support..........." << dictionary[ "LGMON" ] << endl; - } - sout << " ANGLE..................." << dictionary[ "ANGLE" ] << endl; - sout << " Dynamic OpenGL.........." << dictionary[ "DYNAMICGL" ] << endl; - sout << endl; - - sout << "Styles:" << endl; - sout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl; - sout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl; - sout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl; - sout << " Fusion.................." << dictionary[ "STYLE_FUSION" ] << endl; - sout << endl; - - sout << "Sql Drivers:" << endl; - sout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl; - sout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl; - sout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl; - sout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl; - sout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl; - sout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl; - sout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl; - sout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl; - sout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl; - sout << endl; - - sout << "Sources are in.............." << QDir::toNativeSeparators(sourcePath) << endl; - sout << "Build is done in............" << QDir::toNativeSeparators(buildPath) << endl; - sout << "Install prefix.............." << QDir::toNativeSeparators(dictionary["QT_INSTALL_PREFIX"]) << endl; - sout << "Headers installed to........" << formatConfigPath("QT_REL_INSTALL_HEADERS") << endl; - sout << "Libraries installed to......" << formatConfigPath("QT_REL_INSTALL_LIBS") << endl; - sout << "Arch-dep. data to..........." << formatConfigPath("QT_REL_INSTALL_ARCHDATA") << endl; - sout << "Plugins installed to........" << formatConfigPath("QT_REL_INSTALL_PLUGINS") << endl; - sout << "Library execs installed to.." << formatConfigPath("QT_REL_INSTALL_LIBEXECS") << endl; - sout << "QML1 imports installed to..." << formatConfigPath("QT_REL_INSTALL_IMPORTS") << endl; - sout << "QML2 imports installed to..." << formatConfigPath("QT_REL_INSTALL_QML") << endl; - sout << "Binaries installed to......." << formatConfigPath("QT_REL_INSTALL_BINS") << endl; - sout << "Arch-indep. data to........." << formatConfigPath("QT_REL_INSTALL_DATA") << endl; - sout << "Docs installed to..........." << formatConfigPath("QT_REL_INSTALL_DOCS") << endl; - sout << "Translations installed to..." << formatConfigPath("QT_REL_INSTALL_TRANSLATIONS") << endl; - sout << "Examples installed to......." << formatConfigPath("QT_REL_INSTALL_EXAMPLES") << endl; - sout << "Tests installed to.........." << formatConfigPath("QT_REL_INSTALL_TESTS") << endl; - - if (checkAvailability("INCREDIBUILD_XGE")) - sout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl; - if (!qmakeDefines.isEmpty()) { - sout << "Defines....................."; - for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs) - sout << (*defs) << " "; - sout << endl; - } - if (!qmakeIncludes.isEmpty()) { - sout << "Include paths..............."; - for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs) - sout << (*incs) << " "; - sout << endl; - } - if (!qmakeLibs.isEmpty()) { - sout << "Additional libraries........"; - for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs) - sout << (*libs) << " "; - sout << endl; - } - if (dictionary[ "SHARED" ] == "no") { - sout << "WARNING: Using static linking will disable the use of plugins." << endl; - sout << " Make sure you compile ALL needed modules into the library." << endl; - } - if (dictionary[ "OPENSSL" ] == "linked") { - if (!opensslLibsDebug.isEmpty() || !opensslLibsRelease.isEmpty()) { - sout << "Using OpenSSL libraries:" << endl; - sout << " debug : " << opensslLibsDebug << endl; - sout << " release: " << opensslLibsRelease << endl; - sout << " both : " << opensslLibs << endl; - } else if (opensslLibs.isEmpty()) { - sout << "NOTE: When linking against OpenSSL, you can override the default" << endl; - sout << "library names through OPENSSL_LIBS and optionally OPENSSL_LIBS_DEBUG/OPENSSL_LIBS_RELEASE" << endl; - sout << "For example:" << endl; - sout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl; - } - } - if (dictionary["RELEASE_TOOLS"] == "yes" && dictionary["BUILD"] != "debug" ) { - sout << endl - << "NOTE: -optimized-tools is not useful in -release mode." << endl; - } - if (!dictionary["PREFIX_COMPLAINTS"].isEmpty()) { - sout << endl - << dictionary["PREFIX_COMPLAINTS"] << endl - << endl; - } - - // display config.summary - sout.seekg(0, ios::beg); - while (sout.good()) { - string str; - getline(sout, str); - cout << str << endl; - } -} - void Configure::generateHeaders() { if (dictionary["SYNCQT"] == "auto") - dictionary["SYNCQT"] = defaultTo("SYNCQT"); + dictionary["SYNCQT"] = QFile::exists(sourcePath + "/.git") ? "yes" : "no"; if (dictionary["SYNCQT"] == "yes") { if (!QStandardPaths::findExecutable(QStringLiteral("perl.exe")).isEmpty()) { @@ -3534,6 +1012,58 @@ void Configure::buildQmake() } +void Configure::configure() +{ + static const char * const files[] = { "qmodule", "qconfig" }; + + for (int i = 0; i < 2; i++) { + QFile file(buildPath + "/mkspecs/" + files[i] + ".pri"); + QString oldfn = file.fileName() + ".old"; + if (file.exists() && !QFileInfo::exists(oldfn)) + QFile::rename(file.fileName(), oldfn); + if (!file.open(QFile::WriteOnly | QFile::Text)) { + cout << "Failed to create file " << qPrintable(file.fileName()) << endl; + dictionary[ "DONE" ] = "error"; + return; + } + file.close(); + } + + FileWriter ci(buildPath + "/config.tests/configure.cfg"); + ci << "# Feature defaults set by configure command line\n" + << "config.input.qt_edition = " << dictionary["EDITION"] << "\n" + << "config.input.qt_licheck = " << dictionary["LICHECK"] << "\n" + << "config.input.qt_release_date = " << dictionary["RELEASEDATE"]; + if (!ci.flush()) { + dictionary[ "DONE" ] = "error"; + return; + } + + QStringList args; + args << buildPath + "/bin/qmake" + << "-o" << "Makefile.cfg" + << sourcePath + "/configure.pri" + << "--" << configCmdLine; + + if (int exitCode = Environment::execute(args, QStringList(), QStringList())) { + cout << "Qmake failed, return code " << exitCode << endl << endl; + dictionary[ "DONE" ] = "error"; + } + + for (int i = 0; i < 2; i++) { + QFile file(buildPath + "/mkspecs/" + files[i] + ".pri"); + QFile oldFile(file.fileName() + ".old"); + if (oldFile.open(QIODevice::ReadOnly | QIODevice::Text) + && file.open(QIODevice::ReadOnly | QIODevice::Text) + && oldFile.readAll() == file.readAll()) { + file.remove(); + oldFile.rename(file.fileName()); + } else { + oldFile.remove(); + } + } +} + void Configure::generateMakefiles() { QString pwd = QDir::currentPath(); @@ -3556,13 +1086,6 @@ void Configure::generateMakefiles() QDir::setCurrent(pwd); } -void Configure::showSummary() -{ - QString make = dictionary[ "MAKE" ]; - cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl; - cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl; -} - bool Configure::showLicense(QString orgLicenseFile) { if (dictionary["LICENSE_CONFIRMED"] == "yes") { @@ -3754,23 +1277,6 @@ QString Configure::platformName() const } } -QString Configure::qpaPlatformName() const -{ - switch (platform()) { - default: - case WINDOWS: - return QStringLiteral("windows"); - case WINDOWS_RT: - return QStringLiteral("winrt"); - case QNX: - return QStringLiteral("qnx"); - case ANDROID: - return QStringLiteral("android"); - case OTHER: - return QStringLiteral("xcb"); - } -} - int Configure::platform() const { const QString xQMakeSpec = dictionary.value("XQMAKESPEC"); diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index 9d3f7e39a8e..6af83d44cd5 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -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 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); diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index dfcc3220654..78298f1068a 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -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 diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 12646b6d886..d14961b5acf 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -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; diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index 426cdbd294c..ac521f42e47 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -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;