diff options
Diffstat (limited to 'src/plugins/generator/keiluv')
66 files changed, 5415 insertions, 0 deletions
diff --git a/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.cpp new file mode 100644 index 000000000..c5cb5f040 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armbuildtargetgroup_v5.h" +#include "armcommonpropertygroup_v5.h" +#include "armdebugoptiongroup_v5.h" +#include "armdlloptiongroup_v5.h" +#include "armtargetcommonoptionsgroup_v5.h" +#include "armtargetgroup_v5.h" +#include "armutilitiesgroup_v5.h" + +#include "../../keiluvconstants.h" +#include "../../keiluvfilesgroupspropertygroup.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +ArmBuildTargetGroup::ArmBuildTargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps) + : gen::xml::PropertyGroup("Target") +{ + // Append target name item (it is a build configuration name). + const QString targetName = gen::utils::buildConfigurationName( + qbsProject); + appendProperty(QByteArrayLiteral("TargetName"), targetName); + // Append toolset number group item. + appendChild<gen::xml::Property>(QByteArrayLiteral("ToolsetNumber"), + QByteArrayLiteral("0x4")); + // Append toolset name group item. + appendChild<gen::xml::Property>(QByteArrayLiteral("ToolsetName"), + QByteArrayLiteral("ARM-ADS")); + + // Append target option group item. + const auto targetOptionGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("TargetOption")); + + targetOptionGroup->appendChild<ArmTargetCommonOptionsGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<ArmCommonPropertyGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<ArmDllOptionGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<ArmDebugOptionGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<ArmUtilitiesGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<ArmTargetGroup>( + qbsProject, qbsProduct); + + // Append files group. + appendChild<KeiluvFilesGroupsPropertyGroup>(qbsProject, qbsProduct, + qbsProductDeps); +} + +bool ArmBuildTargetGroupFactory::canCreate( + gen::utils::Architecture arch, + const Version &version) const +{ + return arch == gen::utils::Architecture::Arm + && version.majorVersion() == qbs::KeiluvConstants::v5::kUVisionVersion; +} + +std::unique_ptr<gen::xml::PropertyGroup> +ArmBuildTargetGroupFactory::create( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps) const +{ + const auto group = new ArmBuildTargetGroup( + qbsProject, qbsProduct, qbsProductDeps); + return std::unique_ptr<ArmBuildTargetGroup>(group); +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.h new file mode 100644 index 000000000..9b8d9fe26 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMBUILDTARGETGROUP_V5_H +#define QBS_KEILUVARMBUILDTARGETGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmBuildTargetGroup final : public gen::xml::PropertyGroup +{ +private: + explicit ArmBuildTargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps); + + friend class ArmBuildTargetGroupFactory; +}; + +class ArmBuildTargetGroupFactory final + : public gen::xml::PropertyGroupFactory +{ +public: + bool canCreate(gen::utils::Architecture arch, + const Version &version) const final; + + std::unique_ptr<gen::xml::PropertyGroup> create( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps) const final; +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMBUILDTARGETGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.cpp new file mode 100644 index 000000000..e7a738235 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armcommonpropertygroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +ArmCommonPropertyGroup::ArmCommonPropertyGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("CommonProperty") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.h new file mode 100644 index 000000000..4d45decc4 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMCOMMONPROPERTYGROUP_V5_H +#define QBS_KEILUVARMCOMMONPROPERTYGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmCommonPropertyGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmCommonPropertyGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_MCS51COMMONPROPERTYGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.cpp new file mode 100644 index 000000000..553df646d --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armdebugoptiongroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +ArmDebugOptionGroup::ArmDebugOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("DebugOption") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.h new file mode 100644 index 000000000..22d5bb88f --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMDEBUGOPTIONGROUP_V5_H +#define QBS_KEILUVARMDEBUGOPTIONGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmDebugOptionGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmDebugOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMDEBUGOPTIONGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.cpp new file mode 100644 index 000000000..9e1bdff02 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armdlloptiongroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +ArmDllOptionGroup::ArmDllOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("DllOption") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.h new file mode 100644 index 000000000..948eb1568 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMDLLOPTIONGROUP_V5_H +#define QBS_KEILUVARMDLLOPTIONGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmDllOptionGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmDllOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMDLLOPTIONGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.cpp new file mode 100644 index 000000000..424cb3353 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.cpp @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armtargetassemblergroup_v5.h" + +#include "../../keiluvutils.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +namespace { + +struct AssemblerPageOptions final +{ + explicit AssemblerPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleAssemblerFlags(qbsProps); + + // Read-only position independent. + enableRopi = flags.contains(QLatin1String("/ropi")); + // Read-write position independent. + enableRwpi = flags.contains(QLatin1String("/rwpi")); + // Enable thumb mode. + enableThumbMode = flags.contains(QLatin1String("--16")); + // Split load and store multiple. + splitLdm = flags.contains(QLatin1String("--split_ldm")); + // Generation code. + generateExecuteOnlyCode = flags.contains(QLatin1String("--execute_only")); + + // Warning levels. + const QString wLevel = gen::utils::cppStringModuleProperty( + qbsProps, QStringLiteral("warningLevel")); + disableWarnings = wLevel == QLatin1String("none"); + + // Define symbols. + defineSymbols = qbs::KeiluvUtils::defines(qbsProps); + // Include paths. + includePaths = qbs::KeiluvUtils::includes(qbsProps); + + // Interpret other compiler flags as a misc controls (exclude only + // that flags which are was already handled). + for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { + if (flagIt->contains(QLatin1String("/ropi")) + || flagIt->contains(QLatin1String("/rwpi")) + || flagIt->contains(QLatin1String("--16")) + || flagIt->contains(QLatin1String("--split_ldm")) + || flagIt->contains(QLatin1String("--execute_only")) + || flagIt->contains(QLatin1String("--nowarn")) + ) { + continue; + } + if (flagIt->startsWith(QLatin1String("-I")) + || flagIt->startsWith(QLatin1String("--cpu")) + || flagIt->startsWith(QLatin1String("--fpu")) + || flagIt->startsWith(QLatin1String("-pd")) + ) { + ++flagIt; + continue; + } + miscControls.push_back(*flagIt); + } + } + + int enableRopi = 0; + int enableRwpi = 0; + int enableThumbMode = 0; + int disableWarnings = 0; + int splitLdm = 0; + int generateExecuteOnlyCode = 0; + + QStringList defineSymbols; + QStringList includePaths; + QStringList miscControls; +}; + +} // namespace + +ArmTargetAssemblerGroup::ArmTargetAssemblerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Aads") +{ + const AssemblerPageOptions opts(qbsProject, qbsProduct); + + // Add 'ROPI' item. + appendProperty(QByteArrayLiteral("Ropi"), opts.enableRopi); + // Add 'RWPI' item. + appendProperty(QByteArrayLiteral("Rwpi"), opts.enableRwpi); + // Add 'Use thumb mode' item. + appendProperty(QByteArrayLiteral("thumb"), opts.enableThumbMode); + // Add 'Slpit LDM' item. + appendProperty(QByteArrayLiteral("SplitLS"), opts.splitLdm); + // Add 'Disable warnings' item. + appendProperty(QByteArrayLiteral("NoWarn"), opts.disableWarnings); + // Add 'Generate code exedutable only' item. + appendProperty(QByteArrayLiteral("useXo"), opts.generateExecuteOnlyCode); + + // Add other various controls. + // Note: A sub-items order makes sense! + const auto variousControlsGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("VariousControls")); + // Add 'Misc Controls' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("MiscControls"), + opts.miscControls, QLatin1Char(' ')); + // Add 'Define' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("Define"), opts.defineSymbols); + // Add an empty 'Undefine' item. + variousControlsGroup->appendProperty( + QByteArrayLiteral("Undefine"), {}); + // Add 'Include Paths' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("IncludePath"), + opts.includePaths, QLatin1Char(';')); +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.h new file mode 100644 index 000000000..d61b11fe5 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMTARGETASSEMBLERGROUP_V3 +#define QBS_KEILUVARMTARGETASSEMBLERGROUP_V3 + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmTargetAssemblerGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmTargetAssemblerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMTARGETASSEMBLERGROUP_V3 diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.cpp new file mode 100644 index 000000000..0ffbcaa5b --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.cpp @@ -0,0 +1,208 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armtargetcommonoptionsgroup_v5.h" + +#include "../../keiluvutils.h" + +#include <generators/generatorutils.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +namespace { + +static const struct DeviceEntry { + QByteArray cpu; // CPU option. + std::set<QByteArray> fpus; // FPU's options. + QByteArray device; // Project file entry. +} deviceDict[] = { + {"8-M.Base", {}, "ARMv8MBL"}, + {"8-M.Main", {"FPv5-SP"}, "ARMv8MML_SP"}, + {"8-M.Main", {"FPv5_D16"}, "ARMv8MML_DP"}, + {"8-M.Main", {"SoftVFP"},"ARMv8MML"}, + {"8-M.Main.dsp", {"FPv5-SP"}, "ARMv8MML_DSP_SP"}, + {"8-M.Main.dsp", {"FPv5_D16"}, "ARMv8MML_DSP_DP"}, + {"8-M.Main.dsp", {"SoftVFP"}, "ARMv8MML_DSP"}, + {"Cortex-M0", {}, "ARMCM0"}, + {"Cortex-M0+", {}, "ARMCM0P"}, + {"Cortex-M0plus", {}, "ARMCM0P"}, + {"Cortex-M23", {}, "ARMCM23"}, // same as ARMCM23_TZ + {"Cortex-M3", {}, "ARMCM3"}, + {"Cortex-M4", {}, "ARMCM4"}, + {"Cortex-M4.fp", {}, "ARMCM4_FP"}, + {"Cortex-M7", {"SoftVFP"}, "ARMCM7"}, + {"Cortex-M7.fp.dp", {}, "ARMCM7_DP"}, + {"Cortex-M7.fp.sp", {}, "ARMCM7_SP"}, + {"SC000", {}, "ARMSC000"}, + {"SC300", {}, "ARMSC300"}, + {"Cortex-M33.no_dsp", {"SoftVFP"}, "ARMCM33"}, // same as ARMCM33_TZ + {"Cortex-M33", {"FPv5-SP", "softvfp+vfpv2"}, "ARMCM33_DSP_FP"}, // same as ARMCM33_DSP_FP_TZ +}; + +struct CommonPageOptions final +{ + explicit CommonPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = KeiluvUtils::cppModuleCompilerFlags(qbsProps); + + // Browse information. + // ??? + + // Debug information. + debugInfo = gen::utils::debugInformation(qbsProduct); + + // Output parameters. + executableName = gen::utils::targetBinary(qbsProduct); + // Fix output binary name if it is a library. Because + // the IDE appends an additional suffix (.LIB) to end + // of an output library name. + if (executableName.endsWith(QLatin1String(".lib"))) + executableName = qbsProduct.targetName(); + + const QString baseDirectory = gen::utils::buildRootPath(qbsProject); + objectDirectory = QDir::toNativeSeparators( + gen::utils::objectsOutputDirectory( + baseDirectory, qbsProduct)); + listingDirectory = QDir::toNativeSeparators( + gen::utils::listingOutputDirectory( + baseDirectory, qbsProduct)); + + // Target type. + targetType = KeiluvUtils::outputBinaryType(qbsProduct); + + // Detect the device name from the command line options + // (like --cpu and --fpu). + const auto cpu = gen::utils::firstFlagValue( + flags, QStringLiteral("--cpu")).toLatin1(); + const auto fpus = gen::utils::allFlagValues( + flags, QStringLiteral("--fpu")); + + for (const auto &deviceEntry : deviceDict) { + // Since Qt 5.12 we can use QByteArray::compare(..., Qt::CaseInsensitive) + // instead. + if (cpu.toLower() != deviceEntry.cpu.toLower()) + continue; + + size_t fpuMatches = 0; + const auto dictFpuBegin = std::cbegin(deviceDict->fpus); + const auto dictFpuEnd = std::cend(deviceDict->fpus); + for (const auto &fpu : fpus) { + const auto dictFpuIt = std::find_if( + dictFpuBegin, dictFpuEnd, + [fpu](const QByteArray &dictFpu) { + return fpu.compare(QString::fromLatin1(dictFpu), + Qt::CaseInsensitive) == 0; + }); + if (dictFpuIt != dictFpuEnd) + ++fpuMatches; + } + + if (fpuMatches < deviceEntry.fpus.size()) + continue; + + deviceName = QString::fromLatin1(deviceEntry.device); + cpuType = QString::fromLatin1(deviceEntry.cpu); + break; + } + } + + int debugInfo = false; + int browseInfo = false; + QString deviceName; + QString cpuType; + QString executableName; + QString objectDirectory; + QString listingDirectory; + KeiluvUtils::OutputBinaryType targetType = + KeiluvUtils::ApplicationOutputType; +}; + +} // namespace + +ArmTargetCommonOptionsGroup::ArmTargetCommonOptionsGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("TargetCommonOption") +{ + const CommonPageOptions opts(qbsProject, qbsProduct); + + // Fill device items. + appendProperty(QByteArrayLiteral("Device"), + opts.deviceName); + appendProperty(QByteArrayLiteral("Vendor"), + QByteArrayLiteral("ARM")); + appendProperty(QByteArrayLiteral("PackID"), + QByteArrayLiteral("ARM.CMSIS.5.6.0")); + appendProperty(QByteArrayLiteral("PackURL"), + QByteArrayLiteral("http://www.keil.com/pack/")); + + const auto cpuType = QStringLiteral("CPUTYPE(\"%1\")") + .arg(opts.cpuType); + appendProperty(QByteArrayLiteral("Cpu"), cpuType); + + // Add 'Debug Information' item. + appendProperty(QByteArrayLiteral("DebugInformation"), + opts.debugInfo); + // Add 'Browse Information' item. + appendProperty(QByteArrayLiteral("BrowseInformation"), + opts.browseInfo); + + // Add 'Name of Executable'. + appendProperty(QByteArrayLiteral("OutputName"), + opts.executableName); + // Add 'Output objects directory'. + appendProperty(QByteArrayLiteral("OutputDirectory"), + opts.objectDirectory); + // Add 'Output listing directory'. + appendProperty(QByteArrayLiteral("ListingPath"), + opts.listingDirectory); + + // Add 'Create Executable/Library' item. + const int isExecutable = (opts.targetType + == KeiluvUtils::ApplicationOutputType); + const int isLibrary = (opts.targetType + == KeiluvUtils::LibraryOutputType); + appendProperty(QByteArrayLiteral("CreateExecutable"), + isExecutable); + appendProperty(QByteArrayLiteral("CreateLib"), + isLibrary); +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.h new file mode 100644 index 000000000..b7d4ffee2 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMTARGETCOMMONOPTIONSGROUP_V5_H +#define QBS_KEILUVARMTARGETCOMMONOPTIONSGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmTargetCommonOptionsGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmTargetCommonOptionsGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMTARGETCOMMONOPTIONSGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.cpp new file mode 100644 index 000000000..c923bd9b9 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.cpp @@ -0,0 +1,218 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armtargetcompilergroup_v5.h" + +#include "../../keiluvutils.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +namespace { + +struct CompilerPageOptions final +{ + enum WarningLevel { + WarningLevelUnspecified = 0, + WarningLevelNone, + WarningLevelAll + }; + + enum OptimizationLevel { + OptimizationLevelUnspecified = 0, + OptimizationLevelNone, + OptimizationLevelOne, + OptimizationLevelTwo, + OptimizationLevelThree, + }; + + explicit CompilerPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); + + // Warning levels. + const QString wLevel = gen::utils::cppStringModuleProperty( + qbsProps, QStringLiteral("warningLevel")); + if (wLevel == QLatin1String("none")) + warningLevel = WarningLevelNone; + else if (wLevel == QLatin1String("all")) + warningLevel = WarningLevelAll; + else + warningLevel = WarningLevelUnspecified; + + // Generation code. + generateExecuteOnlyCode = flags.contains(QLatin1String("--execute_only")); + + // Optimization levels. + const QString oLevel = gen::utils::cppStringModuleProperty( + qbsProps, QStringLiteral("optimization")); + if (oLevel == QLatin1String("fast")) + enableTimeOptimization = 1; + else if (oLevel == QLatin1String("small")) + optimizationLevel = OptimizationLevelThree; + else if (oLevel == QLatin1String("none")) + optimizationLevel = OptimizationLevelNone; + + // Split load and store multiple. + splitLdm = flags.contains(QLatin1String("--split_ldm")); + // One ELF section per function. + splitSections = flags.contains(QLatin1String("--split_sections")); + // String ANSI C. + useStrictAnsiC = flags.contains(QLatin1String("--strict")); + // Enum container always int. + forceEnumAsInt = flags.contains(QLatin1String("--enum_is_int")); + // Plain char is signed. + useSignedChar = flags.contains(QLatin1String("--signed_chars")); + // Read-only position independent. + enableRopi = flags.contains(QLatin1String("/ropi")); + // Read-write position independent. + enableRwpi = flags.contains(QLatin1String("/rwpi")); + + // C-language version. + const QString clVersion = gen::utils::cppStringModuleProperty( + qbsProps, QStringLiteral("cLanguageVersion")); + // C99 mode. + useC99Language = clVersion.contains(QLatin1String("c99")); + + // Define symbols. + defineSymbols = qbs::KeiluvUtils::defines(qbsProps); + // Include paths. + includePaths = qbs::KeiluvUtils::includes(qbsProps); + + // Interpret other compiler flags as a misc controls (exclude only + // that flags which are was already handled). + for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { + if (flagIt->contains(QLatin1String("--execute_only")) + || flagIt->contains(QLatin1String("--split_ldm")) + || flagIt->contains(QLatin1String("--split_sections")) + || flagIt->contains(QLatin1String("--strict")) + || flagIt->contains(QLatin1String("--enum_is_int")) + || flagIt->contains(QLatin1String("--signed_chars")) + || flagIt->contains(QLatin1String("/ropi")) + || flagIt->contains(QLatin1String("/rwpi")) + || flagIt->contains(QLatin1String("--c99")) + ) { + continue; + } + if (flagIt->startsWith(QLatin1String("-O")) + || flagIt->startsWith(QLatin1String("-W")) + || flagIt->startsWith(QLatin1String("-D")) + || flagIt->startsWith(QLatin1String("-I")) + || flagIt->startsWith(QLatin1String("--cpu")) + || flagIt->startsWith(QLatin1String("--fpu")) + ) { + ++flagIt; + continue; + } + miscControls.push_back(*flagIt); + } + } + + WarningLevel warningLevel = WarningLevelAll; + OptimizationLevel optimizationLevel = OptimizationLevelUnspecified; + int enableTimeOptimization = 0; + int generateExecuteOnlyCode = 0; + int splitLdm = 0; + int splitSections = 0; + int useStrictAnsiC = 0; + int forceEnumAsInt = 0; + int useSignedChar = 0; + int enableRopi = 0; + int enableRwpi = 0; + int useC99Language = 0; + + QStringList defineSymbols; + QStringList includePaths; + QStringList miscControls; +}; + +} // namespace + +ArmTargetCompilerGroup::ArmTargetCompilerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Cads") +{ + const CompilerPageOptions opts(qbsProject, qbsProduct); + + // Add 'Code Optimization' items. + appendProperty(QByteArrayLiteral("Optim"), opts.optimizationLevel); + appendProperty(QByteArrayLiteral("oTime"), opts.enableTimeOptimization); + // Add 'Slpit LDM' item. + appendProperty(QByteArrayLiteral("SplitLS"), opts.splitLdm); + // Add 'Slpit sections' item. + appendProperty(QByteArrayLiteral("OneElfS"), opts.splitSections); + // Add 'Strict ANSI C' item. + appendProperty(QByteArrayLiteral("Strict"), opts.useStrictAnsiC); + // Add 'Enums as int' item. + appendProperty(QByteArrayLiteral("EnumInt"), opts.forceEnumAsInt); + // Add 'Plain char as signed' item. + appendProperty(QByteArrayLiteral("PlainCh"), opts.useSignedChar); + // Add 'ROPI' item. + appendProperty(QByteArrayLiteral("Ropi"), opts.enableRopi); + // Add 'RWPI' item. + appendProperty(QByteArrayLiteral("Rwpi"), opts.enableRwpi); + // Add 'Warnings' item. + appendProperty(QByteArrayLiteral("wLevel"), opts.warningLevel); + // Add 'Use C99' item. + appendProperty(QByteArrayLiteral("uC99"), opts.useC99Language); + // Add 'Generate code exedutable only' item. + appendProperty(QByteArrayLiteral("useXo"), opts.generateExecuteOnlyCode); + + // Add other various controls. + // Note: A sub-items order makes sense! + const auto variousControlsGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("VariousControls")); + // Add 'Misc Controls' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("MiscControls"), + opts.miscControls, QLatin1Char(' ')); + // Add 'Define' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("Define"), opts.defineSymbols); + // Add an empty 'Undefine' item. + variousControlsGroup->appendProperty( + QByteArrayLiteral("Undefine"), {}); + // Add 'Include Paths' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("IncludePath"), + opts.includePaths, QLatin1Char(';')); +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.h new file mode 100644 index 000000000..89759ee0b --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMTARGETCOMPILERGROUP_V5_H +#define QBS_KEILUVARMTARGETCOMPILERGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmTargetCompilerGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmTargetCompilerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMTARGETCOMPILERGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.cpp new file mode 100644 index 000000000..61c7b5667 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armtargetassemblergroup_v5.h" +#include "armtargetcompilergroup_v5.h" +#include "armtargetgroup_v5.h" +#include "armtargetlinkergroup_v5.h" +#include "armtargetmiscgroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +ArmTargetGroup::ArmTargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("TargetArmAds") +{ + appendChild<ArmTargetMiscGroup>(qbsProject, qbsProduct); + appendChild<ArmTargetCompilerGroup>(qbsProject, qbsProduct); + appendChild<ArmTargetAssemblerGroup>(qbsProject, qbsProduct); + appendChild<ArmTargetLinkerGroup>(qbsProject, qbsProduct); +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.h new file mode 100644 index 000000000..7472fe675 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMTARGETGROUP_V5_H +#define QBS_KEILUVARMTARGETGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmTargetGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmTargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMTARGETGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.cpp new file mode 100644 index 000000000..930aae020 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.cpp @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armtargetlinkergroup_v5.h" + +#include "../../keiluvutils.h" + +#include <generators/generatorutils.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +namespace { + +struct LinkerPageOptions final +{ + explicit LinkerPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleLinkerFlags(qbsProps); + + // Read-only position independent. + enableRopi = flags.contains(QLatin1String("--ropi")); + // Read-write position independent. + enableRwpi = flags.contains(QLatin1String("--rwpi")); + // Don't search standard libraries. + dontSearchLibs = flags.contains(QLatin1String("--noscanlib")); + // Report 'might fail' conditions as errors. + enableReportMightFail = flags.contains(QLatin1String("--strict")); + + QStringList scatterFiles; + + // Enumerate all product linker config files + // (which are set trough 'linkerscript' tag). + const auto qbsGroups = qbsProduct.groups(); + for (const auto &qbsGroup : qbsGroups) { + if (!qbsGroup.isEnabled()) + continue; + const auto qbsArtifacts = qbsGroup.sourceArtifacts(); + for (const auto &qbsArtifact : qbsArtifacts) { + const auto qbsTags = qbsArtifact.fileTags(); + if (!qbsTags.contains(QLatin1String("linkerscript"))) + continue; + const QString scatterFile = QFileInfo(qbsArtifact.filePath()) + .absoluteFilePath(); + scatterFiles.push_back(scatterFile); + } + } + + // Enumerate all scatter files + // (which are set trough '--scatter' option). + const QStringList scatters = gen::utils::allFlagValues( + flags, QStringLiteral("--scatter")); + for (const auto &scatter : scatters) { + const QString scatterFile = QFileInfo(scatter) + .absoluteFilePath(); + if (!scatterFiles.contains(scatterFile)) + scatterFiles.push_back(scatterFile); + } + + // Transform all paths to relative. + const QString baseDirectory = qbs::gen::utils::buildRootPath(qbsProject); + std::transform(scatterFiles.begin(), scatterFiles.end(), + std::back_inserter(scatterFiles), + [baseDirectory](const QString &scatterFile) { + return gen::utils::relativeFilePath(baseDirectory, scatterFile); + }); + + // Make a first scatter file as a main scatter file. + // Other scatter files will be interpretes as a misc controls. + if (scatterFiles.count() > 0) + mainScatterFile = scatterFiles.takeFirst(); + + for (const auto &scatterFile : qAsConst(scatterFiles)) { + const auto control = QStringLiteral("--scatter %1").arg(scatterFile); + miscControls.push_back(control); + } + + // Interpret other compiler flags as a misc controls (exclude only + // that flags which are was already handled). + for (auto flagIt = flags.cbegin(); flagIt < flags.cend(); ++flagIt) { + if (flagIt->contains(QLatin1String("--ropi")) + || flagIt->contains(QLatin1String("--rwpi")) + || flagIt->contains(QLatin1String("--noscanlib")) + || flagIt->contains(QLatin1String("--strict")) + ) { + continue; + } + if (flagIt->startsWith(QLatin1String("--scatter")) + ) { + ++flagIt; + continue; + } + miscControls.push_back(*flagIt); + } + } + + int enableRopi = 0; + int enableRwpi = 0; + int dontSearchLibs = 0; + int enableReportMightFail = 0; + + QString mainScatterFile; + QStringList miscControls; +}; + +} // namespace + +ArmTargetLinkerGroup::ArmTargetLinkerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("LDads") +{ + const LinkerPageOptions opts(qbsProject, qbsProduct); + + // Add 'ROPI' item. + appendProperty(QByteArrayLiteral("Ropi"), opts.enableRopi); + // Add 'RWPI' item. + appendProperty(QByteArrayLiteral("Rwpi"), opts.enableRwpi); + // Add 'Don't search standard libraries' item. + appendProperty(QByteArrayLiteral("noStLib"), opts.dontSearchLibs); + // Add 'Report might fail' item. + appendProperty(QByteArrayLiteral("RepFail"), opts.enableReportMightFail); + // Add 'Scatter file' item. + appendProperty(QByteArrayLiteral("ScatterFile"), + QDir::toNativeSeparators(opts.mainScatterFile)); +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.h new file mode 100644 index 000000000..db82d4bc2 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMTARGETLINKERGROUP_V5_H +#define QBS_KEILUVARMTARGETLINKERGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmTargetLinkerGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmTargetLinkerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMTARGETLINKERGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp new file mode 100644 index 000000000..18da47c84 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armtargetmiscgroup_v5.h" + +#include "../../keiluvutils.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +namespace { + +struct MiscPageOptions final +{ + explicit MiscPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); + + generateLinkerMap = gen::utils::cppBooleanModuleProperty( + qbsProps, QStringLiteral("generateLinkerMapFile")); + } + + int generateLinkerMap = 0; +}; + +} // namespace + +ArmTargetMiscGroup::ArmTargetMiscGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("ArmAdsMisc") +{ + const MiscPageOptions opts(qbsProject, qbsProduct); + + // Add 'Generate linker map file' item. + appendProperty(QByteArrayLiteral("AdsLLst"), opts.generateLinkerMap); +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.h new file mode 100644 index 000000000..025b2796d --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMTARGETMISCGROUP_V5_H +#define QBS_KEILUVARMTARGETMISCGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmTargetMiscGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmTargetMiscGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMTARGETMISCGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.cpp b/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.cpp new file mode 100644 index 000000000..eab3cc56c --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "armutilitiesgroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +ArmUtilitiesGroup::ArmUtilitiesGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Utilities") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.h b/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.h new file mode 100644 index 000000000..a34a3a395 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVARMUTILITIESGROUP_V5_H +#define QBS_KEILUVARMUTILITIESGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace arm { +namespace v5 { + +class ArmUtilitiesGroup final : public gen::xml::PropertyGroup +{ +public: + explicit ArmUtilitiesGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace arm +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVARMUTILITIESGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.cpp new file mode 100644 index 000000000..87b3100db --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51buildtargetgroup_v5.h" +#include "mcs51commonpropertygroup_v5.h" +#include "mcs51debugoptiongroup_v5.h" +#include "mcs51dlloptiongroup_v5.h" +#include "mcs51targetcommonoptionsgroup_v5.h" +#include "mcs51targetgroup_v5.h" +#include "mcs51utilitiesgroup_v5.h" +#include "mcs51utils.h" + +#include "../../keiluvconstants.h" +#include "../../keiluvfilesgroupspropertygroup.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +Mcs51BuildTargetGroup::Mcs51BuildTargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps) + : gen::xml::PropertyGroup("Target") +{ + // Append target name item (it is a build configuration name). + const QString targetName = gen::utils::buildConfigurationName( + qbsProject); + appendProperty(QByteArrayLiteral("TargetName"), targetName); + // Append toolset number group item. + appendChild<gen::xml::Property>(QByteArrayLiteral("ToolsetNumber"), + QByteArrayLiteral("0x0")); + // Append toolset name group item. + appendChild<gen::xml::Property>(QByteArrayLiteral("ToolsetName"), + QByteArrayLiteral("MCS-51")); + + // Append target option group item. + const auto targetOptionGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("TargetOption")); + + targetOptionGroup->appendChild<Mcs51TargetCommonOptionsGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<Mcs51CommonPropertyGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<Mcs51DllOptionGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<Mcs51DebugOptionGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<Mcs51UtilitiesGroup>( + qbsProject, qbsProduct); + targetOptionGroup->appendChild<Mcs51TargetGroup>( + qbsProject, qbsProduct); + + // Append files group. + appendChild<KeiluvFilesGroupsPropertyGroup>(qbsProject, qbsProduct, + qbsProductDeps); +} + +bool Mcs51BuildTargetGroupFactory::canCreate( + gen::utils::Architecture arch, + const Version &version) const +{ + return arch == gen::utils::Architecture::Mcs51 + && version.majorVersion() == qbs::KeiluvConstants::v5::kUVisionVersion; +} + +std::unique_ptr<gen::xml::PropertyGroup> +Mcs51BuildTargetGroupFactory::create( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps) const +{ + const auto group = new Mcs51BuildTargetGroup( + qbsProject, qbsProduct, qbsProductDeps); + return std::unique_ptr<Mcs51BuildTargetGroup>(group); +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.h new file mode 100644 index 000000000..ef0c0ccba --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51BUILDTARGETGROUP_V5_H +#define QBS_KEILUVMCS51BUILDTARGETGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51BuildTargetGroup final : public gen::xml::PropertyGroup +{ +private: + explicit Mcs51BuildTargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps); + + friend class Mcs51BuildTargetGroupFactory; +}; + +class Mcs51BuildTargetGroupFactory final + : public gen::xml::PropertyGroupFactory +{ +public: + bool canCreate(gen::utils::Architecture arch, + const Version &version) const final; + + std::unique_ptr<gen::xml::PropertyGroup> create( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps) const final; +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51BUILDTARGETGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.cpp new file mode 100644 index 000000000..3d4d33046 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51commonpropertygroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +Mcs51CommonPropertyGroup::Mcs51CommonPropertyGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("CommonProperty") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.h new file mode 100644 index 000000000..66dfc7a3e --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51COMMONPROPERTYGROUP_V5_H +#define QBS_KEILUVMCS51COMMONPROPERTYGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51CommonPropertyGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51CommonPropertyGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_MCS51COMMONPROPERTYGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.cpp new file mode 100644 index 000000000..2175cc488 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51debugoptiongroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +Mcs51DebugOptionGroup::Mcs51DebugOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("DebugOption") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.h new file mode 100644 index 000000000..473cf605c --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51DEBUGOPTIONGROUP_V5_H +#define QBS_KEILUVMCS51DEBUGOPTIONGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51DebugOptionGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51DebugOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51DEBUGOPTIONGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.cpp new file mode 100644 index 000000000..59aec721d --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51dlloptiongroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +Mcs51DllOptionGroup::Mcs51DllOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("DllOption") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.h new file mode 100644 index 000000000..e16833acc --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51DLLOPTIONGROUP_V5_H +#define QBS_KEILUVMCS51DLLOPTIONGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51DllOptionGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51DllOptionGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51DLLOPTIONGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.cpp new file mode 100644 index 000000000..8d7257713 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51targetassemblergroup_v5.h" +#include "mcs51utils.h" + +#include "../../keiluvutils.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +namespace { + +struct AssemblerPageOptions final +{ + explicit AssemblerPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleAssemblerFlags(qbsProps); + + // Don't use standard macro. + if (flags.contains(QLatin1String("NOMACRO"), Qt::CaseInsensitive)) + useStandardMacroProcessor = false; + + // Use MPL. + if (flags.contains(QLatin1String("MPL"), Qt::CaseInsensitive)) + useMacroProcessingLanguage = true; + + // Define 8051 SFR names. + if (flags.contains(QLatin1String("NOMOD51"), Qt::CaseInsensitive)) + suppressSfrNames = true; + + // Define symbols. + defineSymbols = qbs::KeiluvUtils::defines(qbsProps); + // Include paths. + includePaths = qbs::KeiluvUtils::includes(qbsProps); + + // Interpret other assembler flags as a misc controls (exclude only + // that flags which are was already handled). + for (const auto &flag : flags) { + if (flag.compare(QLatin1String("NOMACRO"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("MACRO"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("NOMPL"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("MPL"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("NOMOD51"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("MOD51"), + Qt::CaseInsensitive) == 0 + ) { + continue; + } + miscControls.push_back(flag); + } + } + + int useStandardMacroProcessor = true; + int useMacroProcessingLanguage = false; + int suppressSfrNames = false; + QStringList defineSymbols; + QStringList includePaths; + QStringList miscControls; +}; + +} // namespace + +Mcs51TargetAssemblerGroup::Mcs51TargetAssemblerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Ax51") +{ + const AssemblerPageOptions opts(qbsProject, qbsProduct); + + // Add 'Macro processor (Standard)' + appendProperty(QByteArrayLiteral("UseStandard"), + opts.useStandardMacroProcessor); + // Add 'Macro processor (MPL)' + appendProperty(QByteArrayLiteral("UseMpl"), + opts.useMacroProcessingLanguage); + // Add 'Define 8051 SFR names' + appendProperty(QByteArrayLiteral("UseMod51"), + opts.suppressSfrNames); + + // Add other various controls. + // Note: A sub-items order makes sense! + const auto variousControlsGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("VariousControls")); + // Add 'Misc Controls' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("MiscControls"), + opts.miscControls, QLatin1Char(' ')); + // Add 'Define' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("Define"), + opts.defineSymbols); + // Add an empty 'Undefine' item. + variousControlsGroup->appendProperty( + QByteArrayLiteral("Undefine"), {}); + // Add 'Include Paths' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("IncludePath"), + opts.includePaths, QLatin1Char(';')); +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.h new file mode 100644 index 000000000..f9a82304d --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51TARGETASSEMBLERGROUP_V3 +#define QBS_KEILUVMCS51TARGETASSEMBLERGROUP_V3 + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51TargetAssemblerGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51TargetAssemblerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51TARGETASSEMBLERGROUP_V3 diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.cpp new file mode 100644 index 000000000..de1be1ef6 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51targetcommonoptionsgroup_v5.h" + +#include "../../keiluvutils.h" + +#include <generators/generatorutils.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +namespace { + +struct CommonPageOptions final +{ + explicit CommonPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = KeiluvUtils::cppModuleCompilerFlags(qbsProps); + + // Browse information. + if (flags.contains(QLatin1String("BROWSE"), Qt::CaseInsensitive)) + browseInfo = true; + + // Debug information. + debugInfo = gen::utils::debugInformation(qbsProduct); + + // Output parameters. + executableName = gen::utils::targetBinary(qbsProduct); + // Fix output binary name if it is a library. Because + // the IDE appends an additional suffix (.LIB) to end + // of an output library name. + if (executableName.endsWith(QLatin1String(".lib"))) + executableName = qbsProduct.targetName(); + + const QString baseDirectory = gen::utils::buildRootPath(qbsProject); + objectDirectory = QDir::toNativeSeparators( + gen::utils::objectsOutputDirectory( + baseDirectory, qbsProduct)); + listingDirectory = QDir::toNativeSeparators( + gen::utils::listingOutputDirectory( + baseDirectory, qbsProduct)); + + // Target type. + targetType = KeiluvUtils::outputBinaryType(qbsProduct); + } + + int browseInfo = false; + int debugInfo = false; + QString executableName; + QString objectDirectory; + QString listingDirectory; + KeiluvUtils::OutputBinaryType targetType = + KeiluvUtils::ApplicationOutputType; +}; + +} // namespace + +Mcs51TargetCommonOptionsGroup::Mcs51TargetCommonOptionsGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("TargetCommonOption") +{ + const CommonPageOptions opts(qbsProject, qbsProduct); + + // Add 'Generic 8051 device' items, + // because we can't detect a target device + // form the present command lines. + appendProperty(QByteArrayLiteral("Device"), + QByteArrayLiteral("8051 (all Variants)")); + appendProperty(QByteArrayLiteral("Vendor"), + QByteArrayLiteral("Generic")); + appendProperty(QByteArrayLiteral("DeviceId"), + QByteArrayLiteral("2994")); + + // Add 'Debug Information' item. + appendProperty(QByteArrayLiteral("DebugInformation"), + opts.debugInfo); + // Add 'Browse Information' item. + appendProperty(QByteArrayLiteral("BrowseInformation"), + opts.browseInfo); + + // Add 'Name of Executable'. + appendProperty(QByteArrayLiteral("OutputName"), + opts.executableName); + // Add 'Output objects directory'. + appendProperty(QByteArrayLiteral("OutputDirectory"), + opts.objectDirectory); + // Add 'Output listing directory'. + appendProperty(QByteArrayLiteral("ListingPath"), + opts.listingDirectory); + + // Add 'Create Executable/Library' item. + const int isExecutable = (opts.targetType + == KeiluvUtils::ApplicationOutputType); + const int isLibrary = (opts.targetType + == KeiluvUtils::LibraryOutputType); + appendProperty(QByteArrayLiteral("CreateExecutable"), + isExecutable); + appendProperty(QByteArrayLiteral("CreateLib"), + isLibrary); +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.h new file mode 100644 index 000000000..eccd9d42d --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51TARGETCOMMONOPTIONSGROUP_V5_H +#define QBS_KEILUVMCS51TARGETCOMMONOPTIONSGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51TargetCommonOptionsGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51TargetCommonOptionsGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51TARGETCOMMONOPTIONSGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.cpp new file mode 100644 index 000000000..e33c0c211 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.cpp @@ -0,0 +1,281 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51targetcompilergroup_v5.h" +#include "mcs51utils.h" + +#include "../../keiluvutils.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +namespace { + +struct CompilerPageOptions final +{ + enum WarningLevel { + WarningLevelNone = 0, + WarningLevelOne, + WarningLevelTwo + }; + + enum OptimizationLevel { + ConstantFoldingOptimizationLevel = 0, + DeadCodeEliminationOptimizationLevel, + DataOverlayingOptimizationLevel, + PeepholeOptimizationLevel, + RegisterVariablesOptimizationLevel, + CommonSubexpressionEliminationOptimizationLevel, + LoopRotationOptimizationLevel, + ExtendedIndexAccessOptimizationLevel, + ReuseCommonEntryCodeOptimizationLevel, + CommonBlockSubroutinesOptimizationLevel, + RearrangeCodeOptimizationLevel, + ReuseCommonExitCodeOptimizationLevel + }; + + enum OptimizationEmphasis { + FavorSizeOptimizationEmphasis = 0, + FavorSpeedOptimizationEmphasis + }; + + enum FloatFuzzyBits { + NoFloatFuzzyBits = 0, + OneFloatFuzzyBit, + TwoFloatFuzzyBits, + ThreeFloatFuzzyBits, + FourFloatFuzzyBits, + FiveFloatFuzzyBits, + SixFloatFuzzyBits, + SevenFloatFuzzyBits + }; + + explicit CompilerPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); + + // Warnings. + const QString level = gen::utils::cppStringModuleProperty( + qbsProps, QStringLiteral("warningLevel")); + if (level == QLatin1String("none")) { + warningLevel = WarningLevelNone; + } else if (level == QLatin1String("all")) { + warningLevel = WarningLevelTwo; + } else { + // In this case take it directly from the compiler command line, + // e.g. parse the line in a form: 'WARNINGLEVEL (2)' + const auto warnValue = KeiluvUtils::flagValue( + flags, QStringLiteral("WARNINGLEVEL")); + bool ok = false; + const auto level = warnValue.toInt(&ok); + if (ok && gen::utils::inBounds( + level, int(WarningLevelNone),int(WarningLevelTwo))) { + warningLevel = static_cast<WarningLevel>(level); + } + } + + // Optimizations. + const QString optimization = gen::utils::cppStringModuleProperty( + qbsProps, QStringLiteral("optimization")); + if (optimization == QLatin1String("fast")) { + optimizationEmphasis = FavorSpeedOptimizationEmphasis; + } else if (level == QLatin1String("small")) { + optimizationEmphasis = FavorSizeOptimizationEmphasis; + } else if (level == QLatin1String("small")) { + // Don't supported by C51 compiler. + } else { + // In this case take it directly from the compiler command line, + // e.g. parse the line in a form: 'OPTIMIZE (8, SPEED)' + const auto optValue = KeiluvUtils::flagValue( + flags, QStringLiteral("OPTIMIZE")); + const auto parts = KeiluvUtils::flagValueParts(optValue); + for (const auto &part : parts) { + bool ok = false; + const auto level = part.toInt(&ok); + if (ok && (level >= ConstantFoldingOptimizationLevel) + && (level <= ReuseCommonExitCodeOptimizationLevel)) { + optimizationLevel = static_cast<OptimizationLevel>(level); + } else if (part.compare(QLatin1String("SIZE"), + Qt::CaseInsensitive) == 0) { + optimizationEmphasis = FavorSizeOptimizationEmphasis; + } else if (part.compare(QLatin1String("SPEED"), + Qt::CaseInsensitive) == 0) { + optimizationEmphasis = FavorSpeedOptimizationEmphasis; + } + } + } + + // Don't use absolute register accesses. + if (flags.contains(QLatin1String("NOAREGS"), Qt::CaseInsensitive)) + dontuseAbsoluteRegsAccess = true; + + // Enable ANSI integer promotion rules. + if (flags.contains(QLatin1String("NOINTPROMOTE"), Qt::CaseInsensitive)) + enableIntegerPromotionRules = false; + + // Keep variables in order. + if (flags.contains(QLatin1String("ORDER"), Qt::CaseInsensitive)) + keepVariablesInOrder = true; + + // Don't use interrupt vector. + if (flags.contains(QLatin1String("NOINTVECTOR"), Qt::CaseInsensitive)) + useInterruptVector = false; + + // Interrupt vector address. + interruptVectorAddress = KeiluvUtils::flagValue( + flags, QStringLiteral("INTVECTOR")); + + // Float fuzzy bits count. + const auto bitsValue = KeiluvUtils::flagValue( + flags, QStringLiteral("FLOATFUZZY")); + bool ok = false; + const auto bits = bitsValue.toInt(&ok); + if (ok && gen::utils::inBounds( + bits, int(NoFloatFuzzyBits), int(SevenFloatFuzzyBits))) { + floatFuzzyBits = static_cast<FloatFuzzyBits>(bits); + } + + // Define symbols. + defineSymbols = qbs::KeiluvUtils::defines(qbsProps); + // Include paths. + includePaths = qbs::KeiluvUtils::includes(qbsProps); + + // Interpret other compiler flags as a misc controls (exclude only + // that flags which are was already handled). + for (const auto &flag : flags) { + if (flag.startsWith(QLatin1String("WARNINGLEVEL"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("OPTIMIZE"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("FLOATFUZZY"), + Qt::CaseInsensitive) + || flag.compare(QLatin1String("NOAREGS"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("AREGS"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("NOINTPROMOTE"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("INTPROMOTE"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("NOINTVECTOR"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("INTVECTOR"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("ORDER"), + Qt::CaseInsensitive) == 0 + || flag.compare(QLatin1String("BROSWE"), + Qt::CaseInsensitive) == 0 + ) { + continue; + } + miscControls.push_back(flag); + } + } + + WarningLevel warningLevel = WarningLevelTwo; + OptimizationLevel optimizationLevel = ReuseCommonEntryCodeOptimizationLevel; + OptimizationEmphasis optimizationEmphasis = FavorSpeedOptimizationEmphasis; + FloatFuzzyBits floatFuzzyBits = ThreeFloatFuzzyBits; + int dontuseAbsoluteRegsAccess = false; + int enableIntegerPromotionRules = true; + int keepVariablesInOrder = false; + int useInterruptVector = true; + QString interruptVectorAddress; + QStringList defineSymbols; + QStringList includePaths; + QStringList miscControls; +}; + +} // namespace + +Mcs51TargetCompilerGroup::Mcs51TargetCompilerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("C51") +{ + const CompilerPageOptions opts(qbsProject, qbsProduct); + + // Add 'Code Optimization' options. + appendProperty(QByteArrayLiteral("Optimize"), + opts.optimizationLevel); + appendProperty(QByteArrayLiteral("SizeSpeed"), + opts.optimizationEmphasis); + // Add 'Warnings' options. + appendProperty(QByteArrayLiteral("WarningLevel"), + opts.warningLevel); + // Add 'Don't use absolute register access' item. + appendProperty(QByteArrayLiteral("uAregs"), + opts.dontuseAbsoluteRegsAccess); + // Add 'Enable integer promotion rules' item. + appendProperty(QByteArrayLiteral("IntegerPromotion"), + opts.enableIntegerPromotionRules); + // Add 'Keep variables in order' item. + appendProperty(QByteArrayLiteral("VariablesInOrder"), + opts.keepVariablesInOrder); + // Add 'Use interrupt vector' item. + appendProperty(QByteArrayLiteral("UseInterruptVector"), + opts.useInterruptVector); + appendProperty(QByteArrayLiteral("InterruptVectorAddress"), + opts.interruptVectorAddress); + // Add 'Float fuzzy bits' item. + appendProperty(QByteArrayLiteral("Fuzzy"), + opts.floatFuzzyBits); + + // Add other various controls. + // Note: A sub-items order makes sense! + const auto variousControlsGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("VariousControls")); + // Add 'Misc Controls' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("MiscControls"), + opts.miscControls, QLatin1Char(' ')); + // Add 'Define' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("Define"), + opts.defineSymbols); + // Add an empty 'Undefine' item. + variousControlsGroup->appendProperty( + QByteArrayLiteral("Undefine"), {}); + // Add 'Include Paths' item. + variousControlsGroup->appendMultiLineProperty( + QByteArrayLiteral("IncludePath"), + opts.includePaths, QLatin1Char(';')); +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.h new file mode 100644 index 000000000..0f1e52ce4 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51TARGETCOMPILERGROUP_V5_H +#define QBS_KEILUVMCS51TARGETCOMPILERGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51TargetCompilerGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51TargetCompilerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51TARGETCOMPILERGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.cpp new file mode 100644 index 000000000..2a05649dd --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51targetassemblergroup_v5.h" +#include "mcs51targetcompilergroup_v5.h" +#include "mcs51targetgroup_v5.h" +#include "mcs51targetlinkergroup_v5.h" +#include "mcs51targetmiscgroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +Mcs51TargetGroup::Mcs51TargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Target51") +{ + appendChild<Mcs51TargetMiscGroup>(qbsProject, qbsProduct); + appendChild<Mcs51TargetCompilerGroup>(qbsProject, qbsProduct); + appendChild<Mcs51TargetAssemblerGroup>(qbsProject, qbsProduct); + appendChild<Mcs51TargetLinkerGroup>(qbsProject, qbsProduct); +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.h new file mode 100644 index 000000000..d256dfcc7 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51TARGETGROUP_V5_H +#define QBS_KEILUVMCS51TARGETGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51TargetGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51TargetGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51TARGETGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.cpp new file mode 100644 index 000000000..4d52b627a --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.cpp @@ -0,0 +1,240 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51targetlinkergroup_v5.h" +#include "mcs51utils.h" + +#include "../../keiluvutils.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +namespace { + +struct LinkerPageOptions final +{ + explicit LinkerPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleLinkerFlags(qbsProps); + + // Handle all 'BIT' memory flags. + parseMemory(flags, QStringLiteral("BIT"), + bitAddresses, bitSegments); + // Handle all 'CODE' memory flags. + parseMemory(flags, QStringLiteral("CODE"), + codeAddresses, codeSegments); + // Handle all 'DATA' memory flags. + parseMemory(flags, QStringLiteral("DATA"), + dataAddresses, dataSegments); + // Handle all 'IDATA' memory flags. + parseMemory(flags, QStringLiteral("IDATA"), + idataAddresses, idataSegments); + // Handle all 'PDATA' memory flags. + parseMemory(flags, QStringLiteral("PDATA"), + pdataAddresses, pdataSegments); + // Handle all 'XDATA' memory flags. + parseMemory(flags, QStringLiteral("XDATA"), + xdataAddresses, xdataSegments); + + // Enumerate all flags in a form like: + // 'PRECEDE(foo, bar) PRECEDE(baz)'. + const auto precedeValues = KeiluvUtils::flagValues( + flags, QStringLiteral("PRECEDE")); + for (const auto &precedeValue : precedeValues) { + const auto parts = KeiluvUtils::flagValueParts(precedeValue); + precedeSegments.reserve(precedeSegments.size() + parts.count()); + std::copy(parts.cbegin(), parts.cend(), + std::back_inserter(precedeSegments)); + } + + // Enumerate all flags in a form like: + // 'STACK(foo, bar) STACK(baz)'. + const auto stackValues = KeiluvUtils::flagValues( + flags, QStringLiteral("STACK")); + for (const auto &stackValue : stackValues) { + const auto parts = KeiluvUtils::flagValueParts(stackValue); + stackSegments.reserve(stackSegments.size() + parts.count()); + std::copy(parts.cbegin(), parts.cend(), + std::back_inserter(stackSegments)); + } + + // Interpret other linker flags as a misc controls (exclude only + // that flags which are was already handled). + for (const auto &flag : flags) { + if (flag.startsWith(QLatin1String("BIT"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("CODE"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("DATA"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("IDATA"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("PDATA"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("XDATA"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("PRECEDE"), + Qt::CaseInsensitive) + || flag.startsWith(QLatin1String("STACK"), + Qt::CaseInsensitive) + ) { + continue; + } + miscControls.push_back(flag); + } + } + + static void parseMemory(const QStringList &flags, + const QString &flagKey, + QStringList &destAddresses, + QStringList &destSegments) + { + // Handle all flags in a form like: + // 'FLAGKEY(0x00-0x20, 30, foo, bar(0x40)) FLAGKEY(baz)'. + const auto values = KeiluvUtils::flagValues(flags, flagKey); + for (const auto &value : values) { + const auto parts = KeiluvUtils::flagValueParts(value); + for (const auto &part : parts) { + if (part.contains(QLatin1Char('-'))) { + // Seems, it is an address range. + destAddresses.push_back(part); + } else { + // Check on address (specified in decimal + // or hexadecimal form). + bool ok = false; + part.toInt(&ok, 16); + if (!ok) + part.toInt(&ok, 10); + if (ok) { + // Seems, it is just a single address. + destAddresses.push_back(part); + } else { + // Seems it is a segment name. + destSegments.push_back(part); + } + } + } + } + } + + QStringList bitAddresses; + QStringList bitSegments; + QStringList codeAddresses; + QStringList codeSegments; + QStringList dataAddresses; + QStringList dataSegments; + QStringList idataAddresses; + QStringList idataSegments; + QStringList pdataAddresses; + QStringList pdataSegments; + QStringList xdataAddresses; + QStringList xdataSegments; + + QStringList precedeSegments; + QStringList stackSegments; + + QStringList miscControls; +}; + +} // namespace + +Mcs51TargetLinkerGroup::Mcs51TargetLinkerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Lx51") +{ + const LinkerPageOptions opts(qbsProject, qbsProduct); + + // Add 'Misc Controls' item. + appendMultiLineProperty(QByteArrayLiteral("MiscControls"), + opts.miscControls, QLatin1Char(' ')); + + // Add 'Use Memory Layout from Target Dialog' item. + // Note: we always disable it, as we expect that + // the layout will be specified from the linker's + // command line. + appendProperty(QByteArrayLiteral("UseMemoryFromTarget"), + 0); + + // Add 'Bit Range' item. + appendMultiLineProperty(QByteArrayLiteral("BitBaseAddress"), + opts.bitAddresses); + // Add 'Code Range' item. + appendMultiLineProperty(QByteArrayLiteral("CodeBaseAddress"), + opts.codeAddresses); + // Add 'Data Range' item. + appendMultiLineProperty(QByteArrayLiteral("DataBaseAddress"), + opts.dataAddresses); + // Add 'IData Range' item. + appendMultiLineProperty(QByteArrayLiteral("IDataBaseAddress"), + opts.idataAddresses); + // Add 'PData Range' item. + appendMultiLineProperty(QByteArrayLiteral("PDataBaseAddress"), + opts.pdataAddresses); + // Add 'XData Range' item. + appendMultiLineProperty(QByteArrayLiteral("XDataBaseAddress"), + opts.xdataAddresses); + + // Add 'Bit Segment' item. + appendMultiLineProperty(QByteArrayLiteral("BitSegmentName"), + opts.bitSegments); + // Add 'Code Segment' item. + appendMultiLineProperty(QByteArrayLiteral("CodeSegmentName"), + opts.codeSegments); + // Add 'Data Segment' item. + appendMultiLineProperty(QByteArrayLiteral("DataSegmentName"), + opts.dataSegments); + // Add 'IData Segment' item. + appendMultiLineProperty(QByteArrayLiteral("IDataSegmentName"), + opts.idataSegments); + + // Note: PData has not segments! + + // Add 'XData Segment' item. + appendMultiLineProperty(QByteArrayLiteral("XDataSegmentName"), + opts.xdataSegments); + // Add 'Precede' item. + appendMultiLineProperty(QByteArrayLiteral("Precede"), + opts.precedeSegments); + // Add 'Stack' item. + appendMultiLineProperty(QByteArrayLiteral("Stack"), + opts.stackSegments); +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.h new file mode 100644 index 000000000..d701c5e0e --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51TARGETLINKERGROUP_V5_H +#define QBS_KEILUVMCS51TARGETLINKERGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51TargetLinkerGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51TargetLinkerGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51TARGETLINKERGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.cpp new file mode 100644 index 000000000..5d95d443f --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51targetmiscgroup_v5.h" +#include "mcs51utils.h" + +#include "../../keiluvutils.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +namespace { + +struct MiscPageOptions final +{ + enum MemoryModel { + SmallMemoryModel = 0, + CompactMemoryModel, + LargeMemoryModel + }; + + enum CodeRomSize { + SmallCodeRomSize = 0, + CompactCodeRomSize, + LargeCodeRomSize + }; + + explicit MiscPageOptions(const Project &qbsProject, + const ProductData &qbsProduct) + { + Q_UNUSED(qbsProject) + + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto flags = qbs::KeiluvUtils::cppModuleCompilerFlags(qbsProps); + + // Memory model. + if (flags.contains(QLatin1String("COMPACT"), Qt::CaseInsensitive)) + memoryModel = CompactMemoryModel; + else if (flags.contains(QLatin1String("LARGE"), Qt::CaseInsensitive)) + memoryModel = LargeMemoryModel; + + // Code ROM size. + const auto sizeValue = KeiluvUtils::flagValue( + flags, QStringLiteral("ROM")); + if (sizeValue == QLatin1String("SMALL")) + coderomSize = SmallCodeRomSize; + else if (sizeValue == QLatin1String("COMPACT")) + coderomSize = CompactCodeRomSize; + } + + MemoryModel memoryModel = SmallMemoryModel; + CodeRomSize coderomSize = LargeCodeRomSize; +}; + +} // namespace + +Mcs51TargetMiscGroup::Mcs51TargetMiscGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Target51Misc") +{ + const MiscPageOptions opts(qbsProject, qbsProduct); + + // Add 'Memory Model' options item. + appendProperty(QByteArrayLiteral("MemoryModel"), + opts.memoryModel); + // Add 'ROM Size' options item. + appendProperty(QByteArrayLiteral("RomSize"), + opts.coderomSize); +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.h new file mode 100644 index 000000000..f1680d927 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51TARGETMISCGROUP_V5_H +#define QBS_KEILUVMCS51TARGETMISCGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51TargetMiscGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51TargetMiscGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51TARGETMISCGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.cpp new file mode 100644 index 000000000..8e8307f72 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51utilitiesgroup_v5.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +Mcs51UtilitiesGroup::Mcs51UtilitiesGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct) + : gen::xml::PropertyGroup("Utilities") +{ + Q_UNUSED(qbsProject) + Q_UNUSED(qbsProduct) +} + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.h new file mode 100644 index 000000000..f95ec67c4 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51UTILITIESGROUP_V5_H +#define QBS_KEILUVMCS51UTILITIESGROUP_V5_H + +#include <generators/xmlpropertygroup.h> + +namespace qbs { +namespace keiluv { +namespace mcs51 { +namespace v5 { + +class Mcs51UtilitiesGroup final : public gen::xml::PropertyGroup +{ +public: + explicit Mcs51UtilitiesGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct); +}; + +} // namespace v5 +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51UTILITIESGROUP_V5_H diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.cpp b/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.cpp new file mode 100644 index 000000000..698f0df78 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcs51utils.h" + +namespace qbs { +namespace keiluv { +namespace mcs51 { + +namespace KeiluvUtils { + +static QString extractValue(const QString &flag) +{ + const auto openBracketIndex = flag.indexOf(QLatin1Char('(')); + const auto closeBracketIndex = flag.indexOf(QLatin1Char(')')); + const auto n = closeBracketIndex - openBracketIndex - 1; + return flag.mid(openBracketIndex + 1, n); +} + +QStringList flagValues(const QStringList &flags, const QString &flagKey) +{ + QStringList values; + for (const auto &flag : flags) { + if (!flag.startsWith(flagKey, Qt::CaseInsensitive)) + continue; + const auto value = extractValue(flag); + values.push_back(value); + } + return values; +} + +QString flagValue(const QStringList &flags, const QString &flagKey) +{ + const auto flagEnd = flags.cend(); + const auto flagIt = std::find_if(flags.cbegin(), flagEnd, + [flagKey](const auto &flag) { + return flag.startsWith(flagKey, Qt::CaseInsensitive); + }); + if (flagIt == flagEnd) + return {}; // Flag key not found. + return extractValue(*flagIt); +} + +QStringList flagValueParts(const QString &flagValue, const QLatin1Char &sep) +{ + auto parts = flagValue.split(sep); + std::transform(parts.begin(), parts.end(), parts.begin(), + [](const auto &part) { return part.trimmed(); }); + return parts; +} + +} // namespace KeiluvUtils + +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h new file mode 100644 index 000000000..a1a9706e4 --- /dev/null +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVMCS51UTILS_H +#define QBS_KEILUVMCS51UTILS_H + +#include <QtCore/qstringlist.h> + +namespace qbs { + +namespace keiluv { +namespace mcs51 { + +namespace KeiluvUtils { + +QStringList flagValues(const QStringList &flags, const QString &flagKey); + +QString flagValue(const QStringList &flags, const QString &flagKey); + +QStringList flagValueParts(const QString &flagValue, + const QLatin1Char &sep = QLatin1Char(',')); + +} // namespace KeiluvUtils + +} // namespace mcs51 +} // namespace keiluv +} // namespace qbs + +#endif // QBS_KEILUVMCS51UTILS_H diff --git a/src/plugins/generator/keiluv/keiluv.pro b/src/plugins/generator/keiluv/keiluv.pro new file mode 100644 index 000000000..ba3e4d27b --- /dev/null +++ b/src/plugins/generator/keiluv/keiluv.pro @@ -0,0 +1,92 @@ +include(../../plugins.pri) +include(../../../shared/json/json.pri) + +TARGET = keiluvgenerator + +QT = core + +# Plugin file. + +SOURCES += \ + $$PWD/keiluvgeneratorplugin.cpp \ + +# Common files. + +HEADERS += \ + $$PWD/keiluvconstants.h \ + $$PWD/keiluvfilesgroupspropertygroup.h \ + $$PWD/keiluvgenerator.h \ + $$PWD/keiluvproject.h \ + $$PWD/keiluvprojectwriter.h \ + $$PWD/keiluvutils.h \ + $$PWD/keiluvversioninfo.h \ + $$PWD/keiluvworkspace.h \ + $$PWD/keiluvworkspacewriter.h + +SOURCES += \ + $$PWD/keiluvfilesgroupspropertygroup.cpp \ + $$PWD/keiluvgenerator.cpp \ + $$PWD/keiluvproject.cpp \ + $$PWD/keiluvprojectwriter.cpp \ + $$PWD/keiluvutils.cpp \ + $$PWD/keiluvversioninfo.cpp \ + $$PWD/keiluvworkspace.cpp \ + $$PWD/keiluvworkspacewriter.cpp + +# For MCS51 architecture. + +HEADERS += \ + $$PWD/archs/mcs51/mcs51buildtargetgroup_v5.h \ + $$PWD/archs/mcs51/mcs51commonpropertygroup_v5.h \ + $$PWD/archs/mcs51/mcs51debugoptiongroup_v5.h \ + $$PWD/archs/mcs51/mcs51dlloptiongroup_v5.h \ + $$PWD/archs/mcs51/mcs51targetassemblergroup_v5.h \ + $$PWD/archs/mcs51/mcs51targetcommonoptionsgroup_v5.h \ + $$PWD/archs/mcs51/mcs51targetcompilergroup_v5.h \ + $$PWD/archs/mcs51/mcs51targetgroup_v5.h \ + $$PWD/archs/mcs51/mcs51targetlinkergroup_v5.h \ + $$PWD/archs/mcs51/mcs51targetmiscgroup_v5.h \ + $$PWD/archs/mcs51/mcs51utilitiesgroup_v5.h \ + $$PWD/archs/mcs51/mcs51utils.h + +SOURCES += \ + $$PWD/archs/mcs51/mcs51buildtargetgroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51commonpropertygroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51debugoptiongroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51dlloptiongroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51targetassemblergroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51targetcommonoptionsgroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51targetcompilergroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51targetgroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51targetlinkergroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51targetmiscgroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51utilitiesgroup_v5.cpp \ + $$PWD/archs/mcs51/mcs51utils.cpp + +# For ARM architecture. + +HEADERS += \ + $$PWD/archs/arm/armbuildtargetgroup_v5.h \ + $$PWD/archs/arm/armcommonpropertygroup_v5.h \ + $$PWD/archs/arm/armdebugoptiongroup_v5.h \ + $$PWD/archs/arm/armdlloptiongroup_v5.h \ + $$PWD/archs/arm/armtargetassemblergroup_v5.h \ + $$PWD/archs/arm/armtargetcommonoptionsgroup_v5.h \ + $$PWD/archs/arm/armtargetcompilergroup_v5.h \ + $$PWD/archs/arm/armtargetgroup_v5.h \ + $$PWD/archs/arm/armtargetlinkergroup_v5.h \ + $$PWD/archs/arm/armtargetmiscgroup_v5.h \ + $$PWD/archs/arm/armutilitiesgroup_v5.h + +SOURCES += \ + $$PWD/archs/arm/armbuildtargetgroup_v5.cpp \ + $$PWD/archs/arm/armcommonpropertygroup_v5.cpp \ + $$PWD/archs/arm/armdebugoptiongroup_v5.cpp \ + $$PWD/archs/arm/armdlloptiongroup_v5.cpp \ + $$PWD/archs/arm/armtargetassemblergroup_v5.cpp \ + $$PWD/archs/arm/armtargetcommonoptionsgroup_v5.cpp \ + $$PWD/archs/arm/armtargetcompilergroup_v5.cpp \ + $$PWD/archs/arm/armtargetgroup_v5.cpp \ + $$PWD/archs/arm/armtargetlinkergroup_v5.cpp \ + $$PWD/archs/arm/armtargetmiscgroup_v5.cpp \ + $$PWD/archs/arm/armutilitiesgroup_v5.cpp diff --git a/src/plugins/generator/keiluv/keiluv.qbs b/src/plugins/generator/keiluv/keiluv.qbs new file mode 100644 index 000000000..65bf6d65b --- /dev/null +++ b/src/plugins/generator/keiluv/keiluv.qbs @@ -0,0 +1,90 @@ +import qbs +import "../../qbsplugin.qbs" as QbsPlugin + +QbsPlugin { + Depends { name: "qbsjson" } + + name: "keiluvgenerator" + + files: ["keiluvgeneratorplugin.cpp"] + + Group { + name: "KEIL UV generator common" + files: [ + "keiluvfilesgroupspropertygroup.cpp", + "keiluvfilesgroupspropertygroup.h", + "keiluvgenerator.cpp", + "keiluvgenerator.h", + "keiluvproject.cpp", + "keiluvproject.h", + "keiluvprojectwriter.cpp", + "keiluvprojectwriter.h", + "keiluvutils.cpp", + "keiluvutils.h", + "keiluvversioninfo.cpp", + "keiluvversioninfo.h", + "keiluvworkspace.cpp", + "keiluvworkspace.h", + "keiluvworkspacewriter.cpp", + "keiluvworkspacewriter.h", + ] + } + Group { + name: "KEIL UV generator for MCS51" + prefix: "archs/mcs51/" + files: [ + "mcs51buildtargetgroup_v5.cpp", + "mcs51buildtargetgroup_v5.h", + "mcs51commonpropertygroup_v5.cpp", + "mcs51commonpropertygroup_v5.h", + "mcs51debugoptiongroup_v5.cpp", + "mcs51debugoptiongroup_v5.h", + "mcs51dlloptiongroup_v5.cpp", + "mcs51dlloptiongroup_v5.h", + "mcs51targetassemblergroup_v5.cpp", + "mcs51targetassemblergroup_v5.h", + "mcs51targetcommonoptionsgroup_v5.cpp", + "mcs51targetcommonoptionsgroup_v5.h", + "mcs51targetcompilergroup_v5.cpp", + "mcs51targetcompilergroup_v5.h", + "mcs51targetgroup_v5.cpp", + "mcs51targetgroup_v5.h", + "mcs51targetlinkergroup_v5.cpp", + "mcs51targetlinkergroup_v5.h", + "mcs51targetmiscgroup_v5.cpp", + "mcs51targetmiscgroup_v5.h", + "mcs51utilitiesgroup_v5.cpp", + "mcs51utilitiesgroup_v5.h", + "mcs51utils.cpp", + "mcs51utils.h", + ] + } + Group { + name: "KEIL UV generator for ARM" + prefix: "archs/arm/" + files: [ + "armbuildtargetgroup_v5.cpp", + "armbuildtargetgroup_v5.h", + "armcommonpropertygroup_v5.cpp", + "armcommonpropertygroup_v5.h", + "armdebugoptiongroup_v5.cpp", + "armdebugoptiongroup_v5.h", + "armdlloptiongroup_v5.cpp", + "armdlloptiongroup_v5.h", + "armtargetassemblergroup_v5.cpp", + "armtargetassemblergroup_v5.h", + "armtargetcommonoptionsgroup_v5.cpp", + "armtargetcommonoptionsgroup_v5.h", + "armtargetcompilergroup_v5.cpp", + "armtargetcompilergroup_v5.h", + "armtargetgroup_v5.cpp", + "armtargetgroup_v5.h", + "armtargetlinkergroup_v5.cpp", + "armtargetlinkergroup_v5.h", + "armtargetmiscgroup_v5.cpp", + "armtargetmiscgroup_v5.h", + "armutilitiesgroup_v5.cpp", + "armutilitiesgroup_v5.h", + ] + } +} diff --git a/src/plugins/generator/keiluv/keiluvconstants.h b/src/plugins/generator/keiluv/keiluvconstants.h new file mode 100644 index 000000000..0d27ab81d --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvconstants.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVCONSTANTS_H +#define QBS_KEILUVCONSTANTS_H + +namespace qbs { +namespace KeiluvConstants { + +namespace v5 { +constexpr int kUVisionVersion = 5; +} + +} // namespace KeiluvConstants +} // namespace qbs + +#endif // QBS_KEILUVCONSTANTS_H diff --git a/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.cpp b/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.cpp new file mode 100644 index 000000000..b9a234d6a --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.cpp @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "keiluvfilesgroupspropertygroup.h" +#include "keiluvutils.h" + +#include <generators/generatordata.h> + +#include <tools/stringconstants.h> + +namespace qbs { + +class KeiluvFilePropertyGroup final : public gen::xml::PropertyGroup +{ +public: + explicit KeiluvFilePropertyGroup( + const QString &fullFilePath, + const QString &baseDirectory) + : gen::xml::PropertyGroup("File") + { + const QFileInfo fileInfo(fullFilePath); + const auto fileName = fileInfo.fileName(); + const auto fileType = encodeFileType(fileInfo.suffix()); + const auto filePath = QDir::toNativeSeparators( + gen::utils::relativeFilePath( + baseDirectory, + fileInfo.absoluteFilePath())); + + appendChild<gen::xml::Property>(QByteArrayLiteral("FileName"), + fileName); + appendChild<gen::xml::Property>(QByteArrayLiteral("FileType"), + fileType); + appendChild<gen::xml::Property>(QByteArrayLiteral("FilePath"), + filePath); + } + +private: + enum FileType { + UnknownFileType = 0, + CSourceFileType = 1, + AssemblerFileType = 2, + LibraryFileType = 4, + TextFileType = 5, + CppSourceFileType = 8, + }; + + static FileType encodeFileType(const QString &fileSuffix) + { + if (fileSuffix.compare(QLatin1String("c"), + Qt::CaseInsensitive) == 0) { + return CSourceFileType; + } else if (fileSuffix.compare(QLatin1String("cpp"), + Qt::CaseInsensitive) == 0) { + return CppSourceFileType; + } else if (fileSuffix.compare(QLatin1String("s"), + Qt::CaseInsensitive) == 0 + || fileSuffix.compare(QLatin1String("a51"), + Qt::CaseInsensitive) == 0) { + return AssemblerFileType; + } else if (fileSuffix.compare(QLatin1String("lib"), + Qt::CaseInsensitive) == 0) { + return LibraryFileType; + } else { + // All header files, text files and include files + // interpretes as a text file types. + return TextFileType; + } + } +}; + +class KeiluvFilesPropertyGroup final : public gen::xml::PropertyGroup +{ +public: + explicit KeiluvFilesPropertyGroup( + const QList<ArtifactData> &sourceArtifacts, + const QString &baseDirectory) + : gen::xml::PropertyGroup("Files") + { + for (const auto &artifact : sourceArtifacts) + appendChild<KeiluvFilePropertyGroup>(artifact.filePath(), + baseDirectory); + } + + explicit KeiluvFilesPropertyGroup( + const QStringList &filePaths, + const QString &baseDirectory) + : gen::xml::PropertyGroup("Files") + { + for (const auto &filePath : filePaths) + appendChild<KeiluvFilePropertyGroup>(filePath, + baseDirectory); + } +}; + +class KeiluvFileGroupPropertyGroup final : public gen::xml::PropertyGroup +{ +public: + explicit KeiluvFileGroupPropertyGroup( + const QString &groupName, + const QList<ArtifactData> &sourceArtifacts, + const QString &baseDirectory) + : gen::xml::PropertyGroup("Group") + { + appendChild<gen::xml::Property>(QByteArrayLiteral("GroupName"), + groupName); + + appendChild<KeiluvFilesPropertyGroup>(sourceArtifacts, + baseDirectory); + } + + explicit KeiluvFileGroupPropertyGroup( + const QString &groupName, + const QStringList &filePaths, + const QString &baseDirectory) + : gen::xml::PropertyGroup("Group") + { + appendChild<gen::xml::Property>(QByteArrayLiteral("GroupName"), + groupName); + + appendChild<KeiluvFilesPropertyGroup>(filePaths, + baseDirectory); + } +}; + +KeiluvFilesGroupsPropertyGroup::KeiluvFilesGroupsPropertyGroup( + const Project &qbsProject, + const ProductData &qbsProduct, + const std::vector<ProductData> &qbsProductDeps) + : gen::xml::PropertyGroup(QByteArrayLiteral("Groups")) +{ + const auto baseDirectory = gen::utils::buildRootPath(qbsProject); + + // Build source items. + const auto groups = qbsProduct.groups(); + for (const auto &group : groups) { + // Ignore disabled groups (e.g. when its condition property is false). + if (!group.isEnabled()) + continue; + auto sourceArtifacts = group.sourceArtifacts(); + // Remove the linker script artifacts. + sourceArtifacts.erase(std::remove_if(sourceArtifacts.begin(), + sourceArtifacts.end(), + [](const auto &artifact){ + const auto tags = artifact.fileTags(); + return tags.contains(QLatin1String("linkerscript")); + }), sourceArtifacts.end()); + + if (sourceArtifacts.isEmpty()) + continue; + appendChild<KeiluvFileGroupPropertyGroup>( + group.name(), sourceArtifacts, baseDirectory); + } + + // Build local static library items. + const auto &qbsProps = qbsProduct.moduleProperties(); + const auto staticLibs = KeiluvUtils::staticLibraries(qbsProps); + if (!staticLibs.isEmpty()) { + appendChild<KeiluvFileGroupPropertyGroup>( + QStringLiteral("Static Libs"), staticLibs, baseDirectory); + } + + // Build dependency library items. + const auto deps = KeiluvUtils::dependencies(qbsProductDeps); + if (!deps.isEmpty()) { + appendChild<KeiluvFileGroupPropertyGroup>( + QStringLiteral("Dependencies"), deps, baseDirectory); + } +} + +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.h b/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.h new file mode 100644 index 000000000..bde86b89c --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvfilesgroupspropertygroup.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVFILESGROUPSPROPERTYGROUP_H +#define QBS_KEILUVFILESGROUPSPROPERTYGROUP_H + +#include <generators/xmlpropertygroup.h> + +#include <generators/generatordata.h> + +namespace qbs { + +class KeiluvFilesGroupsPropertyGroup final + : public gen::xml::PropertyGroup +{ +public: + explicit KeiluvFilesGroupsPropertyGroup( + const qbs::Project &qbsProject, + const qbs::ProductData &qbsProduct, + const std::vector<qbs::ProductData> &qbsProductDeps); +}; + +} // namespace qbs + +#endif // QBS_KEILUVFILESGROUPSPROPERTYGROUP_H diff --git a/src/plugins/generator/keiluv/keiluvgenerator.cpp b/src/plugins/generator/keiluv/keiluvgenerator.cpp new file mode 100644 index 000000000..e3c959e8d --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvgenerator.cpp @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "keiluvgenerator.h" +#include "keiluvproject.h" +#include "keiluvprojectwriter.h" +#include "keiluvworkspace.h" +#include "keiluvworkspacewriter.h" + +#include <generators/generatableprojectiterator.h> +#include <generators/generatorutils.h> + +#include <logging/logger.h> +#include <logging/translator.h> + +#include <tools/filesaver.h> + +namespace qbs { + +static void writeProjectFiles(const std::map<QString, + std::shared_ptr<KeiluvProject>> &projects, + const Internal::Logger &logger) +{ + for (const auto &item : projects) { + const QString projectFilePath = item.first; + Internal::FileSaver file(projectFilePath.toStdString()); + if (!file.open()) + throw ErrorInfo(Internal::Tr::tr("Cannot open %s for writing") + .arg(projectFilePath)); + + std::shared_ptr<KeiluvProject> project = item.second; + KeiluvProjectWriter writer(file.device()); + if (!(writer.write(project.get()) && file.commit())) + throw ErrorInfo(Internal::Tr::tr("Failed to generate %1") + .arg(projectFilePath)); + + logger.qbsInfo() << Internal::Tr::tr("Generated %1").arg( + QFileInfo(projectFilePath).fileName()); + } +} + +static void writeWorkspace(const std::shared_ptr<KeiluvWorkspace> &wokspace, + const QString &workspaceFilePath, + const Internal::Logger &logger) +{ + Internal::FileSaver file(workspaceFilePath.toStdString()); + if (!file.open()) + throw ErrorInfo(Internal::Tr::tr("Cannot open %s for writing") + .arg(workspaceFilePath)); + + KeiluvWorkspaceWriter writer(file.device()); + if (!(writer.write(wokspace.get()) && file.commit())) + throw ErrorInfo(Internal::Tr::tr("Failed to generate %1") + .arg(workspaceFilePath)); + + logger.qbsInfo() << Internal::Tr::tr("Generated %1").arg( + QFileInfo(workspaceFilePath).fileName()); +} + +KeiluvGenerator::KeiluvGenerator(const KeiluvVersionInfo &versionInfo) + : m_versionInfo(versionInfo) +{ +} + +QString KeiluvGenerator::generatorName() const +{ + return QStringLiteral("keiluv%1").arg(m_versionInfo.marketingVersion()); +} + +void KeiluvGenerator::reset() +{ + m_workspace.reset(); + m_workspaceFilePath.clear(); + m_projects.clear(); +} + +void KeiluvGenerator::generate() +{ + GeneratableProjectIterator it(project()); + it.accept(this); + + writeProjectFiles(m_projects, logger()); + writeWorkspace(m_workspace, m_workspaceFilePath, logger()); + + reset(); +} + +void KeiluvGenerator::visitProject(const GeneratableProject &project) +{ + const QDir buildDir = project.baseBuildDirectory(); + + m_workspaceFilePath = buildDir.absoluteFilePath( + project.name() + QStringLiteral(".uvmpw")); + m_workspace = std::make_shared<KeiluvWorkspace>(m_workspaceFilePath); +} + +void KeiluvGenerator::visitProjectData( + const GeneratableProject &project, + const GeneratableProjectData &projectData) +{ + Q_UNUSED(project) + Q_UNUSED(projectData) +} + +void KeiluvGenerator::visitProduct( + const GeneratableProject &project, + const GeneratableProjectData &projectData, + const GeneratableProductData &productData) +{ + Q_UNUSED(projectData); + + const QDir baseBuildDir(project.baseBuildDirectory().absolutePath()); + const QString projFileName = productData.name() + QLatin1String(".uvprojx"); + const QString projectFilePath = baseBuildDir.absoluteFilePath(projFileName); + const auto targetProject = std::make_shared<KeiluvProject>( + project, productData, m_versionInfo); + + m_projects.insert({projectFilePath, targetProject}); + m_workspace->addProject(projectFilePath); +} + +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvgenerator.h b/src/plugins/generator/keiluv/keiluvgenerator.h new file mode 100644 index 000000000..769519562 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvgenerator.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVGENERATOR_H +#define QBS_KEILUVGENERATOR_H + +#include "keiluvversioninfo.h" + +#include <generators/generator.h> +#include <generators/igeneratableprojectvisitor.h> + +namespace qbs { + +class KeiluvProject; +class KeiluvWorkspace; + +class KeiluvGenerator final : public ProjectGenerator, + private IGeneratableProjectVisitor +{ +public: + explicit KeiluvGenerator(const KeiluvVersionInfo &versionInfo); + + QString generatorName() const final; + void generate() final; + +private: + void reset(); + + void visitProject(const GeneratableProject &project) final; + void visitProjectData(const GeneratableProject &project, + const GeneratableProjectData &projectData) final; + void visitProduct(const GeneratableProject &project, + const GeneratableProjectData &projectData, + const GeneratableProductData &productData) final; + + const KeiluvVersionInfo m_versionInfo; + std::shared_ptr<KeiluvWorkspace> m_workspace; + QString m_workspaceFilePath; + std::map<QString, std::shared_ptr<KeiluvProject>> m_projects; +}; + +} // namespace qbs + +#endif // QBS_KEILUVGENERATOR_H diff --git a/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp b/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp new file mode 100644 index 000000000..33e552936 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvgeneratorplugin.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "keiluvgenerator.h" +#include "keiluvversioninfo.h" + +#include <tools/projectgeneratormanager.h> +#include <tools/qbspluginmanager.h> + +static void QbsKeiluvGeneratorPluginLoad() +{ + for (const auto &info : qbs::KeiluvVersionInfo::knownVersions()) { + qbs::ProjectGeneratorManager::registerGenerator( + std::make_shared<qbs::KeiluvGenerator>(info)); + } +} + +static void QbsKeiluvGeneratorPluginUnload() +{ +} + +#ifndef GENERATOR_EXPORT +#if defined(WIN32) || defined(_WIN32) +#define GENERATOR_EXPORT __declspec(dllexport) +#else +#define GENERATOR_EXPORT __attribute__((visibility("default"))) +#endif +#endif + +QBS_REGISTER_STATIC_PLUGIN(extern "C" GENERATOR_EXPORT, QbsKeiluvGeneratorPlugin, + QbsKeiluvGeneratorPluginLoad, QbsKeiluvGeneratorPluginUnload) diff --git a/src/plugins/generator/keiluv/keiluvproject.cpp b/src/plugins/generator/keiluv/keiluvproject.cpp new file mode 100644 index 000000000..476ce8e69 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvproject.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "keiluvconstants.h" +#include "keiluvproject.h" +#include "keiluvutils.h" +#include "keiluvversioninfo.h" + +#include "archs/mcs51/mcs51buildtargetgroup_v5.h" +#include "archs/arm/armbuildtargetgroup_v5.h" + +#include <logging/translator.h> + +namespace qbs { + +static QString keilProjectSchema(const KeiluvVersionInfo &info) +{ + const auto v = info.marketingVersion(); + switch (v) { + case KeiluvConstants::v5::kUVisionVersion: + return QStringLiteral("2.1"); + default: + return {}; + } +} + +KeiluvProject::KeiluvProject( + const qbs::GeneratableProject &genProject, + const qbs::GeneratableProductData &genProduct, + const KeiluvVersionInfo &versionInfo) +{ + Q_ASSERT(genProject.projects.size() == genProject.commandLines.size()); + Q_ASSERT(genProject.projects.size() == genProduct.data.size()); + + // Create available configuration group factories. + m_factories.push_back(std::make_unique< + keiluv::mcs51::v5::Mcs51BuildTargetGroupFactory>()); + m_factories.push_back(std::make_unique< + keiluv::arm::v5::ArmBuildTargetGroupFactory>()); + + // Construct schema version item (is it depends on a project version?). + const auto schema = keilProjectSchema(versionInfo); + appendChild<gen::xml::Property>(QByteArrayLiteral("SchemaVersion"), + schema); + + // Construct targets group. + const auto targetsGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("Targets")); + + // Construct all build target items. + const int configsCount = std::max(genProject.projects.size(), + genProduct.data.size()); + for (auto configIndex = 0; configIndex < configsCount; ++configIndex) { + const qbs::Project qbsProject = genProject.projects + .values().at(configIndex); + const qbs::ProductData qbsProduct = genProduct.data + .values().at(configIndex); + const QString confName = gen::utils::buildConfigurationName(qbsProject); + const std::vector<ProductData> qbsProductDeps = gen::utils::dependenciesOf + (qbsProduct, genProject, confName); + + const auto arch = gen::utils::architecture(qbsProject); + if (arch == gen::utils::Architecture::Unknown) + throw ErrorInfo(Internal::Tr::tr("Target architecture is not set," + " please use the 'profile' option")); + + // Construct the build target item, which are depend from + // the architecture and the version. + const auto factoryEnd = m_factories.cend(); + const auto factoryIt = std::find_if(m_factories.cbegin(), factoryEnd, + [arch, versionInfo](const auto &factory) { + return factory->canCreate(arch, versionInfo.version()); + }); + if (factoryIt == factoryEnd) { + throw ErrorInfo(Internal::Tr::tr("Incompatible target architecture '%1'" + " for KEIL UV version %2") + .arg(gen::utils::architectureName(arch)) + .arg(versionInfo.marketingVersion())); + } + + auto targetGroup = (*factoryIt)->create( + qbsProject, qbsProduct, qbsProductDeps); + targetsGroup->appendChild(std::move(targetGroup)); + } +} + +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvproject.h b/src/plugins/generator/keiluv/keiluvproject.h new file mode 100644 index 000000000..98b2815ed --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvproject.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVPROJECT_H +#define QBS_KEILUVPROJECT_H + +#include <generators/generatordata.h> + +#include <generators/xmlproject.h> +#include <generators/xmlpropertygroup.h> + +#include <memory> + +namespace qbs { + +class KeiluvVersionInfo; + +class KeiluvProject final : public gen::xml::Project +{ +public: + explicit KeiluvProject( + const qbs::GeneratableProject &genProject, + const qbs::GeneratableProductData &genProduct, + const KeiluvVersionInfo &versionInfo); +private: + std::vector<std::unique_ptr<gen::xml::PropertyGroupFactory>> m_factories; +}; + +} // namespace qbs + +#endif // QBS_KEILUVPROJECT_H diff --git a/src/plugins/generator/keiluv/keiluvprojectwriter.cpp b/src/plugins/generator/keiluv/keiluvprojectwriter.cpp new file mode 100644 index 000000000..77616335c --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvprojectwriter.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "keiluvprojectwriter.h" + +namespace qbs { + +KeiluvProjectWriter::KeiluvProjectWriter(std::ostream *device) + : gen::xml::ProjectWriter(device) +{ +} + +void KeiluvProjectWriter::visitProjectStart(const gen::xml::Project *project) +{ + Q_UNUSED(project) + writer()->writeStartElement(QStringLiteral("Project")); + writer()->writeAttribute( + QStringLiteral("xmlns:xsi"), + QStringLiteral("http://www.w3.org/2001/XMLSchema-instance")); + writer()->writeAttribute( + QStringLiteral("xsi:noNamespaceSchemaLocation"), + QStringLiteral("project_proj.xsd")); +} + +void KeiluvProjectWriter::visitProjectEnd(const gen::xml::Project *project) +{ + Q_UNUSED(project) + writer()->writeEndElement(); +} + +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvprojectwriter.h b/src/plugins/generator/keiluv/keiluvprojectwriter.h new file mode 100644 index 000000000..6f890c8e8 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvprojectwriter.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVPROJECTWRITER_H +#define QBS_KEILUVPROJECTWRITER_H + +#include <generators/xmlprojectwriter.h> + +namespace qbs { + +class KeiluvProjectWriter final : public gen::xml::ProjectWriter +{ + Q_DISABLE_COPY(KeiluvProjectWriter) +public: + explicit KeiluvProjectWriter(std::ostream *device); + +private: + void visitProjectStart(const gen::xml::Project *project) final; + void visitProjectEnd(const gen::xml::Project *project) final; +}; + +} // namespace qbs + +#endif // QBS_KEILUVPROJECTWRITER_H diff --git a/src/plugins/generator/keiluv/keiluvutils.cpp b/src/plugins/generator/keiluv/keiluvutils.cpp new file mode 100644 index 000000000..8932f0f16 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvutils.cpp @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "keiluvutils.h" + +#include <generators/generatorutils.h> + +namespace qbs { +namespace KeiluvUtils { + +OutputBinaryType outputBinaryType(const ProductData &qbsProduct) +{ + const auto qbsProductType = qbsProduct.type(); + if (qbsProductType.contains(QLatin1String("application"))) + return ApplicationOutputType; + if (qbsProductType.contains(QLatin1String("staticlibrary"))) + return LibraryOutputType; + return ApplicationOutputType; +} + +QString toolkitRootPath(const ProductData &qbsProduct) +{ + QDir dir(qbsProduct.moduleProperties() + .getModuleProperty(Internal::StringConstants::cppModule(), + QStringLiteral("toolchainInstallPath")) + .toString()); + dir.cdUp(); + const auto path = dir.absolutePath(); + return QDir::toNativeSeparators(path); +} + +QStringList cppModuleCompilerFlags(const PropertyMap &qbsProps) +{ + return gen::utils::cppStringModuleProperties( + qbsProps, {QStringLiteral("driverFlags"), QStringLiteral("cFlags"), + QStringLiteral("cppFlags"), QStringLiteral("cxxFlags"), + QStringLiteral("commonCompilerFlags")}); +} + +QStringList cppModuleAssemblerFlags(const PropertyMap &qbsProps) +{ + return gen::utils::cppStringModuleProperties( + qbsProps, {QStringLiteral("assemblerFlags")}); +} + +QStringList cppModuleLinkerFlags(const PropertyMap &qbsProps) +{ + return gen::utils::cppStringModuleProperties( + qbsProps, {QStringLiteral("driverLinkerFlags")}); +} + +QStringList includes(const PropertyMap &qbsProps) +{ + auto paths = gen::utils::cppStringModuleProperties( + qbsProps, {QStringLiteral("includePaths"), + QStringLiteral("systemIncludePaths")}); + // Transform include path separators to native. + std::transform(paths.begin(), paths.end(), paths.begin(), + [](const auto &path) { + return QDir::toNativeSeparators(path); + }); + return paths; +} + +QStringList defines(const PropertyMap &qbsProps) +{ + return gen::utils::cppStringModuleProperties( + qbsProps, {QStringLiteral("defines")}); +} + +QStringList staticLibraries(const PropertyMap &qbsProps) +{ + auto libs = gen::utils::cppStringModuleProperties( + qbsProps, {QStringLiteral("staticLibraries")}); + // Transform library path separators to native. + std::transform(libs.begin(), libs.end(), libs.begin(), + [](const auto &path) { + return QDir::toNativeSeparators(path); + }); + return libs; +} + +QStringList dependencies(const std::vector<ProductData> &qbsProductDeps) +{ + QStringList deps; + for (const ProductData &qbsProductDep : qbsProductDeps) { + const auto path = qbsProductDep.buildDirectory() + + QLatin1String("/obj/") + + gen::utils::targetBinary(qbsProductDep); + deps.push_back(QDir::toNativeSeparators(path)); + } + return deps; +} + +} // namespace KeiluvUtils +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvutils.h b/src/plugins/generator/keiluv/keiluvutils.h new file mode 100644 index 000000000..92209dc53 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvutils.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVUTILS_H +#define QBS_KEILUVUTILS_H + +#include <qbs.h> + +#include <tools/stringconstants.h> + +namespace qbs { +namespace KeiluvUtils { + +enum OutputBinaryType { + ApplicationOutputType, + LibraryOutputType +}; + +OutputBinaryType outputBinaryType(const ProductData &qbsProduct); + +QString toolkitRootPath(const ProductData &qbsProduct); + +QStringList cppModuleCompilerFlags(const PropertyMap &qbsProps); + +QStringList cppModuleAssemblerFlags(const PropertyMap &qbsProps); + +QStringList cppModuleLinkerFlags(const PropertyMap &qbsProps); + +QStringList includes(const PropertyMap &qbsProps); +QStringList defines(const PropertyMap &qbsProps); +QStringList staticLibraries(const PropertyMap &qbsProps); +QStringList dependencies(const std::vector<ProductData> &qbsProductDeps); + +} // namespace KeiluvUtils +} // namespace qbs + +#endif // QBS_KEILUVUTILS_H diff --git a/src/plugins/generator/keiluv/keiluvversioninfo.cpp b/src/plugins/generator/keiluv/keiluvversioninfo.cpp new file mode 100644 index 000000000..973d0a420 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvversioninfo.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "keiluvconstants.h" +#include "keiluvversioninfo.h" + +#include <QtCore/qdebug.h> + +namespace qbs { + +KeiluvVersionInfo::KeiluvVersionInfo( + const Version &version, + const std::set<gen::utils::Architecture> &archs) + : gen::VersionInfo(version, archs) +{ +} + +std::set<KeiluvVersionInfo> KeiluvVersionInfo::knownVersions() +{ + static const std::set<KeiluvVersionInfo> known = { + {Version(KeiluvConstants::v5::kUVisionVersion), + {gen::utils::Architecture::Mcs51, + gen::utils::Architecture::Arm}}, + }; + return known; +} + +int KeiluvVersionInfo::marketingVersion() const +{ + const auto mv = gen::VersionInfo::marketingVersion(); + for (const KeiluvVersionInfo &known : knownVersions()) { + if (known.version().majorVersion() == mv) + return mv; + } + qWarning() << QStringLiteral("Unrecognized KEIL UV version: ") + << version().toString(); + return 0; +} + +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvversioninfo.h b/src/plugins/generator/keiluv/keiluvversioninfo.h new file mode 100644 index 000000000..a64513492 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvversioninfo.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBS_KEILUVVERSIONINFO_H +#define QBS_KEILUVVERSIONINFO_H + +#include <generators/generatorutils.h> +#include <generators/generatorversioninfo.h> + +namespace qbs { + +class KeiluvVersionInfo final : public gen::VersionInfo +{ +public: + KeiluvVersionInfo(const Version &version, + const std::set<gen::utils::Architecture> &archs); + + int marketingVersion() const final; + + static std::set<KeiluvVersionInfo> knownVersions(); +}; + +} // namespace qbs + +#endif // QBS_KEILUVVERSIONINFO_H diff --git a/src/plugins/generator/keiluv/keiluvworkspace.cpp b/src/plugins/generator/keiluv/keiluvworkspace.cpp new file mode 100644 index 000000000..b4df92001 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvworkspace.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "keiluvworkspace.h" + +#include <generators/xmlpropertygroup.h> + +namespace qbs { + +KeiluvWorkspace::KeiluvWorkspace(const QString &workspacePath) + : gen::xml::Workspace(workspacePath) +{ + // Construct schema version item. + appendChild<gen::xml::Property>(QByteArrayLiteral("SchemaVersion"), + QStringLiteral("1.0")); + + // Construct workspace name item. + appendChild<gen::xml::Property>(QByteArrayLiteral("WorkspaceName"), + QStringLiteral("WorkSpace")); +} + +void KeiluvWorkspace::addProject(const QString &projectFilePath) +{ + const QString relativeProjectPath = QDir::toNativeSeparators( + m_baseDirectory.relativeFilePath(projectFilePath)); + + const auto projectGroup = appendChild<gen::xml::PropertyGroup>( + QByteArrayLiteral("project")); + projectGroup->appendProperty("PathAndName", relativeProjectPath); +} + +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvworkspace.h b/src/plugins/generator/keiluv/keiluvworkspace.h new file mode 100644 index 000000000..2b274c99f --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvworkspace.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 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. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBS_KEILUVWORKSPACE_H +#define QBS_KEILUVWORKSPACE_H + +#include <generators/xmlworkspace.h> + +namespace qbs { + +class KeiluvWorkspace final : public gen::xml::Workspace +{ +public: + explicit KeiluvWorkspace(const QString &workspacePath); + void addProject(const QString &projectPath) final; +}; + +} // namespace qbs + +#endif // QBS_KEILUVWORKSPACE_H diff --git a/src/plugins/generator/keiluv/keiluvworkspacewriter.cpp b/src/plugins/generator/keiluv/keiluvworkspacewriter.cpp new file mode 100644 index 000000000..c886b0e6e --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvworkspacewriter.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "keiluvworkspacewriter.h" + +namespace qbs { + +KeiluvWorkspaceWriter::KeiluvWorkspaceWriter(std::ostream *device) + : gen::xml::WorkspaceWriter(device) +{ +} + +void KeiluvWorkspaceWriter::visitWorkspaceStart(const gen::xml::Workspace *workspace) +{ + Q_UNUSED(workspace) + writer()->writeStartElement(QStringLiteral("ProjectWorkspace")); + writer()->writeAttribute( + QStringLiteral("xmlns:xsi"), + QStringLiteral("http://www.w3.org/2001/XMLSchema-instance")); + writer()->writeAttribute( + QStringLiteral("xsi:noNamespaceSchemaLocation"), + QStringLiteral("project_mpw.xsd")); +} + +void KeiluvWorkspaceWriter::visitWorkspaceEnd(const gen::xml::Workspace *workspace) +{ + Q_UNUSED(workspace) + writer()->writeEndElement(); +} + +} // namespace qbs diff --git a/src/plugins/generator/keiluv/keiluvworkspacewriter.h b/src/plugins/generator/keiluv/keiluvworkspacewriter.h new file mode 100644 index 000000000..2419ad761 --- /dev/null +++ b/src/plugins/generator/keiluv/keiluvworkspacewriter.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com> +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QBS_KEILUVWORKSPACEWRITER_H +#define QBS_KEILUVWORKSPACEWRITER_H + +#include <generators/xmlworkspacewriter.h> + +namespace qbs { + +class KeiluvWorkspaceWriter final : public gen::xml::WorkspaceWriter +{ + Q_DISABLE_COPY(KeiluvWorkspaceWriter) +public: + explicit KeiluvWorkspaceWriter(std::ostream *device); + +private: + void visitWorkspaceStart(const gen::xml::Workspace *workspace) final; + void visitWorkspaceEnd(const gen::xml::Workspace *workspace) final; +}; + +} // namespace qbs + +#endif // QBS_KEILUVWORKSPACEWRITER_H |