2012-04-18 20:30:57 +03:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
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
|
|
|
|
|
** 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.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2012-04-18 20:30:57 +03:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
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
|
|
|
|
2013-10-29 16:19:24 +01:00
|
|
|
#include <qmakeprojectmanager/qmakeproject.h>
|
|
|
|
|
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.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>
|
|
|
|
|
#include <projectexplorer/projectexplorer.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;
|
2013-10-16 11:02:37 +02:00
|
|
|
using namespace QmakeProjectManager;
|
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)
|
|
|
|
|
{
|
2012-11-28 13:39:22 +01:00
|
|
|
setDisplayName(defaultDisplayName(qtVersionString(), 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::Abi> AndroidQtVersion::detectQtAbis() const
|
|
|
|
|
{
|
2013-10-31 19:35:39 +01:00
|
|
|
QList<ProjectExplorer::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(),
|
|
|
|
|
ProjectExplorer::Abi::AndroidLinuxFlavor,
|
|
|
|
|
abis.at(i).binaryFormat(),
|
|
|
|
|
abis.at(i).wordWidth());
|
|
|
|
|
}
|
|
|
|
|
return abis;
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2012-12-07 19:52:56 +02:00
|
|
|
void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
|
|
|
|
|
{
|
|
|
|
|
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
|
2013-04-04 01:29:47 -07:00
|
|
|
env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::instance().config().toolchainHost);
|
2012-12-07 19:52:56 +02:00
|
|
|
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::instance().config().ndkLocation.toUserOutput());
|
|
|
|
|
|
2013-10-29 17:37:39 +01:00
|
|
|
QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject *>(ProjectExplorerPlugin::instance()->currentProject());
|
|
|
|
|
if (!qmakeProject || !qmakeProject->activeTarget()
|
2012-12-07 19:52:56 +02:00
|
|
|
|| QtSupport::QtKitInformation::qtVersion(k)->type() != QLatin1String(Constants::ANDROIDQT))
|
|
|
|
|
return;
|
2013-03-07 17:12:03 +01:00
|
|
|
|
2013-10-29 17:37:39 +01:00
|
|
|
Target *target = qmakeProject->activeTarget();
|
2013-03-07 17:12:03 +01:00
|
|
|
if (DeviceTypeKitInformation::deviceTypeId(target->kit()) != Constants::ANDROID_DEVICE_TYPE)
|
|
|
|
|
return;
|
|
|
|
|
if (AndroidConfigurations::instance().config().ndkLocation.isEmpty()
|
|
|
|
|
|| AndroidConfigurations::instance().config().sdkLocation.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2012-12-07 19:52:56 +02:00
|
|
|
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
|
2013-10-17 13:12:45 +02:00
|
|
|
AndroidConfigurations::instance().bestNdkPlatformMatch(AndroidManager::buildTargetSDK(target)));
|
2012-12-07 19:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
Core::FeatureSet AndroidQtVersion::availableFeatures() const
|
|
|
|
|
{
|
|
|
|
|
Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures();
|
|
|
|
|
features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE);
|
|
|
|
|
return features;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AndroidQtVersion::platformName() const
|
|
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AndroidQtVersion::platformDisplayName() const
|
|
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM_TR);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|