diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/configure/configureapp.cpp | 178 |
1 files changed, 168 insertions, 10 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 22ee456038..9ad7e8a91d 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Intel Corporation ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. @@ -69,7 +70,8 @@ enum Platforms { WINDOWS, WINDOWS_CE, QNX, - BLACKBERRY + BLACKBERRY, + ANDROID }; std::ostream &operator<<(std::ostream &s, const QString &val) { @@ -244,6 +246,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "CFG_GCC_SYSROOT" ] = "yes"; dictionary[ "SLOG2" ] = "no"; dictionary[ "SYSTEM_PROXIES" ] = "no"; + dictionary[ "WERROR" ] = "auto"; //Only used when cross compiling. dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg"; @@ -891,6 +894,11 @@ void Configure::parseCmdLine() dictionary[ "SYSTEM_PROXIES" ] = "no"; } else if (configCmdLine.at(i) == "-system-proxies") { dictionary[ "SYSTEM_PROXIES" ] = "yes"; + } else if (configCmdLine.at(i) == "-warnings-are-errors" || + configCmdLine.at(i) == "-Werror") { + dictionary[ "WERROR" ] = "yes"; + } else if (configCmdLine.at(i) == "-no-warnings-are-errors") { + dictionary[ "WERROR" ] = "no"; } // Work around compiler nesting limitation @@ -1243,6 +1251,41 @@ void Configure::parseCmdLine() dictionary["QT_INSTALL_SETTINGS"] = configCmdLine.at(i); } + else if (configCmdLine.at(i) == "-android-ndk") { + ++i; + if (i == argCount) + break; + dictionary[ "ANDROID_NDK_ROOT" ] = configCmdLine.at(i); + } + + else if (configCmdLine.at(i) == "-android-sdk") { + ++i; + if (i == argCount) + break; + dictionary[ "ANDROID_SDK_ROOT" ] = configCmdLine.at(i); + } + + else if (configCmdLine.at(i) == "-android-ndk-platform") { + ++i; + if (i == argCount) + break; + dictionary[ "ANDROID_PLATFORM" ] = configCmdLine.at(i); + } + + else if (configCmdLine.at(i) == "-android-arch") { + ++i; + if (i == argCount) + break; + dictionary[ "ANDROID_TARGET_ARCH" ] = configCmdLine.at(i); + } + + else if (configCmdLine.at(i) == "-android-toolchain-version") { + ++i; + if (i == argCount) + break; + dictionary[ "ANDROID_NDK_TOOLCHAIN_VERSION" ] = configCmdLine.at(i); + } + else { dictionary[ "HELP" ] = "yes"; cout << "Unknown option " << configCmdLine.at(i) << endl; @@ -1291,7 +1334,7 @@ void Configure::parseCmdLine() dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) { if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make"; - dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++"; + dictionary[ "QMAKEMAKEFILE" ] = "Makefile.unix"; } else { if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make"; dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; @@ -1361,8 +1404,14 @@ void Configure::parseCmdLine() } // Allow tests for private classes to be compiled against internal builds - if (dictionary["BUILDDEV"] == "yes") - qtConfig += "private_tests"; + if (dictionary["BUILDDEV"] == "yes") { + qtConfig << "private_tests"; + if (dictionary["WERROR"] != "no") + qmakeConfig << "warnings_are_errors"; + } else { + if (dictionary["WERROR"] == "yes") + qmakeConfig << "warnings_are_errors"; + } if (dictionary["FORCE_ASSERTS"] == "yes") qtConfig += "force_asserts"; @@ -1590,6 +1639,14 @@ void Configure::applySpecSpecifics() } else if ((platform() == QNX) || (platform() == BLACKBERRY)) { dictionary["STACK_PROTECTOR_STRONG"] = "auto"; dictionary["SLOG2"] = "auto"; + } else if (platform() == ANDROID) { + dictionary[ "REDUCE_EXPORTS" ] = "yes"; + dictionary[ "BUILD" ] = "release"; + dictionary[ "BUILDALL" ] = "no"; + dictionary[ "LARGE_FILE" ] = "no"; + dictionary[ "ANGLE" ] = "no"; + dictionary[ "REDUCE_RELOCATIONS" ] = "yes"; + dictionary[ "QT_GETIFADDRS" ] = "no"; } } @@ -1734,6 +1791,8 @@ bool Configure::displayHelp() 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."); #if !defined(EVAL) desc( "-qtnamespace <name>", "Wraps all Qt library code in 'namespace name {...}'."); @@ -2548,7 +2607,7 @@ void Configure::generateOutputVars() qtConfig += "build_all"; } if (dictionary[ "FORCEDEBUGINFO" ] == "yes") - qtConfig += "force_debug_info"; + qmakeConfig += "force_debug_info"; qmakeConfig += dictionary[ "BUILD" ]; dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ]; @@ -2658,6 +2717,9 @@ void Configure::generateOutputVars() if (dictionary["STACK_PROTECTOR_STRONG"] == "yes") qtConfig += "stack-protector-strong"; + if (dictionary["REDUCE_EXPORTS"] == "yes") + qtConfig += "reduce_exports"; + // We currently have no switch for QtConcurrent, so add it unconditionally. qtConfig += "concurrent"; @@ -2922,7 +2984,13 @@ void Configure::detectArch() Environment::execute(command); // find the executable that was generated - QFile exe("arch.exe"); + 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)) { @@ -3294,6 +3362,10 @@ void Configure::generateConfigfiles() if (dictionary["QT_GLIB"] == "no") qconfigList += "QT_NO_GLIB"; if (dictionary["QT_INOTIFY"] == "no") qconfigList += "QT_NO_INOTIFY"; + 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)); @@ -3327,6 +3399,33 @@ void Configure::generateConfigfiles() tmpFile3.copy(outName); tmpFile3.close(); } + + QFile qdeviceFile(dictionary["QT_BUILD_TREE"] + "/mkspecs/qdevice.pri"); + if (qdeviceFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + tmpStream.setDevice(&qdeviceFile); + QString android_platform(dictionary.contains("ANDROID_PLATFORM") + ? dictionary["ANDROID_PLATFORM"] + : QString("android-9")); + tmpStream << "android_install {" << endl; + tmpStream << " DEFAULT_ANDROID_SDK_ROOT = " << formatPath(dictionary["ANDROID_SDK_ROOT"]) << endl; + tmpStream << " DEFAULT_ANDROID_NDK_ROOT = " << formatPath(dictionary["ANDROID_NDK_ROOT"]) << endl; + tmpStream << " DEFAULT_ANDROID_PLATFORM = " << android_platform << endl; + if (QSysInfo::WordSize == 64) + tmpStream << " DEFAULT_ANDROID_NDK_HOST = windows-x86_64" << endl; + else + tmpStream << " DEFAULT_ANDROID_NDK_HOST = windows" << endl; + QString android_arch(dictionary.contains("ANDROID_TARGET_ARCH") + ? dictionary["ANDROID_TARGET_ARCH"] + : QString("armeabi-v7a")); + QString android_tc_vers(dictionary.contains("ANDROID_NDK_TOOLCHAIN_VERSION") + ? dictionary["ANDROID_NDK_TOOLCHAIN_VERSION"] + : QString("4.7")); + tmpStream << " DEFAULT_ANDROID_TARGET_ARCH = " << android_arch << endl; + tmpStream << " DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION = " << android_tc_vers << endl; + tmpStream << "}" << endl; + tmpStream.flush(); + qdeviceFile.close(); + } } #endif @@ -3710,12 +3809,64 @@ void Configure::buildQmake() stream << "#AutoGenerated by configure.exe" << endl << "BUILD_PATH = " << QDir::toNativeSeparators(buildPath) << endl << "SOURCE_PATH = " << QDir::toNativeSeparators(sourcePath) << endl; - stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl - << "QT_VERSION = " << dictionary["VERSION"] << endl; - + stream << "QT_VERSION = " << dictionary["VERSION"] << endl; + if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) { + stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\win32-g++" << endl + << "EXTRA_CFLAGS = -DUNICODE" << endl + << "EXTRA_CXXFLAGS = -DUNICODE" << endl + << "QTOBJS = qfilesystemengine_win.o \\" << endl + << " qfilesystemiterator_win.o \\" << endl + << " qfsfileengine_win.o \\" << endl + << " qlocale_win.o \\" << endl + << " qsettings_win.o \\" << endl + << " qsystemlibrary.o \\" << endl + << " registry.o" << endl + << "QTSRCS=\"$(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp\" \\" << endl + << " \"$(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp\" \\" << endl + << " \"$(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp\" \\" << endl + << " \"$(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp\" \\" << endl + << " \"$(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp\" \\" << endl\ + << " \"$(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp\" \\" << endl + << " \"$(SOURCE_PATH)/tools/shared/windows/registry.cpp\"" << endl + << "EXEEXT=.exe" << endl + << "LFLAGS=-static -s -lole32 -luuid -ladvapi32 -lkernel32" << endl; + /* + ** SHELL is the full path of sh.exe, unless + ** 1) it is found in the current directory + ** 2) it is not found at all + ** 3) it is overridden on the command line with an existing file + ** ... otherwise it is always sh.exe. Specifically, SHELL from the + ** environment has no effect. + ** + ** This check will fail if SHELL is explicitly set to a not + ** sh-compatible shell. This is not a problem, because configure.bat + ** will not do that. + */ + stream << "ifeq ($(SHELL), sh.exe)" << endl + << " ifeq ($(wildcard $(CURDIR)/sh.exe), )" << endl + << " SH = 0" << endl + << " else" << endl + << " SH = 1" << endl + << " endif" << endl + << "else" << endl + << " SH = 1" << endl + << "endif" << endl + << "\n" + << "ifeq ($(SH), 1)" << endl + << " RM_F = rm -f" << endl + << " RM_RF = rm -rf" << endl + << "else" << endl + << " RM_F = del /f" << endl + << " RM_RF = rmdir /s /q" << endl + << "endif" << endl; + stream << "\n\n"; + } else { + stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl; + } if (dictionary["EDITION"] == "OpenSource" || dictionary["QT_EDITION"].contains("OPENSOURCE")) - stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl; + stream << "EXTRA_CPPFLAGS = -DQMAKE_OPENSOURCE_EDITION" << endl; + stream << "\n\n"; QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]); @@ -4079,6 +4230,8 @@ QString Configure::platformName() const return QStringLiteral("Qt for QNX"); case BLACKBERRY: return QStringLiteral("Qt for Blackberry"); + case ANDROID: + return QStringLiteral("Qt for Android"); } } @@ -4093,6 +4246,8 @@ QString Configure::qpaPlatformName() const return QStringLiteral("qnx"); case BLACKBERRY: return QStringLiteral("blackberry"); + case ANDROID: + return QStringLiteral("android"); } } @@ -4110,6 +4265,9 @@ int Configure::platform() const if (xQMakeSpec.contains("blackberry")) return BLACKBERRY; + if (xQMakeSpec.contains("android")) + return ANDROID; + return WINDOWS; } |