/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 Intel Corporation ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "configureapp.h" #include "environment.h" #include "tools.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include QT_BEGIN_NAMESPACE enum Platforms { WINDOWS, WINDOWS_CE, WINDOWS_RT, QNX, BLACKBERRY, ANDROID, OTHER }; std::ostream &operator<<(std::ostream &s, const QString &val) { s << val.toLocal8Bit().data(); return s; } using namespace std; // Macros to simplify options marking #define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " ) static inline void promptKeyPress() { cout << "(Press any key to continue...)"; if (_getch() == 3) // _Any_ keypress w/no echo(eat for stdout) exit(0); // Exit cleanly for Ctrl+C } Configure::Configure(int& argc, char** argv) : verbose(0) { // Default values for indentation optionIndent = 4; descIndent = 25; outputWidth = 0; // Get console buffer output width CONSOLE_SCREEN_BUFFER_INFO info; HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); if (GetConsoleScreenBufferInfo(hStdout, &info)) outputWidth = info.dwSize.X - 1; outputWidth = qMin(outputWidth, 79); // Anything wider gets unreadable if (outputWidth < 35) // Insanely small, just use 79 outputWidth = 79; int i; /* ** Set up the initial state, the default */ dictionary[ "CONFIGCMD" ] = argv[ 0 ]; for (i = 1; i < argc; i++) configCmdLine += argv[ i ]; if (configCmdLine.size() >= 2 && configCmdLine.at(0) == "-srcdir") { sourcePath = QDir::cleanPath(configCmdLine.at(1)); sourceDir = QDir(sourcePath); configCmdLine.erase(configCmdLine.begin(), configCmdLine.begin() + 2); } else { // Get the path to the executable wchar_t module_name[MAX_PATH]; GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t)); QFileInfo sourcePathInfo = QString::fromWCharArray(module_name); sourcePath = sourcePathInfo.absolutePath(); sourceDir = sourcePathInfo.dir(); } buildPath = QDir::currentPath(); #if 0 const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR); #else const QString installPath = buildPath; #endif if (sourceDir != buildDir) { //shadow builds! QDir(buildPath).mkpath("bin"); buildDir.mkpath("mkspecs"); } defaultBuildParts << QStringLiteral("libs") << QStringLiteral("tools") << QStringLiteral("examples"); allBuildParts = defaultBuildParts; allBuildParts << QStringLiteral("tests"); dictionary[ "QT_INSTALL_PREFIX" ] = installPath; dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC"); if (dictionary[ "QMAKESPEC" ].size() == 0) { dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec(); dictionary[ "QMAKESPEC_FROM" ] = "detected"; } else { dictionary[ "QMAKESPEC_FROM" ] = "env"; } dictionary[ "QCONFIG" ] = "full"; dictionary[ "EMBEDDED" ] = "no"; dictionary[ "BUILD_QMAKE" ] = "yes"; dictionary[ "QMAKE_INTERNAL" ] = "no"; dictionary[ "WIDGETS" ] = "yes"; dictionary[ "GUI" ] = "yes"; dictionary[ "RTTI" ] = "yes"; dictionary[ "STRIP" ] = "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[ "CE_CRT" ] = "no"; dictionary[ "CETEST" ] = "auto"; dictionary[ "CE_SIGNATURE" ] = "no"; dictionary[ "AUDIO_BACKEND" ] = "auto"; dictionary[ "WMF_BACKEND" ] = "auto"; dictionary[ "WMSDK" ] = "auto"; dictionary[ "QML_DEBUG" ] = "yes"; dictionary[ "PLUGIN_MANIFESTS" ] = "no"; dictionary[ "DIRECTWRITE" ] = "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" ] = "no"; dictionary[ "WERROR" ] = "auto"; dictionary[ "QREAL" ] = "double"; dictionary[ "ATOMIC64" ] = "auto"; //Only used when cross compiling. dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg"; QString version; QFile qmake_conf(sourcePath + "/.qmake.conf"); if (qmake_conf.open(QFile::ReadOnly)) { while (!qmake_conf.atEnd()) { static const char beginning[] = "MODULE_VERSION = "; QByteArray line = qmake_conf.readLine(); if (!line.startsWith(beginning)) continue; version = qMove(line).mid(int(strlen(beginning))).trimmed(); break; } qmake_conf.close(); } if (version.isEmpty()) version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff); dictionary[ "VERSION" ] = version; { QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)"); if (version_re.exactMatch(version)) { dictionary[ "VERSION_MAJOR" ] = version_re.cap(1); dictionary[ "VERSION_MINOR" ] = version_re.cap(2); dictionary[ "VERSION_PATCH" ] = version_re.cap(3); } } dictionary[ "REDO" ] = "no"; dictionary[ "BUILD" ] = "debug"; dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly dictionary[ "FORCEDEBUGINFO" ] = "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[ "ZLIB" ] = "auto"; dictionary[ "PCRE" ] = "auto"; dictionary[ "ICU" ] = "no"; dictionary[ "ANGLE" ] = "auto"; dictionary[ "DYNAMICGL" ] = "auto"; dictionary[ "GIF" ] = "auto"; dictionary[ "JPEG" ] = "auto"; dictionary[ "PNG" ] = "auto"; dictionary[ "LIBJPEG" ] = "auto"; dictionary[ "LIBPNG" ] = "auto"; dictionary[ "DOUBLECONVERSION" ] = "auto"; dictionary[ "FREETYPE" ] = "yes"; dictionary[ "HARFBUZZ" ] = "qt"; dictionary[ "ACCESSIBILITY" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; dictionary[ "OPENVG" ] = "no"; dictionary[ "SSL" ] = "auto"; dictionary[ "OPENSSL" ] = "auto"; dictionary[ "LIBPROXY" ] = "auto"; dictionary[ "DBUS" ] = "auto"; dictionary[ "STYLE_WINDOWS" ] = "yes"; dictionary[ "STYLE_WINDOWSXP" ] = "auto"; dictionary[ "STYLE_WINDOWSVISTA" ] = "auto"; dictionary[ "STYLE_FUSION" ] = "yes"; dictionary[ "STYLE_WINDOWSCE" ] = "no"; dictionary[ "STYLE_WINDOWSMOBILE" ] = "no"; 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); } else { tmp = tmp.mid(tmp.lastIndexOf("/") + 1); } dictionary[ "QMAKESPEC" ] = tmp; dictionary[ "INCREDIBUILD_XGE" ] = "auto"; dictionary[ "LTCG" ] = "no"; dictionary[ "NATIVE_GESTURES" ] = "yes"; 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() { } QString Configure::formatPath(const QString &path) { QString ret = QDir::cleanPath(path); // This amount of quoting is deemed sufficient. if (ret.contains(QLatin1Char(' '))) { ret.prepend(QLatin1Char('"')); ret.append(QLatin1Char('"')); } 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; } // We could use QDir::homePath() + "/.qt-license", but // that will only look in the first of $HOME,$USERPROFILE // or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be // more forgiving for the end user.. QString Configure::firstLicensePath() { QStringList allPaths; allPaths << "./.qt-license" << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license" << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license" << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license"; for (int i = 0; i< allPaths.count(); ++i) if (QFile::exists(allPaths.at(i))) return allPaths.at(i); return QString(); } // #### somehow I get a compiler error about vc++ reaching the nesting limit without // undefining the ansi for scoping. #ifdef for #undef for #endif void Configure::parseCmdLine() { if (configCmdLine.size() && configCmdLine.at(0) == "-top-level") { dictionary[ "TOPLEVEL" ] = "yes"; configCmdLine.removeAt(0); } int argCount = configCmdLine.size(); int i = 0; const QStringList imageFormats = QStringList() << "gif" << "png" << "jpeg"; if (argCount < 1) // skip rest if no arguments ; else if (configCmdLine.at(i) == "-redo") { dictionary[ "REDO" ] = "yes"; configCmdLine.clear(); reloadCmdLine(); } else if (configCmdLine.at(i) == "-loadconfig") { ++i; if (i != argCount) { dictionary[ "REDO" ] = "yes"; dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i); configCmdLine.clear(); reloadCmdLine(); } else { dictionary[ "DONE" ] = "error"; } i = 0; } argCount = configCmdLine.size(); bool isDeviceMkspec = false; // Look first for XQMAKESPEC for (int j = 0 ; j < argCount; ++j) { if ((configCmdLine.at(j) == "-xplatform") || (configCmdLine.at(j) == "-device")) { isDeviceMkspec = (configCmdLine.at(j) == "-device"); ++j; if (j == argCount) break; dictionary["XQMAKESPEC"] = configCmdLine.at(j); applySpecSpecifics(); break; } } for (; i 1) { dictionary[ "DONE" ] = "error"; cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl; foreach (const QString &device, family) cout << "\t* " << device << endl; } else { Q_ASSERT(family.size() == 1); dictionary["XQMAKESPEC"] = family.at(0); } } else { // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well if (dictionary.contains("XQMAKESPEC") && !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) { dictionary[ "DONE" ] = "error"; cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl; } } // Ensure that the crt to be deployed can be found if (dictionary["CE_CRT"] != QLatin1String("yes") && dictionary["CE_CRT"] != QLatin1String("no")) { QDir cDir(dictionary["CE_CRT"]); QStringList entries = cDir.entryList(); bool hasDebug = entries.contains("msvcr80.dll"); bool hasRelease = entries.contains("msvcr80d.dll"); if ((dictionary["BUILDALL"] == "auto") && (!hasDebug || !hasRelease)) { cout << "Could not find debug and release c-runtime." << endl; cout << "You need to have msvcr80.dll and msvcr80d.dll in" << endl; cout << "the path specified. Setting to -no-crt"; dictionary[ "CE_CRT" ] = "no"; } else if ((dictionary["BUILD"] == "debug") && !hasDebug) { cout << "Could not find debug c-runtime (msvcr80d.dll) in the directory specified." << endl; cout << "Setting c-runtime automatic deployment to -no-crt" << endl; dictionary[ "CE_CRT" ] = "no"; } else if ((dictionary["BUILD"] == "release") && !hasRelease) { cout << "Could not find release c-runtime (msvcr80.dll) in the directory specified." << endl; cout << "Setting c-runtime automatic deployment to -no-crt" << endl; dictionary[ "CE_CRT" ] = "no"; } } // Allow tests for private classes to be compiled against internal builds if (dictionary["BUILDDEV"] == "yes") { qtConfig << "private_tests"; if (dictionary["WERROR"] != "no") qmakeConfig << "warnings_are_errors"; if (dictionary["HEADERSCLEAN"] != "no") qmakeConfig << "headersclean"; } else { if (dictionary["WERROR"] == "yes") qmakeConfig << "warnings_are_errors"; if (dictionary["HEADERSCLEAN"] == "yes") qmakeConfig << "headersclean"; } if (dictionary["FORCE_ASSERTS"] == "yes") qtConfig += "force_asserts"; for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) { modules.removeAll((*dis)); } for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) { if (modules.indexOf((*ena)) == -1) modules += (*ena); } qtConfig += modules; for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it) qtConfig.removeAll(*it); if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes") && (dictionary[ "DONE" ] != "error")) saveCmdLine(); } void Configure::validateArgs() { // Validate the specified config QString cfgpath = sourcePath + "/src/corelib/global/qconfig-" + dictionary["QCONFIG"] + ".h"; // Try internal configurations first. QStringList possible_configs = QStringList() << "minimal" << "small" << "medium" << "large" << "full"; int index = possible_configs.indexOf(dictionary["QCONFIG"]); if (index >= 0) { for (int c = 0; c <= index; c++) { qtConfig += possible_configs[c] + "-config"; } if (dictionary["QCONFIG"] != "full") dictionary["QCONFIG_PATH"] = cfgpath; return; } if (!QFileInfo::exists(cfgpath)) { cfgpath = QFileInfo(dictionary["QCONFIG"]).absoluteFilePath(); if (!QFileInfo::exists(cfgpath)) { dictionary[ "DONE" ] = "error"; cout << "No such configuration \"" << qPrintable(dictionary["QCONFIG"]) << "\"" << endl ; return; } } dictionary["QCONFIG_PATH"] = cfgpath; } // Output helper functions --------------------------------[ Start ]- /*! Determines the length of a string token. */ static int tokenLength(const char *str) { if (*str == 0) return 0; const char *nextToken = strpbrk(str, " _/\n\r"); if (nextToken == str || !nextToken) return 1; return int(nextToken - str); } /*! Prints out a string which starts at position \a startingAt, and indents each wrapped line with \a wrapIndent characters. The wrap point is set to the console width, unless that width cannot be determined, or is too small. */ void Configure::desc(const char *description, int startingAt, int wrapIndent) { int linePos = startingAt; bool firstLine = true; const char *nextToken = description; while (*nextToken) { int nextTokenLen = tokenLength(nextToken); if (*nextToken == '\n' // Wrap on newline, duh || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth { printf("\n"); linePos = 0; firstLine = false; if (*nextToken == '\n') ++nextToken; continue; } if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent printf("%*s", wrapIndent , ""); linePos = wrapIndent; if (*nextToken == ' ') { ++nextToken; continue; } } printf("%.*s", nextTokenLen, nextToken); linePos += nextTokenLen; nextToken += nextTokenLen; } } /*! Prints out an option with its description wrapped at the description starting point. If \a skipIndent is true, the indentation to the option is not outputted (used by marked option version of desc()). Extra spaces between option and its description is filled with\a fillChar, if there's available space. */ void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar) { if (!skipIndent) printf("%*s", optionIndent, ""); int remaining = descIndent - optionIndent - int(strlen(option)); int wrapIndent = descIndent + qMax(0, 1 - remaining); printf("%s", option); if (remaining > 2) { printf(" "); // Space in front for (int i = remaining; i > 2; --i) printf("%c", fillChar); // Fill, if available space } printf(" "); // Space between option and description desc(description, wrapIndent, wrapIndent); printf("\n"); } /*! Same as above, except it also marks an option with an '*', if the option is default action. */ void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar) { const QString markedAs = dictionary.value(mark_option); if (markedAs == "auto" && markedAs == mark) // both "auto", always => + printf(" + "); else if (markedAs == "auto") // setting marked as "auto" and option is default => + printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' '); else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => + printf(" %c " , checkAvailability(mark_option) ? '+' : ' '); else // None are "auto", (markedAs == mark) => * printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' '); desc(option, description, true, fillChar); } /*! Modifies the default configuration based on given -platform option. Eg. switches to different default styles for Windows CE. */ void Configure::applySpecSpecifics() { if (dictionary.contains("XQMAKESPEC")) { //Disable building tools when cross compiling. nobuildParts << "tools"; } if (dictionary.value("XQMAKESPEC").startsWith("winphone") || dictionary.value("XQMAKESPEC").startsWith("winrt")) { dictionary[ "STYLE_WINDOWSXP" ] = "no"; dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; dictionary[ "GIF" ] = "qt"; dictionary[ "JPEG" ] = "qt"; dictionary[ "LIBJPEG" ] = "qt"; dictionary[ "LIBPNG" ] = "qt"; dictionary[ "FREETYPE" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; dictionary[ "OPENVG" ] = "no"; dictionary[ "SSL" ] = "yes"; dictionary[ "OPENSSL" ] = "no"; dictionary[ "DBUS" ] = "no"; dictionary[ "ZLIB" ] = "qt"; dictionary[ "PCRE" ] = "qt"; dictionary[ "ICU" ] = "qt"; dictionary[ "CE_CRT" ] = "yes"; dictionary[ "LARGE_FILE" ] = "no"; dictionary[ "ANGLE" ] = "yes"; dictionary[ "DYNAMICGL" ] = "no"; } else if (dictionary.value("XQMAKESPEC").startsWith("wince")) { dictionary[ "STYLE_WINDOWSXP" ] = "no"; dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; dictionary[ "STYLE_FUSION" ] = "no"; dictionary[ "STYLE_WINDOWSCE" ] = "yes"; dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes"; dictionary[ "OPENGL" ] = "no"; dictionary[ "SSL" ] = "no"; dictionary[ "OPENSSL" ] = "no"; dictionary[ "RTTI" ] = "no"; dictionary[ "SSE2" ] = "no"; dictionary[ "SSE3" ] = "no"; dictionary[ "SSSE3" ] = "no"; dictionary[ "SSE4_1" ] = "no"; dictionary[ "SSE4_2" ] = "no"; dictionary[ "AVX" ] = "no"; dictionary[ "AVX2" ] = "no"; dictionary[ "AVX512" ] = "no"; dictionary[ "CE_CRT" ] = "yes"; dictionary[ "LARGE_FILE" ] = "no"; dictionary[ "ANGLE" ] = "no"; dictionary[ "DYNAMICGL" ] = "no"; if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) { dictionary[ "MMX" ] = "yes"; } } else if (dictionary.value("XQMAKESPEC").startsWith("linux")) { //TODO actually wrong. //TODO dictionary[ "STYLE_WINDOWSXP" ] = "no"; dictionary[ "STYLE_WINDOWSVISTA" ] = "no"; dictionary[ "KBD_DRIVERS" ] = "tty"; dictionary[ "GFX_DRIVERS" ] = "linuxfb"; dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp"; dictionary[ "OPENGL" ] = "no"; dictionary[ "DBUS"] = "no"; dictionary[ "QT_INOTIFY" ] = "no"; dictionary[ "QT_CUPS" ] = "no"; dictionary[ "QT_GLIB" ] = "no"; dictionary[ "QT_ICONV" ] = "no"; dictionary[ "QT_EVDEV" ] = "no"; dictionary[ "QT_MTDEV" ] = "no"; dictionary[ "FONT_CONFIG" ] = "auto"; dictionary[ "ANGLE" ] = "no"; dictionary["DECORATIONS"] = "default windows styled"; } else if ((platform() == QNX) || (platform() == BLACKBERRY)) { dictionary["STACK_PROTECTOR_STRONG"] = "auto"; dictionary["SLOG2"] = "auto"; dictionary["QNX_IMF"] = "auto"; dictionary["PPS"] = "auto"; dictionary["LGMON"] = "auto"; dictionary["QT_XKBCOMMON"] = "no"; dictionary[ "ANGLE" ] = "no"; dictionary[ "DYNAMICGL" ] = "no"; dictionary[ "FONT_CONFIG" ] = "auto"; } else if (platform() == ANDROID) { dictionary[ "REDUCE_EXPORTS" ] = "yes"; dictionary[ "BUILD" ] = "release"; dictionary[ "BUILDALL" ] = "no"; dictionary[ "LARGE_FILE" ] = "no"; dictionary[ "ANGLE" ] = "no"; dictionary[ "DYNAMICGL" ] = "no"; dictionary[ "REDUCE_RELOCATIONS" ] = "yes"; dictionary[ "QT_GETIFADDRS" ] = "no"; dictionary[ "QT_XKBCOMMON" ] = "no"; dictionary["ANDROID_STYLE_ASSETS"] = "yes"; dictionary[ "STYLE_ANDROID" ] = "yes"; } } // Output helper functions ---------------------------------[ Stop ]- bool Configure::displayHelp() { if (dictionary[ "HELP" ] == "yes") { desc("Usage: configure [options]\n\n", 0, 7); desc("Installation options:\n\n"); desc("These are optional, but you may specify install directories.\n\n", 0, 1); desc( "-prefix ", "The deployment directory, as seen on the target device.\n" "(default %CD%)\n"); desc( "-extprefix ", "The installation directory, as seen on the host machine.\n" "(default SYSROOT/PREFIX)\n"); desc( "-hostprefix [dir]", "The installation directory for build tools running on the\n" "host machine. If [dir] is not given, the current build\n" "directory will be used. (default EXTPREFIX)\n"); desc("You may use these to change the layout of the install. Note that all directories\n" "except -sysconfdir should be located under -prefix/-hostprefix:\n\n"); desc( "-bindir ", "User executables will be installed to \n(default PREFIX/bin)"); desc( "-libdir ", "Libraries will be installed to \n(default PREFIX/lib)"); desc( "-headerdir ", "Headers will be installed to \n(default PREFIX/include)"); desc( "-archdatadir ", "Architecture-dependent data used by Qt will be installed to \n(default PREFIX)"); desc( "-libexecdir ", "Program executables will be installed to \n(default ARCHDATADIR/bin)"); desc( "-plugindir ", "Plugins will be installed to \n(default ARCHDATADIR/plugins)"); desc( "-importdir ", "Imports for QML1 will be installed to \n(default ARCHDATADIR/imports)"); desc( "-qmldir ", "Imports for QML2 will be installed to \n(default ARCHDATADIR/qml)"); desc( "-datadir ", "Data used by Qt programs will be installed to \n(default PREFIX)"); desc( "-docdir ", "Documentation will be installed to \n(default DATADIR/doc)"); desc( "-translationdir ", "Translations of Qt programs will be installed to \n(default DATADIR/translations)"); desc( "-examplesdir ", "Examples will be installed to \n(default PREFIX/examples)"); desc( "-testsdir ", "Tests will be installed to \n(default PREFIX/tests)\n"); desc( "-hostbindir ", "Host executables will be installed to \n(default HOSTPREFIX/bin)"); desc( "-hostlibdir ", "Host libraries will be installed to \n(default HOSTPREFIX/lib)"); desc( "-hostdatadir ", "Data used by qmake will be installed to \n(default HOSTPREFIX)"); desc("\nConfigure options:\n\n"); desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value" " that needs to be evaluated. If the evaluation succeeds, the feature is" " included. Here is a short explanation of each option:\n\n", 0, 1); desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off."); desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on."); desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n"); desc("FORCEDEBUGINFO", "yes","-force-debug-info", "Create symbol files for release builds."); desc("SEPARATE_DEBUG_INFO", "yes","-separate-debug-info", "Strip debug information into a separate file.\n"); desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n"); desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt."); desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n"); desc( "-c++std ", "Compile Qt with C++ standard edition (c++98, c++11, c++14, c++1z)\n" "Default: highest supported. This option is not supported for MSVC.\n"); desc("USE_GOLD_LINKER", "yes", "-use-gold-linker", "Link using the GNU gold linker (gcc only)."); desc("USE_GOLD_LINKER", "no", "-no-use-gold-linker", "Do not link using the GNU gold linker.\n"); desc("ENABLE_NEW_DTAGS", "yes", "-enable-new-dtags", "Use new DTAGS for RPATH (Linux only)."); desc("ENABLE_NEW_DTAGS", "no", "-disable-new-dtags", "Do not use new DTAGS for RPATH.\n"); desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries."); desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n"); desc("STATIC_RUNTIME", "no", "-static-runtime","Statically link the C/C++ runtime library.\n"); desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)"); desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n"); desc( "-make ", "Add part to the list of parts to be built at make time"); for (int i=0; i", "Exclude part from the list of parts to be built.\n"); desc( "-skip ", "Exclude an entire module from the build.\n"); desc( "-no-compile-examples", "Install only the sources of examples.\n"); desc("WIDGETS", "no", "-no-widgets", "Disable Qt Widgets module.\n"); desc("GUI", "no", "-no-gui", "Disable Qt GUI module.\n"); desc("ACCESSIBILITY", "no", "-no-accessibility", "Disable accessibility support.\n"); desc( "", "Disabling accessibility is not recommended, as it will break QStyle\n" "and may break other internal parts of Qt.\n" "With this switch you create a source incompatible version of Qt,\n" "which is unsupported.\n"); desc("ACCESSIBILITY", "yes", "-accessibility", "Enable accessibility support.\n"); desc( "-no-sql-", "Disable SQL entirely, by default none are turned on."); desc( "-qt-sql-", "Enable a SQL in the Qt Library."); desc( "-plugin-sql-", "Enable SQL as a plugin to be linked to at run time.\n" "Available values for :"); desc("SQL_MYSQL", "auto", "", " mysql", ' '); desc("SQL_PSQL", "auto", "", " psql", ' '); desc("SQL_OCI", "auto", "", " oci", ' '); desc("SQL_ODBC", "auto", "", " odbc", ' '); desc("SQL_TDS", "auto", "", " tds", ' '); desc("SQL_DB2", "auto", "", " db2", ' '); desc("SQL_SQLITE", "auto", "", " sqlite", ' '); desc("SQL_SQLITE2", "auto", "", " sqlite2", ' '); desc("SQL_IBASE", "auto", "", " ibase", ' '); desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' '); desc( "-system-sqlite", "Use sqlite from the operating system.\n"); desc("OPENGL", "no","-no-opengl", "Do not support OpenGL."); desc("OPENGL", "no","-opengl ", "Enable OpenGL support with specified API version.\n" "Available values for :"); desc("", "no", "", " desktop - Enable support for Desktop OpenGL", ' '); desc("", "no", "", " dynamic - Enable support for dynamically loaded OpenGL (either desktop or ES)", ' '); desc("OPENGL_ES_2", "yes", "", " es2 - Enable support for OpenGL ES 2.0\n", ' '); desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality."); desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality.\n"); desc( "-force-asserts", "Activate asserts in release mode.\n"); desc( "-platform ", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n"); desc( "-xplatform ", "The operating system and compiler you are cross compiling to.\n"); desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' '); desc("TARGET_OS", "*", "-target", "Set target OS version. Currently the only valid value is 'xp' for targeting Windows XP.\n" "MSVC >= 2012 targets Windows Vista by default.\n"); desc( "-sysroot ", "Sets as the target compiler's and qmake's sysroot and also sets pkg-config paths."); desc( "-no-gcc-sysroot", "When using -sysroot, it disables the passing of --sysroot to the compiler.\n"); desc( "-qconfig ", "Use src/corelib/global/qconfig-.h rather than the\n" "default 'full'.\n"); desc("NIS", "no", "-no-nis", "Do not compile NIS support."); desc("NIS", "yes", "-nis", "Compile NIS support.\n"); desc("QT_ICONV", "disable", "-no-iconv", "Do not enable support for iconv(3)."); desc("QT_ICONV", "yes", "-iconv", "Enable support for iconv(3)."); desc("QT_ICONV", "yes", "-sun-iconv", "Enable support for iconv(3) using sun-iconv."); desc("QT_ICONV", "yes", "-gnu-iconv", "Enable support for iconv(3) using gnu-libiconv.\n"); desc("QT_EVDEV", "no", "-no-evdev", "Do not enable support for evdev."); desc("QT_EVDEV", "yes", "-evdev", "Enable support for evdev."); desc("QT_MTDEV", "no", "-no-mtdev", "Do not enable support for mtdev."); desc("QT_MTDEV", "yes", "-mtdev", "Enable support for mtdev."); desc("QT_INOTIFY", "yes", "-inotify", "Explicitly enable Qt inotify(7) support."); desc("QT_INOTIFY", "no", "-no-inotify", "Explicitly disable Qt inotify(7) support.\n"); desc("QT_EVENTFD", "yes", "-eventfd", "Enable eventfd(7) support in the UNIX event loop."); desc("QT_EVENTFD", "no", "-no-eventfd", "Disable eventfd(7) support in the UNIX event loop.\n"); desc("LARGE_FILE", "yes", "-largefile", "Enables Qt to access files larger than 4 GB.\n"); desc("FONT_CONFIG", "yes", "-fontconfig", "Build with FontConfig support."); desc("FONT_CONFIG", "no", "-no-fontconfig", "Do not build with FontConfig support.\n"); desc("POSIX_IPC", "yes", "-posix-ipc", "Enable POSIX IPC.\n"); desc("QT_GLIB", "yes", "-glib", "Compile Glib support.\n"); desc("QT_INSTALL_SETTINGS", "auto", "-sysconfdir ", "Settings used by Qt programs will be looked for in\n.\n"); desc("SYSTEM_PROXIES", "yes", "-system-proxies", "Use system network proxies by default."); desc("SYSTEM_PROXIES", "no", "-no-system-proxies", "Do not use system network proxies by default.\n"); desc("WERROR", "yes", "-warnings-are-errors", "Make warnings be treated as errors."); desc("WERROR", "no", "-no-warnings-are-errors","Make warnings be treated normally."); desc( "-qtnamespace ", "Wraps all Qt library code in 'namespace name {...}'."); desc( "-qtlibinfix ", "Renames all Qt* libs to Qt*.\n"); desc( "-D ", "Add an explicit define to the preprocessor."); desc( "-I ", "Add an explicit include path."); desc( "-L ", "Add an explicit library path."); desc( "-l ", "Add an explicit library name, residing in a librarypath.\n"); desc( "-help, -h, -?", "Display this information.\n"); // 3rd party stuff options go below here -------------------------------------------------------------------------------- desc("Third Party Libraries:\n\n"); desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt."); desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n"); desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt."); desc("PCRE", "system", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n"); desc("ICU", "yes", "-icu", "Use the ICU library."); desc("ICU", "no", "-no-icu", "Do not use the ICU library.\nSee http://site.icu-project.org/\n"); desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.\n"); desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support."); desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt."); desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n"); desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support."); desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt."); desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n"); desc("DOUBLECONVERSION", "no", "-no-doubleconversion", "Use sscanf_l and snprintf_l for (imprecise) double conversion."); desc("DOUBLECONVERSION", "qt", "-qt-doubleconversion", "Use the libdouble-conversion bundled with Qt."); desc("DOUBLECONVERSION", "system", "-system-doubleconversion", "Use the libdouble-conversion provided by the system."); desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support."); desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt."); desc("FREETYPE", "system","-system-freetype", "Use the libfreetype provided by the system."); desc("HARFBUZZ", "no", "-no-harfbuzz", "Do not compile in HarfBuzz-NG support."); desc("HARFBUZZ", "qt", "-qt-harfbuzz", "Use HarfBuzz-NG bundled with Qt to do text shaping.\n" "It can still be disabled by setting\n" "the QT_HARFBUZZ environment variable to \"old\"."); desc("HARFBUZZ", "system","-system-harfbuzz", "Use HarfBuzz-NG from the operating system\n" "to do text shaping. It can still be disabled\n" "by setting the QT_HARFBUZZ environment variable to \"old\".\n" "See http://www.harfbuzz.org\n"); if ((platform() == QNX) || (platform() == BLACKBERRY)) { desc("SLOG2", "yes", "-slog2", "Compile with slog2 support."); desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support."); desc("QNX_IMF", "yes", "-imf", "Compile with imf support."); desc("QNX_IMF", "no", "-no-imf", "Do not compile with imf support."); desc("PPS", "yes", "-pps", "Compile with PPS support."); desc("PPS", "no", "-no-pps", "Do not compile with PPS support."); desc("LGMON", "yes", "-lgmon", "Compile with lgmon support."); desc("LGMON", "no", "-no-lgmon", "Do not compile with lgmon support.\n"); } desc("ANGLE", "yes", "-angle", "Use the ANGLE implementation of OpenGL ES 2.0."); desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee http://code.google.com/p/angleproject/\n"); // Qt\Windows only options go below here -------------------------------------------------------------------------------- desc("\nQt for Windows only:\n\n"); desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps."); desc("INCREDIBUILD_XGE", "yes", "-incredibuild-xge", "Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.\n(The IncrediBuild distribution commands are only added to Visual Studio projects)\n"); desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins."); desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n"); desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake."); desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n"); desc( "-qreal [double|float]", "typedef qreal to the specified type. The default is double.\n" "Note that changing this flag affects binary compatibility.\n"); desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information."); desc("RTTI", "yes", "-rtti", "Compile runtime type information."); desc("STRIP", "no", "-no-strip", "Do not strip libraries and executables of debug info when installing."); desc("STRIP", "yes", "-strip", "Strip libraries and executables of debug info when installing.\n"); desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions."); desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions."); desc("SSE3", "no", "-no-sse3", "Do not compile with use of SSE3 instructions."); desc("SSE3", "yes", "-sse3", "Compile with use of SSE3 instructions."); desc("SSSE3", "no", "-no-ssse3", "Do not compile with use of SSSE3 instructions."); desc("SSSE3", "yes", "-ssse3", "Compile with use of SSSE3 instructions."); desc("SSE4_1", "no", "-no-sse4.1", "Do not compile with use of SSE4.1 instructions."); desc("SSE4_1", "yes", "-sse4.1", "Compile with use of SSE4.1 instructions."); desc("SSE4_2", "no", "-no-sse4.2", "Do not compile with use of SSE4.2 instructions."); desc("SSE4_2", "yes", "-sse4.2", "Compile with use of SSE4.2 instructions."); desc("AVX", "no", "-no-avx", "Do not compile with use of AVX instructions."); desc("AVX", "yes", "-avx", "Compile with use of AVX instructions."); desc("AVX2", "no", "-no-avx2", "Do not compile with use of AVX2 instructions."); desc("AVX2", "yes", "-avx2", "Compile with use of AVX2 instructions.\n"); desc("AVX512", "no", "-no-avx512", "Do not compile with use of AVX512 instructions."); desc("AVX512", "yes", "-avx512", "Compile with use of AVX512 instructions.\n"); desc("SSL", "no", "-no-ssl", "Do not compile support for SSL."); desc("SSL", "yes", "-ssl", "Enable run-time SSL support."); desc("OPENSSL", "no", "-no-openssl", "Do not compile support for OpenSSL."); desc("OPENSSL", "yes", "-openssl", "Enable run-time OpenSSL support."); desc("OPENSSL", "linked","-openssl-linked", "Enable linked OpenSSL support.\n"); desc("LIBPROXY", "no", "-no-libproxy", "Do not compile in libproxy support."); desc("LIBPROXY", "yes", "-libproxy", "Compile in libproxy support (for cross compilation targets).\n"); desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support."); desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1.\n"); desc("DBUS", "runtime", "-dbus-runtime", "Compile in D-Bus support and load libdbus-1\ndynamically."); desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into\nQt Multimedia."); desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into Qt Multimedia.\n"); desc("WMF_BACKEND", "no","-no-wmf-backend", "Do not compile in the windows media foundation backend\ninto Qt Multimedia."); desc("WMF_BACKEND", "yes","-wmf-backend", "Compile in the windows media foundation backend into Qt Multimedia.\n"); desc("QML_DEBUG", "no", "-no-qml-debug", "Do not build the in-process QML debugging support."); desc("QML_DEBUG", "yes", "-qml-debug", "Build the in-process QML debugging support.\n"); desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering."); desc("DIRECTWRITE", "yes", "-directwrite", "Build support for DirectWrite font rendering.\n"); desc("DIRECT2D", "no", "-no-direct2d", "Do not build the Direct2D platform plugin."); desc("DIRECT2D", "yes", "-direct2d", "Build the Direct2D platform plugin (experimental,\n" "requires Direct2D availability on target systems,\n" "e.g. Windows 7 with Platform Update, Windows 8, etc.)\n"); desc( "-no-style-