2013-07-11 17:14:24 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-07-11 17:14:24 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
2013-07-11 17:14:24 +02: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.
|
2013-07-11 17:14:24 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "defaultpropertyprovider.h"
|
2013-07-23 14:13:26 +03:00
|
|
|
#include "qbsconstants.h"
|
2013-07-11 17:14:24 +02:00
|
|
|
|
2016-07-15 22:21:49 -07:00
|
|
|
#include <coreplugin/messagemanager.h>
|
2015-07-28 13:12:45 -07:00
|
|
|
#include <projectexplorer/abi.h>
|
2016-05-13 23:22:12 -07:00
|
|
|
#include <projectexplorer/gcctoolchain.h>
|
2013-07-11 17:14:24 +02:00
|
|
|
#include <projectexplorer/kit.h>
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2015-07-28 13:12:45 -07:00
|
|
|
|
2015-02-24 11:33:57 +01:00
|
|
|
#include <utils/hostosinfo.h>
|
2013-07-11 17:14:24 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2014-10-07 13:24:44 +02:00
|
|
|
#include <qbs.h>
|
2014-07-21 02:28:34 -04:00
|
|
|
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
#include <ios/iosconstants.h>
|
|
|
|
|
#include <qnx/qnxconstants.h>
|
|
|
|
|
#include <winrt/winrtconstants.h>
|
|
|
|
|
|
2014-07-21 02:55:43 -04:00
|
|
|
#include <QDir>
|
2013-07-11 17:14:24 +02:00
|
|
|
#include <QFileInfo>
|
2014-09-28 16:44:43 -04:00
|
|
|
#include <QSettings>
|
2013-07-11 17:14:24 +02:00
|
|
|
|
|
|
|
|
namespace QbsProjectManager {
|
2013-07-23 14:13:26 +03:00
|
|
|
using namespace Constants;
|
2014-11-24 17:38:22 +01:00
|
|
|
|
|
|
|
|
namespace Internal {
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
using namespace ProjectExplorer::Constants;
|
|
|
|
|
using namespace Ios::Constants;
|
|
|
|
|
using namespace Qnx::Constants;
|
|
|
|
|
using namespace WinRt::Internal::Constants;
|
2013-07-11 17:14:24 +02:00
|
|
|
|
2014-04-25 15:21:18 +02:00
|
|
|
static QString extractToolchainPrefix(QString *compilerName)
|
|
|
|
|
{
|
|
|
|
|
QString prefix;
|
2015-09-03 12:36:13 +02:00
|
|
|
const QStringList candidates = { QLatin1String("g++"), QLatin1String("clang++"),
|
|
|
|
|
QLatin1String("gcc"), QLatin1String("clang") };
|
|
|
|
|
foreach (const QString &candidate, candidates) {
|
|
|
|
|
const QString suffix = Utils::HostOsInfo::withExecutableSuffix(QLatin1Char('-')
|
|
|
|
|
+ candidate);
|
|
|
|
|
if (compilerName->endsWith(suffix)) {
|
|
|
|
|
const int idx = compilerName->lastIndexOf(QLatin1Char('-')) + 1;
|
|
|
|
|
prefix = compilerName->left(idx);
|
|
|
|
|
compilerName->remove(0, idx);
|
|
|
|
|
}
|
2014-04-25 15:21:18 +02:00
|
|
|
}
|
|
|
|
|
return prefix;
|
|
|
|
|
}
|
|
|
|
|
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
static QStringList targetOSList(const ProjectExplorer::Abi &abi, const ProjectExplorer::Kit *k)
|
|
|
|
|
{
|
|
|
|
|
const Core::Id device = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k);
|
|
|
|
|
QStringList os;
|
|
|
|
|
switch (abi.os()) {
|
|
|
|
|
case ProjectExplorer::Abi::WindowsOS:
|
|
|
|
|
if (device == WINRT_DEVICE_TYPE_LOCAL ||
|
|
|
|
|
device == WINRT_DEVICE_TYPE_PHONE ||
|
|
|
|
|
device == WINRT_DEVICE_TYPE_EMULATOR) {
|
|
|
|
|
os << QLatin1String("winrt");
|
|
|
|
|
} else if (abi.osFlavor() == ProjectExplorer::Abi::WindowsCEFlavor) {
|
|
|
|
|
os << QLatin1String("windowsce");
|
|
|
|
|
}
|
|
|
|
|
os << QLatin1String("windows");
|
|
|
|
|
break;
|
2016-07-25 18:39:16 -07:00
|
|
|
case ProjectExplorer::Abi::DarwinOS:
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
if (device == DESKTOP_DEVICE_TYPE)
|
2016-06-17 15:17:37 -07:00
|
|
|
os << QLatin1String("macos") << QLatin1String("osx");
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
else if (device == IOS_DEVICE_TYPE)
|
|
|
|
|
os << QLatin1String("ios");
|
|
|
|
|
else if (device == IOS_SIMULATOR_TYPE)
|
|
|
|
|
os << QLatin1String("ios-simulator") << QLatin1String("ios");
|
|
|
|
|
os << QLatin1String("darwin") << QLatin1String("bsd") << QLatin1String("unix");
|
|
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Abi::LinuxOS:
|
|
|
|
|
if (abi.osFlavor() == ProjectExplorer::Abi::AndroidLinuxFlavor)
|
|
|
|
|
os << QLatin1String("android");
|
|
|
|
|
os << QLatin1String("linux") << QLatin1String("unix");
|
|
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Abi::BsdOS:
|
|
|
|
|
switch (abi.osFlavor()) {
|
|
|
|
|
case ProjectExplorer::Abi::FreeBsdFlavor:
|
|
|
|
|
os << QLatin1String("freebsd");
|
|
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Abi::NetBsdFlavor:
|
|
|
|
|
os << QLatin1String("netbsd");
|
|
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Abi::OpenBsdFlavor:
|
|
|
|
|
os << QLatin1String("openbsd");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
os << QLatin1String("bsd") << QLatin1String("unix");
|
|
|
|
|
break;
|
|
|
|
|
case ProjectExplorer::Abi::UnixOS:
|
2015-04-24 10:31:27 +02:00
|
|
|
if (device == QNX_QNX_OS_TYPE)
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
os << QLatin1String("qnx");
|
|
|
|
|
else if (abi.osFlavor() == ProjectExplorer::Abi::SolarisUnixFlavor)
|
|
|
|
|
os << QLatin1String("solaris");
|
|
|
|
|
os << QLatin1String("unix");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return os;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static QStringList toolchainList(const ProjectExplorer::ToolChain *tc)
|
|
|
|
|
{
|
|
|
|
|
QStringList list;
|
2015-07-07 15:37:50 +02:00
|
|
|
if (tc->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID)
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
list << QLatin1String("clang") << QLatin1String("llvm") << QLatin1String("gcc");
|
2015-07-07 15:37:50 +02:00
|
|
|
else if (tc->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID)
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
list << QLatin1String("gcc"); // TODO: Detect llvm-gcc
|
2015-07-07 15:37:50 +02:00
|
|
|
else if (tc->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID)
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
list << QLatin1String("mingw") << QLatin1String("gcc");
|
2015-07-07 15:37:50 +02:00
|
|
|
else if (tc->typeId() == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID)
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
list << QLatin1String("msvc");
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 14:51:55 +01:00
|
|
|
QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k,
|
|
|
|
|
const QVariantMap &defaultData) const
|
2013-07-11 17:14:24 +02:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(k, return defaultData);
|
2014-10-31 14:51:55 +01:00
|
|
|
QVariantMap data = autoGeneratedProperties(k, defaultData);
|
|
|
|
|
const QVariantMap customProperties = k->value(Core::Id(QBS_PROPERTIES_KEY_FOR_KITS)).toMap();
|
|
|
|
|
for (QVariantMap::ConstIterator it = customProperties.constBegin();
|
|
|
|
|
it != customProperties.constEnd(); ++it) {
|
|
|
|
|
data.insert(it.key(), it.value());
|
|
|
|
|
}
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplorer::Kit *k,
|
|
|
|
|
const QVariantMap &defaultData) const
|
|
|
|
|
{
|
2013-07-11 17:14:24 +02:00
|
|
|
QVariantMap data = defaultData;
|
2014-07-21 02:55:43 -04:00
|
|
|
|
|
|
|
|
const QString sysroot = ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput();
|
2013-07-11 17:14:24 +02:00
|
|
|
if (ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
|
2014-07-21 02:55:43 -04:00
|
|
|
data.insert(QLatin1String(QBS_SYSROOT), sysroot);
|
2013-07-11 17:14:24 +02:00
|
|
|
|
2016-07-15 22:21:49 -07:00
|
|
|
ProjectExplorer::ToolChain *tcC
|
|
|
|
|
= ProjectExplorer::ToolChainKitInformation::toolChain(k, ProjectExplorer::ToolChain::Language::C);
|
|
|
|
|
ProjectExplorer::ToolChain *tcCxx
|
2016-07-12 16:27:45 +02:00
|
|
|
= ProjectExplorer::ToolChainKitInformation::toolChain(k, ProjectExplorer::ToolChain::Language::Cxx);
|
2016-07-15 22:21:49 -07:00
|
|
|
if (!tcC && !tcCxx)
|
2014-08-20 14:11:46 +02:00
|
|
|
return data;
|
|
|
|
|
|
2016-07-15 22:21:49 -07:00
|
|
|
ProjectExplorer::ToolChain *mainTc = tcCxx ? tcCxx : tcC;
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Abi targetAbi = mainTc->targetAbi();
|
2014-08-20 14:11:46 +02:00
|
|
|
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture) {
|
|
|
|
|
QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture());
|
|
|
|
|
|
|
|
|
|
// We have to be conservative tacking on suffixes to arch names because an arch that is
|
|
|
|
|
// already 64-bit may get an incorrect name as a result (i.e. Itanium)
|
|
|
|
|
if (targetAbi.wordWidth() == 64) {
|
|
|
|
|
switch (targetAbi.architecture()) {
|
|
|
|
|
case ProjectExplorer::Abi::X86Architecture:
|
2014-08-29 14:00:18 +02:00
|
|
|
architecture.append(QLatin1Char('_'));
|
2014-08-20 14:11:46 +02:00
|
|
|
// fall through
|
|
|
|
|
case ProjectExplorer::Abi::ArmArchitecture:
|
|
|
|
|
case ProjectExplorer::Abi::MipsArchitecture:
|
|
|
|
|
case ProjectExplorer::Abi::PowerPCArchitecture:
|
|
|
|
|
architecture.append(QString::number(targetAbi.wordWidth()));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2014-07-21 02:28:34 -04:00
|
|
|
}
|
2015-07-29 14:42:52 -07:00
|
|
|
} else if (targetAbi.architecture() == ProjectExplorer::Abi::ArmArchitecture &&
|
2016-07-25 18:39:16 -07:00
|
|
|
targetAbi.os() == ProjectExplorer::Abi::DarwinOS) {
|
2015-07-29 14:42:52 -07:00
|
|
|
architecture.append(QLatin1String("v7"));
|
2014-08-20 14:11:46 +02:00
|
|
|
}
|
|
|
|
|
|
2014-10-14 15:36:16 +02:00
|
|
|
data.insert(QLatin1String(QBS_ARCHITECTURE), qbs::canonicalArchitecture(architecture));
|
2014-08-20 14:11:46 +02:00
|
|
|
}
|
2014-07-21 02:28:34 -04:00
|
|
|
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
QStringList targetOS = targetOSList(targetAbi, k);
|
|
|
|
|
if (!targetOS.isEmpty())
|
2014-08-20 14:11:46 +02:00
|
|
|
data.insert(QLatin1String(QBS_TARGETOS), targetOS);
|
2013-07-11 17:14:24 +02:00
|
|
|
|
2016-07-15 22:21:49 -07:00
|
|
|
QStringList toolchain = toolchainList(mainTc);
|
Qbs: refactor property provider.
Set toolchain list centrally.
Set target OS for additional operating systems: WinRT, Windows CE,
Android, FreeBSD, NetBSD, OpenBSD, BSD (generic), BlackBerry, QNX,
and Solaris.
No more "else assumptions" which would for example detect Clang on
Windows as MSVC, any non-Clang toolchains as GCC, or any unrecognized
operating systems as Unix.
bsd4 is gone as it is not necessary in any practical sense (and no other
operating systems have different identifiers by version -- there is a
dedicated hostOSVersion property anyways).
Detect iOS without relying on Qt.
Change-Id: I38e2adf188d4604182ec84003dc5d281fce025cc
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2014-09-28 14:43:54 -04:00
|
|
|
if (!toolchain.isEmpty())
|
|
|
|
|
data.insert(QLatin1String(QBS_TOOLCHAIN), toolchain);
|
2014-07-21 02:55:43 -04:00
|
|
|
|
2016-07-25 18:39:16 -07:00
|
|
|
if (targetAbi.os() == ProjectExplorer::Abi::DarwinOS) {
|
2014-08-20 14:11:46 +02:00
|
|
|
// Set Xcode SDK name and version - required by Qbs if a sysroot is present
|
|
|
|
|
// Ideally this would be done in a better way...
|
2014-09-28 16:44:43 -04:00
|
|
|
const QRegExp sdkNameRe(QLatin1String("(macosx|iphoneos|iphonesimulator)([0-9]+\\.[0-9]+)"));
|
|
|
|
|
const QRegExp sdkVersionRe(QLatin1String("([0-9]+\\.[0-9]+)"));
|
|
|
|
|
QDir sysrootdir(sysroot);
|
|
|
|
|
const QSettings sdkSettings(sysrootdir.absoluteFilePath(QLatin1String("SDKSettings.plist")), QSettings::NativeFormat);
|
|
|
|
|
const QString sdkName(sdkSettings.value(QLatin1String("CanonicalName")).toString());
|
|
|
|
|
const QString sdkVersion(sdkSettings.value(QLatin1String("Version")).toString());
|
|
|
|
|
if (sdkNameRe.exactMatch(sdkName) && sdkVersionRe.exactMatch(sdkVersion)) {
|
|
|
|
|
for (int i = 3; i > 0; --i)
|
|
|
|
|
sysrootdir.cdUp();
|
|
|
|
|
data.insert(QLatin1String(CPP_PLATFORMPATH), sysrootdir.absolutePath());
|
|
|
|
|
data.insert(QLatin1String(CPP_XCODESDKNAME), sdkName);
|
|
|
|
|
data.insert(QLatin1String(CPP_XCODESDKVERSION), sdkVersion);
|
2013-07-11 17:14:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
2014-08-20 14:11:46 +02:00
|
|
|
|
2016-07-15 22:21:49 -07:00
|
|
|
Utils::FileName cCompilerPath;
|
|
|
|
|
if (tcC)
|
|
|
|
|
cCompilerPath = tcC->compilerCommand();
|
|
|
|
|
|
|
|
|
|
Utils::FileName cxxCompilerPath;
|
|
|
|
|
if (tcCxx)
|
|
|
|
|
cxxCompilerPath = tcCxx->compilerCommand();
|
|
|
|
|
|
|
|
|
|
const QFileInfo cFileInfo = cCompilerPath.toFileInfo();
|
|
|
|
|
const QFileInfo cxxFileInfo = cxxCompilerPath.toFileInfo();
|
|
|
|
|
QString cCompilerName = cFileInfo.fileName();
|
|
|
|
|
QString cxxCompilerName = cxxFileInfo.fileName();
|
|
|
|
|
const QString cToolchainPrefix = extractToolchainPrefix(&cCompilerName);
|
2016-09-28 08:31:21 +02:00
|
|
|
const QString cxxToolchainPrefix = extractToolchainPrefix(&cxxCompilerName);
|
2016-07-15 22:21:49 -07:00
|
|
|
|
|
|
|
|
QFileInfo mainFileInfo;
|
|
|
|
|
QString mainCompilerName;
|
|
|
|
|
QString mainToolchainPrefix;
|
|
|
|
|
if (tcCxx) {
|
|
|
|
|
mainFileInfo = cxxFileInfo;
|
|
|
|
|
mainCompilerName = cxxCompilerName;
|
|
|
|
|
mainToolchainPrefix = cxxToolchainPrefix;
|
|
|
|
|
} else {
|
|
|
|
|
mainFileInfo = cFileInfo;
|
|
|
|
|
mainCompilerName = cCompilerName;
|
|
|
|
|
mainToolchainPrefix = cToolchainPrefix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!mainToolchainPrefix.isEmpty())
|
|
|
|
|
data.insert(QLatin1String(CPP_TOOLCHAINPREFIX), mainToolchainPrefix);
|
|
|
|
|
|
2016-05-17 14:40:46 +02:00
|
|
|
if (toolchain.contains(QLatin1String("msvc"))) {
|
2016-07-15 22:21:49 -07:00
|
|
|
data.insert(QLatin1String(CPP_COMPILERNAME), mainCompilerName);
|
2016-05-17 14:40:46 +02:00
|
|
|
} else {
|
2016-07-15 22:21:49 -07:00
|
|
|
data.insert(QLatin1String(CPP_COMPILERNAME), cCompilerName);
|
|
|
|
|
data.insert(QLatin1String(CPP_CXXCOMPILERNAME), cxxCompilerName);
|
2016-05-17 14:40:46 +02:00
|
|
|
}
|
2016-07-15 22:21:49 -07:00
|
|
|
|
|
|
|
|
if (tcC && tcCxx && cFileInfo.absolutePath() != cxxFileInfo.absolutePath()) {
|
|
|
|
|
Core::MessageManager::write(tr("C and C++ compiler paths differ. C compiler may not work."),
|
|
|
|
|
Core::MessageManager::ModeSwitch);
|
2014-08-20 14:11:46 +02:00
|
|
|
}
|
2016-07-15 22:21:49 -07:00
|
|
|
data.insert(QLatin1String(CPP_TOOLCHAINPATH), mainFileInfo.absolutePath());
|
2015-02-24 11:33:57 +01:00
|
|
|
|
2016-07-15 22:21:49 -07:00
|
|
|
if (ProjectExplorer::GccToolChain *gcc = dynamic_cast<ProjectExplorer::GccToolChain *>(mainTc)) {
|
2016-05-13 23:22:12 -07:00
|
|
|
data.insert(QLatin1String(CPP_PLATFORMCOMMONCOMPILERFLAGS), gcc->platformCodeGenFlags());
|
|
|
|
|
data.insert(QLatin1String(CPP_PLATFORMLINKERFLAGS), gcc->platformLinkerFlags());
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-11 17:14:24 +02:00
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-24 17:38:22 +01:00
|
|
|
} // namespace Internal
|
2013-07-11 17:14:24 +02:00
|
|
|
} // namespace QbsProjectManager
|