aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/generator/keiluv/archs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/generator/keiluv/archs')
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.cpp108
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armbuildtargetgroup_v5.h70
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armcommonpropertygroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armdebugoptiongroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armdlloptiongroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.cpp154
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetassemblergroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.cpp208
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetcommonoptionsgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.cpp218
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetcompilergroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.cpp56
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.cpp164
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetlinkergroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.cpp75
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armtargetmiscgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/arm/armutilitiesgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.cpp109
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51buildtargetgroup_v5.h70
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51commonpropertygroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51debugoptiongroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51dlloptiongroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.cpp143
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetassemblergroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.cpp140
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetcommonoptionsgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.cpp281
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetcompilergroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.cpp56
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.cpp240
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetlinkergroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.cpp104
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51targetmiscgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.cpp50
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51utilitiesgroup_v5.h54
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51utils.cpp83
-rw-r--r--src/plugins/generator/keiluv/archs/mcs51/mcs51utils.h56
46 files changed, 3815 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