From 32d4be85980a3d8c747b428640d0a3d8e36d94d5 Mon Sep 17 00:00:00 2001 From: Bjoern Breitmeyer Date: Fri, 9 Aug 2013 14:10:15 +0200 Subject: Integrate device-option into the windows configure Windows configure does not have -device-option yet. A hack for android already generated the qdevice.pri. But it did this even if no android was build, so merged the device-option with the android generation of qdevice.pri. The qdevice.pri is generated earlier in the configure steps than before to match the linux configure and allow to set device options before the config.tests are run. Change-Id: I753cf0d5eba1479792a685d6e1f5acb38b970893 Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 70 ++++++++++++++++++++++++---------------- tools/configure/configureapp.h | 1 + tools/configure/main.cpp | 5 +++ 3 files changed, 49 insertions(+), 27 deletions(-) (limited to 'tools/configure') diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 68b1b74b78..873568daf8 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -500,6 +500,14 @@ void Configure::parseCmdLine() || configCmdLine.at(i) == "-device") { ++i; // do nothing + } else if (configCmdLine.at(i) == "-device-option") { + ++i; + const QString option = configCmdLine.at(i); + QString &devOpt = dictionary["DEVICE_OPTION"]; + if (!devOpt.isEmpty()) + devOpt.append("\n").append(option); + else + devOpt = option; } else if (configCmdLine.at(i) == "-no-zlib") { @@ -3077,6 +3085,41 @@ bool Configure::compilerSupportsFlag(const QString &compilerAndArgs) return code == 0; } +void Configure::generateQDevicePri() +{ + FileWriter deviceStream(buildPath + "/mkspecs/qdevice.pri"); + if (dictionary.contains("DEVICE_OPTION")) { + const QString devoptionlist = dictionary["DEVICE_OPTION"]; + const QStringList optionlist = devoptionlist.split(QStringLiteral("\n")); + foreach (const QString &entry, optionlist) + deviceStream << entry << "\n"; + } + if (dictionary.contains("ANDROID_SDK_ROOT") && dictionary.contains("ANDROID_NDK_ROOT")) { + QString android_platform(dictionary.contains("ANDROID_PLATFORM") + ? dictionary["ANDROID_PLATFORM"] + : QString("android-9")); + deviceStream << "android_install {" << endl; + deviceStream << " DEFAULT_ANDROID_SDK_ROOT = " << formatPath(dictionary["ANDROID_SDK_ROOT"]) << endl; + deviceStream << " DEFAULT_ANDROID_NDK_ROOT = " << formatPath(dictionary["ANDROID_NDK_ROOT"]) << endl; + deviceStream << " DEFAULT_ANDROID_PLATFORM = " << android_platform << endl; + if (QSysInfo::WordSize == 64) + deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows-x86_64" << endl; + else + deviceStream << " 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")); + deviceStream << " DEFAULT_ANDROID_TARGET_ARCH = " << android_arch << endl; + deviceStream << " DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION = " << android_tc_vers << endl; + deviceStream << "}" << endl; + } + if (!deviceStream.flush()) + dictionary[ "DONE" ] = "error"; +} + void Configure::generateQConfigPri() { // Generate qconfig.pri @@ -3363,33 +3406,6 @@ void Configure::generateConfigfiles() dictionary[ "DONE" ] = "error"; } - { - FileWriter tmpStream(buildPath + "/mkspecs/qdevice.pri"); - - 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; - - if (!tmpStream.flush()) - dictionary[ "DONE" ] = "error"; - } } void Configure::displayConfig() diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index 314b2be861..8a22cea6ec 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -77,6 +77,7 @@ public: void generateConfigfiles(); void detectArch(); void generateQConfigPri(); + void generateQDevicePri(); void prepareConfigTests(); void showSummary(); QString firstLicensePath(); diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index 9beee36a50..fb815b287e 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -81,6 +81,11 @@ int runConfigure( int argc, char** argv ) if (!app.isOk()) return 3; + // Generate qdevice.pri + app.generateQDevicePri(); + if (!app.isOk()) + return 3; + // Prepare the config test build directory. app.prepareConfigTests(); if (!app.isOk()) -- cgit v1.2.3