diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-08-02 19:30:15 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-08-20 11:29:48 +0000 |
commit | 276a969d857922367a65a36b16f885745ea4a5f2 (patch) | |
tree | 003e8f638a10a461f20e2968aa33493bc4996b13 /src/plugins/generator | |
parent | 17f7e6a79e17fe19e0bf5c6f9189ca513406740d (diff) | |
download | qbs-276a969d857922367a65a36b16f885745ea4a5f2.tar.gz |
baremetal: Long live the KEIL UV project generator for ARM
Right now it is possible to generate a native projects for the
KEIL UVision IDE, e.g. using the following command:
qbs generate -g keiluv5 -d <path/to/build/directory> -f <path/to/qbs/project> profile:<your/qbs/profile>
We need in a valid KEIL QBS profile, from which the generator take
a desired target architecture and other stuff.
The KEIL UV generator has a semi-intelligent logic, it parses a source
QBS project and converts a compiler flags and other stuff to an
appropriate configurations of the native KEIL UVsion project.
Currently it is supported only one 'keiluv5' generator which allow to
generate a projects for the KEIL UVision v5 for ARM architecture.
Tested with the KEIL UVision v5.23 for ARM, using as the QBS
bare-metal examples, and as other projects.
Change-Id: I3af9d01f25a9570a99a62d4ce2c30fec3566b9a1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/generator')
30 files changed, 1912 insertions, 36 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..511a16ab8 --- /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("generateMapFile")); + } + + 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 index ce013fba5..87b3100db 100644 --- a/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.cpp +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.cpp @@ -37,8 +37,8 @@ #include "mcs51utilitiesgroup_v5.h" #include "mcs51utils.h" +#include "../../keiluvconstants.h" #include "../../keiluvfilesgroupspropertygroup.h" -#include "../../keiluvutils.h" namespace qbs { namespace keiluv { @@ -89,7 +89,7 @@ bool Mcs51BuildTargetGroupFactory::canCreate( const Version &version) const { return arch == gen::utils::Architecture::Mcs51 - && version.majorVersion() == KeiluvConstants::kUVisionVersion; + && version.majorVersion() == qbs::KeiluvConstants::v5::kUVisionVersion; } std::unique_ptr<gen::xml::PropertyGroup> diff --git a/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h b/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h index f6ed7e4eb..a1a9706e4 100644 --- a/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h +++ b/src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h @@ -49,19 +49,8 @@ QStringList flagValueParts(const QString &flagValue, } // namespace KeiluvUtils -namespace v5 { - -namespace KeiluvConstants { - -constexpr int kUVisionVersion = 5; - -} // namespace KeiluvConstants - -} // namespace v5 - } // 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 index d260adea1..ba3e4d27b 100644 --- a/src/plugins/generator/keiluv/keiluv.pro +++ b/src/plugins/generator/keiluv/keiluv.pro @@ -13,6 +13,7 @@ SOURCES += \ # Common files. HEADERS += \ + $$PWD/keiluvconstants.h \ $$PWD/keiluvfilesgroupspropertygroup.h \ $$PWD/keiluvgenerator.h \ $$PWD/keiluvproject.h \ @@ -61,3 +62,31 @@ SOURCES += \ $$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 index 62e03593c..65bf6d65b 100644 --- a/src/plugins/generator/keiluv/keiluv.qbs +++ b/src/plugins/generator/keiluv/keiluv.qbs @@ -59,4 +59,32 @@ QbsPlugin { "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/keiluvgenerator.cpp b/src/plugins/generator/keiluv/keiluvgenerator.cpp index 657a98ad4..e3c959e8d 100644 --- a/src/plugins/generator/keiluv/keiluvgenerator.cpp +++ b/src/plugins/generator/keiluv/keiluvgenerator.cpp @@ -35,6 +35,7 @@ #include "keiluvworkspacewriter.h" #include <generators/generatableprojectiterator.h> +#include <generators/generatorutils.h> #include <logging/logger.h> #include <logging/translator.h> @@ -43,19 +44,6 @@ namespace qbs { -static QString targetFilePath(const QString &baseName, - const QString &baseBuildDirectory) -{ - return QDir(baseBuildDirectory).absoluteFilePath( - baseName + QStringLiteral(".uvproj")); -} - -static QString targetFilePath(const GeneratableProductData &product, - const QString &baseBuildDirectory) -{ - return targetFilePath(product.name(), baseBuildDirectory); -} - static void writeProjectFiles(const std::map<QString, std::shared_ptr<KeiluvProject>> &projects, const Internal::Logger &logger) @@ -147,8 +135,10 @@ void KeiluvGenerator::visitProduct( const GeneratableProductData &productData) { Q_UNUSED(projectData); - const QString projectFilePath = targetFilePath( - productData, project.baseBuildDirectory().absolutePath()); + + 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); diff --git a/src/plugins/generator/keiluv/keiluvproject.cpp b/src/plugins/generator/keiluv/keiluvproject.cpp index bd5e80658..476ce8e69 100644 --- a/src/plugins/generator/keiluv/keiluvproject.cpp +++ b/src/plugins/generator/keiluv/keiluvproject.cpp @@ -28,12 +28,13 @@ ** ****************************************************************************/ +#include "keiluvconstants.h" #include "keiluvproject.h" #include "keiluvutils.h" #include "keiluvversioninfo.h" #include "archs/mcs51/mcs51buildtargetgroup_v5.h" -#include "archs/mcs51/mcs51utils.h" +#include "archs/arm/armbuildtargetgroup_v5.h" #include <logging/translator.h> @@ -43,8 +44,8 @@ static QString keilProjectSchema(const KeiluvVersionInfo &info) { const auto v = info.marketingVersion(); switch (v) { - case keiluv::mcs51::v5::KeiluvConstants::kUVisionVersion: - return QStringLiteral("1.1"); + case KeiluvConstants::v5::kUVisionVersion: + return QStringLiteral("2.1"); default: return {}; } @@ -61,8 +62,10 @@ KeiluvProject::KeiluvProject( // 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 (depends on a project version). + // Construct schema version item (is it depends on a project version?). const auto schema = keilProjectSchema(versionInfo); appendChild<gen::xml::Property>(QByteArrayLiteral("SchemaVersion"), schema); diff --git a/src/plugins/generator/keiluv/keiluvversioninfo.cpp b/src/plugins/generator/keiluv/keiluvversioninfo.cpp index 544a07aff..973d0a420 100644 --- a/src/plugins/generator/keiluv/keiluvversioninfo.cpp +++ b/src/plugins/generator/keiluv/keiluvversioninfo.cpp @@ -37,10 +37,9 @@ ** ****************************************************************************/ +#include "keiluvconstants.h" #include "keiluvversioninfo.h" -#include "archs/mcs51/mcs51utils.h" - #include <QtCore/qdebug.h> namespace qbs { @@ -55,8 +54,9 @@ KeiluvVersionInfo::KeiluvVersionInfo( std::set<KeiluvVersionInfo> KeiluvVersionInfo::knownVersions() { static const std::set<KeiluvVersionInfo> known = { - {Version(keiluv::mcs51::v5::KeiluvConstants::kUVisionVersion), - {gen::utils::Architecture::Mcs51}}, + {Version(KeiluvConstants::v5::kUVisionVersion), + {gen::utils::Architecture::Mcs51, + gen::utils::Architecture::Arm}}, }; return known; } |