1
/****************************************************************************
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of Qt Creator.
8
** Commercial License Usage
9
** Licensees holding valid commercial Qt licenses may use this file in
10
** accordance with the commercial license agreement provided with the
11
** Software or, alternatively, in accordance with the terms contained in
12
** a written agreement between you and Digia. For licensing terms and
13
** conditions see http://qt.digia.com/licensing. For further information
14
** use the contact form at http://qt.digia.com/contact-us.
16
** GNU Lesser General Public License Usage
17
** Alternatively, this file may be used under the terms of the GNU Lesser
18
** General Public License version 2.1 as published by the Free Software
19
** Foundation and appearing in the file LICENSE.LGPL included in the
20
** packaging of this file. Please review the following information to
21
** ensure the GNU Lesser General Public License version 2.1 requirements
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
** In addition, as a special exception, Digia gives you certain additional
25
** rights. These rights are described in the Digia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
****************************************************************************/
29
#include "maemoqtversion.h"
31
#include "maemoconstants.h"
32
#include "maemoglobal.h"
34
#include <projectexplorer/kitinformation.h>
35
#include <qt4projectmanager/qt4projectmanagerconstants.h>
36
#include <qtsupport/qtsupportconstants.h>
37
#include <coreplugin/featureprovider.h>
38
#include <utils/hostosinfo.h>
40
#include <QCoreApplication>
43
#include <QTextStream>
45
using namespace Qt4ProjectManager;
50
MaemoQtVersion::MaemoQtVersion()
51
: QtSupport::BaseQtVersion(),
52
m_isvalidVersion(false),
58
MaemoQtVersion::MaemoQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
59
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource),
60
m_deviceType(MaemoGlobal::deviceType(path.toString())),
61
m_isvalidVersion(false),
64
setDisplayName(defaultDisplayName(qtVersionString(), path, false));
67
MaemoQtVersion::~MaemoQtVersion()
72
void MaemoQtVersion::fromMap(const QVariantMap &map)
74
QtSupport::BaseQtVersion::fromMap(map);
75
QString path = qmakeCommand().toString();
76
m_deviceType = MaemoGlobal::deviceType(path);
79
QString MaemoQtVersion::type() const
81
return QLatin1String(QtSupport::Constants::MAEMOQT);
84
bool MaemoQtVersion::isValid() const
86
if (!BaseQtVersion::isValid())
89
m_isvalidVersion = MaemoGlobal::isValidMaemoQtVersion(qmakeCommand().toString(), m_deviceType);
92
return m_isvalidVersion;
95
MaemoQtVersion *MaemoQtVersion::clone() const
97
return new MaemoQtVersion(*this);
100
QList<ProjectExplorer::Abi> MaemoQtVersion::detectQtAbis() const
102
QList<ProjectExplorer::Abi> result;
105
if (m_deviceType == Maemo5OsType) {
106
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
107
ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
109
} else if (m_deviceType == HarmattanOsType) {
110
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
111
ProjectExplorer::Abi::HarmattanLinuxFlavor,
112
ProjectExplorer::Abi::ElfFormat,
118
QString MaemoQtVersion::description() const
120
if (m_deviceType == Maemo5OsType)
121
return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5");
122
if (m_deviceType == HarmattanOsType)
123
return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan");
127
bool MaemoQtVersion::supportsShadowBuilds() const
129
return !Utils::HostOsInfo::isWindowsHost();
132
Core::Id MaemoQtVersion::deviceType() const
137
Core::FeatureSet MaemoQtVersion::availableFeatures() const
139
Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures();
140
if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 4)) //no reliable test for components, yet.
141
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO);
142
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE);
144
if (deviceType() != Maemo5OsType) //Only Maemo5 has proper support for Widgets
145
features.remove(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS));
150
QString MaemoQtVersion::platformName() const
152
if (m_deviceType == Maemo5OsType)
153
return QLatin1String(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM);
154
return QLatin1String(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM);
157
QString MaemoQtVersion::platformDisplayName() const
159
if (m_deviceType == Maemo5OsType)
160
return QLatin1String(QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM_TR);
161
return QLatin1String(QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM_TR);
164
void MaemoQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
167
const QString maddeRoot = MaemoGlobal::maddeRoot(qmakeCommand().toString());
169
// Needed to make pkg-config stuff work.
170
Utils::FileName sysRoot = ProjectExplorer::SysRootKitInformation::sysRoot(k);
171
env.prependOrSet(QLatin1String("SYSROOT_DIR"), sysRoot.toUserOutput());
172
env.prependOrSetPath(QDir::toNativeSeparators(QString::fromLatin1("%1/madbin")
174
env.prependOrSetPath(QDir::toNativeSeparators(QString::fromLatin1("%1/madlib")
176
env.prependOrSet(QLatin1String("PERL5LIB"),
177
QDir::toNativeSeparators(QString::fromLatin1("%1/madlib/perl5").arg(maddeRoot)));
179
env.prependOrSetPath(QDir::toNativeSeparators(QString::fromLatin1("%1/bin").arg(maddeRoot)));
180
env.prependOrSetPath(QDir::toNativeSeparators(QString::fromLatin1("%1/bin")
181
.arg(MaemoGlobal::targetRoot(qmakeCommand().toString()))));
183
// Actually this is tool chain related, but since we no longer have a tool chain...
184
const QString manglePathsKey = QLatin1String("GCCWRAPPER_PATHMANGLE");
185
if (!env.hasKey(manglePathsKey)) {
186
const QStringList pathsToMangle = QStringList() << QLatin1String("/lib")
187
<< QLatin1String("/opt") << QLatin1String("/usr");
188
env.set(manglePathsKey, pathsToMangle.join(QLatin1String(":")));
192
} // namespace Internal