diff options
author | Alexis Jeandet <alexis.jeandet@member.fsf.org> | 2020-05-01 18:20:56 +0200 |
---|---|---|
committer | Alexis Jeandet <alexis.jeandet@member.fsf.org> | 2020-06-08 09:55:17 +0000 |
commit | 77d7bb5014a79db539f82d95392d07c6bda9d6a8 (patch) | |
tree | 8249ab051adc2962203355c8ec59abde420106d8 /src/plugins/mesonprojectmanager/kithelper | |
parent | a8f38f8aab5303bb6e0c6575508661b51b7aebc3 (diff) |
Meson build plugin initial support
Most basic project management is implemented:
- Project config/build
- Build options accessible to user
- Lists most build targets
- Meson and Ninja added to kit setup
- Basic project file tree with files known by Meson
- Some basic meson and ninja process output parsing
- Some project templates
Missing features, that will come later:
- Configurable project tree layout
- Locators for Meson
- Build importer
- Access to Machine files for better user fine tuning
- ...
Fixes: QTCREATORBUG-18117
Change-Id: I2811e71562c113fb0fc6b6177bcf0698fa71ef63
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/mesonprojectmanager/kithelper')
-rw-r--r-- | src/plugins/mesonprojectmanager/kithelper/kitdata.h | 41 | ||||
-rw-r--r-- | src/plugins/mesonprojectmanager/kithelper/kithelper.h | 100 |
2 files changed, 141 insertions, 0 deletions
diff --git a/src/plugins/mesonprojectmanager/kithelper/kitdata.h b/src/plugins/mesonprojectmanager/kithelper/kitdata.h new file mode 100644 index 00000000000..a4463a66402 --- /dev/null +++ b/src/plugins/mesonprojectmanager/kithelper/kitdata.h @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Alexis Jeandet. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ +#pragma once +#include <utils/cpplanguage_details.h> +#include <QString> +namespace MesonProjectManager { +namespace Internal { +struct KitData +{ + QString cCompilerPath; + QString cxxCompilerPath; + QString cmakePath; + QString qmakePath; + QString qtVersionStr; + Utils::QtVersion qtVersion; +}; + +} // namespace Internal +} // namespace MesonProjectManager diff --git a/src/plugins/mesonprojectmanager/kithelper/kithelper.h b/src/plugins/mesonprojectmanager/kithelper/kithelper.h new file mode 100644 index 00000000000..9f0f8295e36 --- /dev/null +++ b/src/plugins/mesonprojectmanager/kithelper/kithelper.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Alexis Jeandet. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ +#include "kitdata.h" +#include <projectexplorer/kit.h> +#include <projectexplorer/kitinformation.h> +#include <utils/macroexpander.h> +#include <utils/qtcassert.h> +#include <versionhelper.h> +#include <QString> +#pragma once +namespace MesonProjectManager { +namespace Internal { +namespace KitHelper { +namespace details { +inline QString expand(const ProjectExplorer::Kit *kit, const QString ¯o) +{ + return kit->macroExpander()->expand(macro); +} +} // namespace details + +inline QString cCompilerPath(const ProjectExplorer::Kit *kit) +{ + QTC_ASSERT(kit, return ""); + return details::expand(kit, "%{Compiler:Executable:C}"); +} + +inline QString cxxCompilerPath(const ProjectExplorer::Kit *kit) +{ + QTC_ASSERT(kit, return ""); + return details::expand(kit, "%{Compiler:Executable:Cxx}"); +} + +inline QString qmakePath(const ProjectExplorer::Kit *kit) +{ + return details::expand(kit, "%{Qt:qmakeExecutable}"); +} + +inline QString cmakePath(const ProjectExplorer::Kit *kit) +{ + return details::expand(kit, "%{CMake:Executable:FilePath}"); +} + +inline QString qtVersion(const ProjectExplorer::Kit *kit) +{ + QTC_ASSERT(kit, return ""); + return details::expand(kit, "%{Qt:Version}"); +} + +inline KitData kitData(const ProjectExplorer::Kit *kit) +{ + QTC_ASSERT(kit, return {}); + KitData data; + data.cCompilerPath = cCompilerPath(kit); + data.cxxCompilerPath = cxxCompilerPath(kit); + data.cmakePath = cmakePath(kit); + data.qmakePath = qmakePath(kit); + data.qtVersionStr = qtVersion(kit); + data.qtVersion = Utils::QtVersion::None; + auto version = Version::fromString(data.qtVersionStr); + if (version.isValid) { + switch (version.major) { + case 4: + data.qtVersion = Utils::QtVersion::Qt4; + break; + case 5: + data.qtVersion = Utils::QtVersion::Qt5; + break; + default: + data.qtVersion = Utils::QtVersion::Unknown; + } + } + return data; +} + +} // namespace KitHelper + +} // namespace Internal +} // namespace MesonProjectManager |