2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include "androidqtversion.h"
|
|
|
|
|
#include "androidconstants.h"
|
2012-12-07 19:52:56 +02:00
|
|
|
#include "androidconfigurations.h"
|
|
|
|
|
#include "androidmanager.h"
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2012-12-07 19:52:56 +02:00
|
|
|
#include <utils/environment.h>
|
2013-02-04 13:34:09 +01:00
|
|
|
#include <utils/hostosinfo.h>
|
2012-12-07 19:52:56 +02:00
|
|
|
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2012-04-18 20:30:57 +03:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2012-12-07 19:52:56 +02:00
|
|
|
#include <qtsupport/qtversionmanager.h>
|
|
|
|
|
|
2013-03-07 17:12:03 +01:00
|
|
|
#include <projectexplorer/target.h>
|
2012-12-07 19:52:56 +02:00
|
|
|
#include <projectexplorer/kit.h>
|
2014-06-25 15:42:11 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2014-11-19 17:58:33 +01:00
|
|
|
#include <projectexplorer/projecttree.h>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2013-08-01 12:49:47 +02:00
|
|
|
#include <proparser/profileevaluator.h>
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
using namespace Android::Internal;
|
2012-12-07 19:52:56 +02:00
|
|
|
using namespace ProjectExplorer;
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
AndroidQtVersion::AndroidQtVersion()
|
|
|
|
|
: QtSupport::BaseQtVersion()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AndroidQtVersion::AndroidQtVersion(const Utils::FileName &path, bool isAutodetected, const QString &autodetectionSource)
|
|
|
|
|
: QtSupport::BaseQtVersion(path, isAutodetected, autodetectionSource)
|
|
|
|
|
{
|
2014-08-27 11:14:29 +02:00
|
|
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AndroidQtVersion *AndroidQtVersion::clone() const
|
|
|
|
|
{
|
|
|
|
|
return new AndroidQtVersion(*this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AndroidQtVersion::type() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String(Constants::ANDROIDQT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AndroidQtVersion::isValid() const
|
|
|
|
|
{
|
|
|
|
|
if (!BaseQtVersion::isValid())
|
|
|
|
|
return false;
|
|
|
|
|
if (qtAbis().isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AndroidQtVersion::invalidReason() const
|
|
|
|
|
{
|
|
|
|
|
QString tmp = BaseQtVersion::invalidReason();
|
|
|
|
|
if (tmp.isEmpty() && qtAbis().isEmpty())
|
2012-09-28 16:13:16 +02:00
|
|
|
return tr("Failed to detect the ABIs used by the Qt version.");
|
2012-04-18 20:30:57 +03:00
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 23:50:37 +02:00
|
|
|
QList<Abi> AndroidQtVersion::detectQtAbis() const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2015-02-03 23:50:37 +02:00
|
|
|
QList<Abi> abis = qtAbisFromLibrary(qtCorePaths(versionInfo(), qtVersionString()));
|
2013-02-20 17:05:00 +01:00
|
|
|
for (int i = 0; i < abis.count(); ++i) {
|
|
|
|
|
abis[i] = Abi(abis.at(i).architecture(),
|
|
|
|
|
abis.at(i).os(),
|
2015-02-03 23:50:37 +02:00
|
|
|
Abi::AndroidLinuxFlavor,
|
2013-02-20 17:05:00 +01:00
|
|
|
abis.at(i).binaryFormat(),
|
|
|
|
|
abis.at(i).wordWidth());
|
|
|
|
|
}
|
|
|
|
|
return abis;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2015-02-03 23:50:37 +02:00
|
|
|
void AndroidQtVersion::addToEnvironment(const Kit *k, Utils::Environment &env) const
|
2012-12-07 19:52:56 +02:00
|
|
|
{
|
2015-01-27 18:46:40 +01:00
|
|
|
Q_UNUSED(k);
|
2012-12-07 19:52:56 +02:00
|
|
|
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
|
2013-12-16 20:19:07 +01:00
|
|
|
env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::currentConfig().toolchainHost());
|
|
|
|
|
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::currentConfig().ndkLocation().toUserOutput());
|
2012-12-07 19:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
2014-03-27 13:12:28 +01:00
|
|
|
Utils::Environment AndroidQtVersion::qmakeRunEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
Utils::Environment env = Utils::Environment::systemEnvironment();
|
|
|
|
|
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::currentConfig().ndkLocation().toUserOutput());
|
|
|
|
|
return env;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
QString AndroidQtVersion::description() const
|
|
|
|
|
{
|
2012-08-01 15:25:05 +02:00
|
|
|
//: Qt Version is meant for Android
|
|
|
|
|
return tr("Android");
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2013-08-01 12:49:47 +02:00
|
|
|
QString AndroidQtVersion::targetArch() const
|
|
|
|
|
{
|
|
|
|
|
ensureMkSpecParsed();
|
|
|
|
|
return m_targetArch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
|
|
|
|
{
|
|
|
|
|
m_targetArch = evaluator->value(QLatin1String("ANDROID_TARGET_ARCH"));
|
2013-08-28 14:14:10 +02:00
|
|
|
BaseQtVersion::parseMkSpec(evaluator);
|
2013-08-01 12:49:47 +02:00
|
|
|
}
|
|
|
|
|
|
2015-11-27 11:31:35 +01:00
|
|
|
QSet<Core::Id> AndroidQtVersion::availableFeatures() const
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2015-11-27 11:31:35 +01:00
|
|
|
QSet<Core::Id> features = QtSupport::BaseQtVersion::availableFeatures();
|
|
|
|
|
features.insert(QtSupport::Constants::FEATURE_MOBILE);
|
|
|
|
|
features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE);
|
|
|
|
|
features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT);
|
2012-04-18 20:30:57 +03:00
|
|
|
return features;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-27 14:02:44 +01:00
|
|
|
QSet<Core::Id> AndroidQtVersion::targetDeviceTypes() const
|
|
|
|
|
{
|
|
|
|
|
return { Constants::ANDROID_DEVICE_TYPE };
|
|
|
|
|
}
|