aboutsummaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-01-09 17:50:40 +0100
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-01-10 18:11:22 +0100
commit81af9acaa295a574c1cb5e6714725197dac7f530 (patch)
treecc8c94467f49a7d267e5249f624874feecc7eed4 /src/app
parent2fe25eb3f20ffb4e58cb559f2bcb9950c963290a (diff)
Move Qt profile setup into a dedicated library.
Otherwise all changes to the implementation will have to be duplicated in IDEs. Change-Id: I61e6d4fa1ee9b724eb5d9de9f233dc915a6c8bc3 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.pri2
-rw-r--r--src/app/qbs-setup-qt/main.cpp1
-rw-r--r--src/app/qbs-setup-qt/qbs-setup-qt.pro5
-rw-r--r--src/app/qbs-setup-qt/qbs-setup-qt.qbs5
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp2
-rw-r--r--src/app/qbs-setup-qt/setupqt.h3
-rw-r--r--src/app/qbs-setup-qt/setupqtprofile.cpp162
-rw-r--r--src/app/qbs-setup-qt/setupqtprofile.h69
8 files changed, 8 insertions, 241 deletions
diff --git a/src/app/app.pri b/src/app/app.pri
index 1fb804af7..8dc6dc95b 100644
--- a/src/app/app.pri
+++ b/src/app/app.pri
@@ -5,7 +5,7 @@ DESTDIR = ../../../bin
CONFIG += console
CONFIG -= app_bundle
-include($${PWD}/../lib/use.pri)
+include($${PWD}/../lib/corelib/use_corelib.pri)
include($${PWD}/shared/logging/logging.pri)
target.path = $${QBS_INSTALL_PREFIX}/bin
diff --git a/src/app/qbs-setup-qt/main.cpp b/src/app/qbs-setup-qt/main.cpp
index 1376a7a70..54fa6739a 100644
--- a/src/app/qbs-setup-qt/main.cpp
+++ b/src/app/qbs-setup-qt/main.cpp
@@ -31,6 +31,7 @@
#include "../shared/logging/consolelogger.h"
#include "../shared/qbssettings.h"
+#include <qtprofilesetup.h>
#include <logging/translator.h>
#include <QCoreApplication>
diff --git a/src/app/qbs-setup-qt/qbs-setup-qt.pro b/src/app/qbs-setup-qt/qbs-setup-qt.pro
index 4840b7ea0..3f2cb8e06 100644
--- a/src/app/qbs-setup-qt/qbs-setup-qt.pro
+++ b/src/app/qbs-setup-qt/qbs-setup-qt.pro
@@ -1,13 +1,12 @@
include(../app.pri)
+include($${PWD}/../../lib/qtprofilesetup/use_qtprofilesetup.pri)
TARGET = qbs-setup-qt
SOURCES += \
main.cpp \
- setupqt.cpp \
- setupqtprofile.cpp
+ setupqt.cpp
HEADERS += \
setupqt.h \
- setupqtprofile.h \
../shared/qbssettings.h
diff --git a/src/app/qbs-setup-qt/qbs-setup-qt.qbs b/src/app/qbs-setup-qt/qbs-setup-qt.qbs
index c3d2f647f..35de5aa7f 100644
--- a/src/app/qbs-setup-qt/qbs-setup-qt.qbs
+++ b/src/app/qbs-setup-qt/qbs-setup-qt.qbs
@@ -3,13 +3,12 @@ import "../apptemplate.qbs" as QbsApp
QbsApp {
name: "qbs-setup-qt"
+ Depends { name: "qbsqtprofilesetup" }
files: [
"../shared/qbssettings.h",
"main.cpp",
"setupqt.cpp",
- "setupqt.h",
- "setupqtprofile.cpp",
- "setupqtprofile.h",
+ "setupqt.h"
]
}
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index 205f21e21..1ee3cb8b2 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -29,8 +29,8 @@
#include "setupqt.h"
-#include "setupqtprofile.h"
#include "../shared/logging/consolelogger.h"
+#include <qtprofilesetup.h>
#include <logging/translator.h>
#include <tools/hostosinfo.h>
#include <tools/profile.h>
diff --git a/src/app/qbs-setup-qt/setupqt.h b/src/app/qbs-setup-qt/setupqt.h
index 831d97956..94d3074d9 100644
--- a/src/app/qbs-setup-qt/setupqt.h
+++ b/src/app/qbs-setup-qt/setupqt.h
@@ -30,13 +30,12 @@
#ifndef QBS_SETUPQT_H
#define QBS_SETUPQT_H
-#include "setupqtprofile.h"
-
#include <tools/error.h>
#include <QCoreApplication>
#include <QStringList>
namespace qbs {
+class QtEnvironment;
class Settings;
class SetupQt
diff --git a/src/app/qbs-setup-qt/setupqtprofile.cpp b/src/app/qbs-setup-qt/setupqtprofile.cpp
deleted file mode 100644
index 4782e0b8f..000000000
--- a/src/app/qbs-setup-qt/setupqtprofile.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Build Suite.
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/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 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "setupqtprofile.h"
-
-#include <logging/translator.h>
-#include <tools/error.h>
-#include <tools/profile.h>
-#include <tools/settings.h>
-
-#include <QDir>
-#include <QFile>
-#include <QRegExp>
-#include <QTextStream>
-
-namespace qbs {
-
-static QString guessMinimumWindowsVersion(const QtEnvironment &qt)
-{
- if (qt.mkspecName.startsWith("winrt-"))
- return QLatin1String("6.2");
-
- if (!qt.mkspecName.startsWith("win32-"))
- return QString();
-
- if (qt.architecture == QLatin1String("x86_64")
- || qt.architecture == QLatin1String("ia64")) {
- return QLatin1String("5.2");
- }
-
- QRegExp rex(QLatin1String("^win32-msvc(\\d+)$"));
- if (rex.exactMatch(qt.mkspecName)) {
- int msvcVersion = rex.cap(1).toInt();
- if (msvcVersion < 2012)
- return QLatin1String("5.0");
- else
- return QLatin1String("5.1");
- }
-
- return qt.qtMajorVersion < 5 ? QLatin1String("5.0") : QLatin1String("5.1");
-}
-
-ErrorInfo setupQtProfile(const QString &profileName, Settings *settings,
- const QtEnvironment &qtEnvironment)
-{
- Profile profile(profileName, settings);
- const QString settingsTemplate(QLatin1String("Qt.core.%1"));
- profile.setValue(settingsTemplate.arg("config"), qtEnvironment.configItems);
- profile.setValue(settingsTemplate.arg("qtConfig"), qtEnvironment.qtConfigItems);
- profile.setValue(settingsTemplate.arg("binPath"), qtEnvironment.binaryPath);
- profile.setValue(settingsTemplate.arg("libPath"), qtEnvironment.libraryPath);
- profile.setValue(settingsTemplate.arg("pluginPath"), qtEnvironment.pluginPath);
- profile.setValue(settingsTemplate.arg("incPath"), qtEnvironment.includePath);
- profile.setValue(settingsTemplate.arg("mkspecPath"), qtEnvironment.mkspecPath);
- profile.setValue(settingsTemplate.arg("docPath"), qtEnvironment.documentationPath);
- profile.setValue(settingsTemplate.arg("version"), qtEnvironment.qtVersion);
- profile.setValue(settingsTemplate.arg("namespace"), qtEnvironment.qtNameSpace);
- profile.setValue(settingsTemplate.arg("libInfix"), qtEnvironment.qtLibInfix);
- profile.setValue(settingsTemplate.arg("buildVariant"), qtEnvironment.buildVariant);
- if (qtEnvironment.staticBuild)
- profile.setValue(settingsTemplate.arg(QLatin1String("staticBuild")),
- qtEnvironment.staticBuild);
-
- // Set the minimum operating system versions appropriate for this Qt version
- const QString windowsVersion = guessMinimumWindowsVersion(qtEnvironment);
- QString osxVersion, iosVersion, androidVersion;
-
- if (qtEnvironment.mkspecPath.contains("macx")) {
- profile.setValue(settingsTemplate.arg("frameworkBuild"), qtEnvironment.frameworkBuild);
- if (qtEnvironment.qtMajorVersion >= 5) {
- osxVersion = QLatin1String("10.6");
- } else if (qtEnvironment.qtMajorVersion == 4 && qtEnvironment.qtMinorVersion >= 6) {
- QDir qconfigDir;
- if (qtEnvironment.frameworkBuild) {
- qconfigDir.setPath(qtEnvironment.libraryPath);
- qconfigDir.cd("QtCore.framework/Headers");
- } else {
- qconfigDir.setPath(qtEnvironment.includePath);
- qconfigDir.cd("Qt");
- }
- QFile qconfig(qconfigDir.absoluteFilePath("qconfig.h"));
- if (qconfig.open(QIODevice::ReadOnly)) {
- bool qtCocoaBuild = false;
- QTextStream ts(&qconfig);
- QString line;
- do {
- line = ts.readLine();
- if (QRegExp(QLatin1String("\\s*#define\\s+QT_MAC_USE_COCOA\\s+1\\s*"),
- Qt::CaseSensitive).exactMatch(line)) {
- qtCocoaBuild = true;
- break;
- }
- } while (!line.isNull());
-
- if (ts.status() == QTextStream::Ok)
- osxVersion = qtCocoaBuild ? QLatin1String("10.5") : QLatin1String("10.4");
- }
-
- if (osxVersion.isEmpty()) {
- return ErrorInfo(Internal::Tr::tr("Error reading qconfig.h; could not determine "
- "whether Qt is using Cocoa or Carbon"));
- }
- }
-
- if (qtEnvironment.configItems.contains("c++11"))
- osxVersion = QLatin1String("10.7");
- }
-
- if (qtEnvironment.mkspecPath.contains("ios") && qtEnvironment.qtMajorVersion >= 5)
- iosVersion = QLatin1String("5.0");
-
- if (qtEnvironment.mkspecPath.contains("android")) {
- if (qtEnvironment.qtMajorVersion >= 5)
- androidVersion = QLatin1String("2.3");
- else if (qtEnvironment.qtMajorVersion == 4 && qtEnvironment.qtMinorVersion >= 8)
- androidVersion = QLatin1String("1.6"); // Necessitas
- }
-
- // ### TODO: wince, winphone, blackberry
-
- if (!windowsVersion.isEmpty())
- profile.setValue(QLatin1String("cpp.minimumWindowsVersion"), windowsVersion);
-
- if (!osxVersion.isEmpty())
- profile.setValue(QLatin1String("cpp.minimumOsxVersion"), osxVersion);
-
- if (!iosVersion.isEmpty())
- profile.setValue(QLatin1String("cpp.minimumIosVersion"), iosVersion);
-
- if (!androidVersion.isEmpty())
- profile.setValue(QLatin1String("cpp.minimumAndroidVersion"), androidVersion);
-
- return ErrorInfo();
-}
-
-} // namespace qbs
diff --git a/src/app/qbs-setup-qt/setupqtprofile.h b/src/app/qbs-setup-qt/setupqtprofile.h
deleted file mode 100644
index a65c922fc..000000000
--- a/src/app/qbs-setup-qt/setupqtprofile.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Build Suite.
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/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 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-#ifndef QBS_SETUPQTPROFILE_H
-#define QBS_SETUPQTPROFILE_H
-
-#include <QStringList>
-
-namespace qbs {
-class ErrorInfo;
-class Settings;
-
-class QtEnvironment {
-public:
- QString installPrefixPath;
- QString libraryPath;
- QString includePath;
- QString binaryPath;
- QString qmlImportPath;
- QString documentationPath;
- QString dataPath;
- QString pluginPath;
- QString qtLibInfix;
- QString qtNameSpace;
- QString mkspecPath;
- QString mkspecName;
- QStringList buildVariant;
- QStringList configItems;
- QStringList qtConfigItems;
- QString architecture;
- QString qtVersion;
- int qtMajorVersion;
- int qtMinorVersion;
- int qtPatchVersion;
- bool frameworkBuild;
- bool staticBuild;
-};
-
-ErrorInfo setupQtProfile(const QString &profileName, Settings *settings,
- const QtEnvironment &qtEnvironment);
-
-} // namespace qbs
-
-#endif // Include guard.