forked from qt-creator/qt-creator
		
	Make QNX a separate OS type
Limits conflicts with Linux tool chains and debuggers. Change-Id: Ie6408aecbc2828e8be53c46cf579441ccaba19bb Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
		@@ -100,7 +100,13 @@ DebuggerItem::DebuggerItem(const QVariantMap &data)
 | 
			
		||||
            m_abis.append(abi);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_version.isEmpty())
 | 
			
		||||
    bool mightBeAPreQnxSeparateOSQnxDebugger = m_command.fileName().startsWith("nto")
 | 
			
		||||
            && m_abis.count() == 1
 | 
			
		||||
            && m_abis[0].os() == Abi::UnknownOS
 | 
			
		||||
            && m_abis[0].osFlavor() == Abi::UnknownFlavor
 | 
			
		||||
            && m_abis[0].binaryFormat() == Abi::UnknownFormat;
 | 
			
		||||
 | 
			
		||||
    if (m_version.isEmpty() || mightBeAPreQnxSeparateOSQnxDebugger)
 | 
			
		||||
        reinitializeFromFile();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -347,6 +347,9 @@ Abi::Abi(const Architecture &a, const OS &o,
 | 
			
		||||
    case Abi::VxWorks:
 | 
			
		||||
        if (m_osFlavor != VxWorksFlavor)
 | 
			
		||||
            m_osFlavor = VxWorksFlavor;
 | 
			
		||||
    case Abi::QnxOS:
 | 
			
		||||
        if (m_osFlavor != GenericQnxFlavor)
 | 
			
		||||
            m_osFlavor = UnknownFlavor;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -392,6 +395,8 @@ Abi::Abi(const QString &abiString) :
 | 
			
		||||
            m_os = WindowsOS;
 | 
			
		||||
        else if (abiParts.at(1) == QLatin1String("vxworks"))
 | 
			
		||||
            m_os = VxWorks;
 | 
			
		||||
        else if (abiParts.at(1) == QLatin1String("qnx"))
 | 
			
		||||
            m_os = QnxOS;
 | 
			
		||||
        else
 | 
			
		||||
            return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -403,6 +408,8 @@ Abi::Abi(const QString &abiString) :
 | 
			
		||||
            m_osFlavor = GenericLinuxFlavor;
 | 
			
		||||
        else if (abiParts.at(2) == QLatin1String("android") && m_os == LinuxOS)
 | 
			
		||||
            m_osFlavor = AndroidLinuxFlavor;
 | 
			
		||||
        else if (abiParts.at(2) == QLatin1String("generic") && m_os == QnxOS)
 | 
			
		||||
            m_osFlavor = GenericQnxFlavor;
 | 
			
		||||
        else if (abiParts.at(2) == QLatin1String("freebsd") && m_os == BsdOS)
 | 
			
		||||
            m_osFlavor = FreeBsdFlavor;
 | 
			
		||||
        else if (abiParts.at(2) == QLatin1String("netbsd") && m_os == BsdOS)
 | 
			
		||||
@@ -556,6 +563,10 @@ Abi Abi::abiFromTargetTriplet(const QString &triple)
 | 
			
		||||
            os = Abi::VxWorks;
 | 
			
		||||
            flavor = Abi::VxWorksFlavor;
 | 
			
		||||
            format = Abi::ElfFormat;
 | 
			
		||||
        } else if (p.startsWith(QLatin1String("qnx"))) {
 | 
			
		||||
            os = Abi::QnxOS;
 | 
			
		||||
            flavor = Abi::GenericQnxFlavor;
 | 
			
		||||
            format = Abi::ElfFormat;
 | 
			
		||||
        } else {
 | 
			
		||||
            ++unknownCount;
 | 
			
		||||
        }
 | 
			
		||||
@@ -667,6 +678,8 @@ QString Abi::toString(const OS &o)
 | 
			
		||||
        return QLatin1String("windows");
 | 
			
		||||
    case VxWorks:
 | 
			
		||||
        return QLatin1String("vxworks");
 | 
			
		||||
    case QnxOS:
 | 
			
		||||
        return QLatin1String("qnx");
 | 
			
		||||
    case UnknownOS: // fall through!
 | 
			
		||||
    default:
 | 
			
		||||
        return QLatin1String("unknown");
 | 
			
		||||
@@ -712,6 +725,8 @@ QString Abi::toString(const OSFlavor &of)
 | 
			
		||||
        return QLatin1String("ce");
 | 
			
		||||
    case Abi::VxWorksFlavor:
 | 
			
		||||
        return QLatin1String("vxworks");
 | 
			
		||||
    case Abi::GenericQnxFlavor:
 | 
			
		||||
        return QLatin1String("generic");
 | 
			
		||||
    case Abi::UnknownFlavor: // fall through!
 | 
			
		||||
    default:
 | 
			
		||||
        return QLatin1String("unknown");
 | 
			
		||||
@@ -761,6 +776,8 @@ QList<Abi::OSFlavor> Abi::flavorsForOs(const Abi::OS &o)
 | 
			
		||||
                      << WindowsMSysFlavor << WindowsCEFlavor << UnknownFlavor;
 | 
			
		||||
    case VxWorks:
 | 
			
		||||
        return result << VxWorksFlavor << UnknownFlavor;
 | 
			
		||||
    case QnxOS:
 | 
			
		||||
        return result << GenericQnxFlavor << UnknownFlavor;
 | 
			
		||||
    case UnknownOS:
 | 
			
		||||
        return result << UnknownFlavor;
 | 
			
		||||
    default:
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,7 @@ public:
 | 
			
		||||
        UnixOS,
 | 
			
		||||
        WindowsOS,
 | 
			
		||||
        VxWorks,
 | 
			
		||||
        QnxOS,
 | 
			
		||||
        UnknownOS
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@@ -91,6 +92,9 @@ public:
 | 
			
		||||
 | 
			
		||||
        VxWorksFlavor,
 | 
			
		||||
 | 
			
		||||
        // QNX
 | 
			
		||||
        GenericQnxFlavor,
 | 
			
		||||
 | 
			
		||||
        UnknownFlavor
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -139,7 +139,7 @@ void QnxQtVersion::fromMap(const QVariantMap &map)
 | 
			
		||||
QList<ProjectExplorer::Abi> QnxQtVersion::detectQtAbis() const
 | 
			
		||||
{
 | 
			
		||||
    ensureMkSpecParsed();
 | 
			
		||||
    return qtAbisFromLibrary(qtCorePaths());
 | 
			
		||||
    return QnxUtils::convertAbis(qtAbisFromLibrary(qtCorePaths()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QnxQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
 | 
			
		||||
 
 | 
			
		||||
@@ -155,6 +155,11 @@ bool QnxToolChain::fromMap(const QVariantMap &data)
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    m_sdpPath = data.value(QLatin1String(CompilerSdpPath)).toString();
 | 
			
		||||
 | 
			
		||||
    // Make the ABIs QNX specific (if they aren't already).
 | 
			
		||||
    setSupportedAbis(QnxUtils::convertAbis(supportedAbis()));
 | 
			
		||||
    setTargetAbi(QnxUtils::convertAbi(targetAbi()));
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@
 | 
			
		||||
#include "qnxutils.h"
 | 
			
		||||
#include "qnxqtversion.h"
 | 
			
		||||
 | 
			
		||||
#include <utils/algorithm.h>
 | 
			
		||||
#include <utils/fileutils.h>
 | 
			
		||||
#include <utils/hostosinfo.h>
 | 
			
		||||
#include <utils/synchronousprocess.h>
 | 
			
		||||
@@ -251,10 +252,28 @@ QList<QnxTarget> QnxUtils::findTargets(const Utils::FileName &basePath)
 | 
			
		||||
                qWarning() << libc << "has more than one ABI ... processing all";
 | 
			
		||||
 | 
			
		||||
            FileName path = FileName::fromString(iterator.filePath());
 | 
			
		||||
            for (auto abi : abis)
 | 
			
		||||
                result.append(QnxTarget(path, abi));
 | 
			
		||||
            for (Abi abi : abis)
 | 
			
		||||
                result.append(QnxTarget(path, QnxUtils::convertAbi(abi)));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Abi QnxUtils::convertAbi(const Abi &abi)
 | 
			
		||||
{
 | 
			
		||||
    if (abi.os() == Abi::LinuxOS && abi.osFlavor() == Abi::GenericLinuxFlavor) {
 | 
			
		||||
        return Abi(abi.architecture(),
 | 
			
		||||
                   Abi::QnxOS,
 | 
			
		||||
                   Abi::GenericQnxFlavor,
 | 
			
		||||
                   abi.binaryFormat(),
 | 
			
		||||
                   abi.wordWidth());
 | 
			
		||||
    } else {
 | 
			
		||||
        return abi;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QList<Abi> QnxUtils::convertAbis(const QList<Abi> &abis)
 | 
			
		||||
{
 | 
			
		||||
    return Utils::transform(abis, &QnxUtils::convertAbi);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,8 @@ public:
 | 
			
		||||
    static QList<ConfigInstallInformation> installedConfigs(const QString &configPath = QString());
 | 
			
		||||
    static QList<Utils::EnvironmentItem> qnxEnvironment(const QString &sdpPath);
 | 
			
		||||
    static QList<QnxTarget> findTargets(const Utils::FileName &basePath);
 | 
			
		||||
    static ProjectExplorer::Abi convertAbi(const ProjectExplorer::Abi &abi);
 | 
			
		||||
    static QList<ProjectExplorer::Abi> convertAbis(const QList<ProjectExplorer::Abi> &abis);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Internal
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user