// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #pragma once #include "cmakeconfigitem.h" #include #include #include #include namespace CMakeProjectManager::Internal { namespace PresetsDetails { class ValueStrategyPair { public: std::optional value; enum class Strategy : bool { set, external }; std::optional strategy; }; class Warnings { public: std::optional dev; std::optional deprecated; std::optional uninitialized = false; std::optional unusedCli = true; std::optional systemVars = false; }; class Errors { public: std::optional dev; std::optional deprecated; }; class Debug { public: std::optional output = false; std::optional tryCompile = false; std::optional find = false; }; class Condition { public: QString type; bool isNull() const { return type == "null"; } bool isConst() const { return type == "const"; } bool isEquals() const { return type == "equals"; } bool isNotEquals() const { return type == "notEquals"; } bool isInList() const { return type == "inList"; } bool isNotInList() const { return type == "notInList"; } bool isMatches() const { return type == "matches"; } bool isNotMatches() const { return type == "notMatches"; } bool isAnyOf() const { return type == "anyOf"; } bool isAllOf() const { return type == "allOf"; } bool isNot() const { return type == "not"; } bool evaluate() const; // const std::optional constValue; // equals, notEquals std::optional lhs; std::optional rhs; // inList, notInList std::optional string; std::optional list; // matches, notMatches std::optional regex; using ConditionPtr = std::shared_ptr; // anyOf, allOf std::optional> conditions; // not std::optional condition; }; class ConfigurePreset { public: void inheritFrom(const ConfigurePreset &other); QString name; Utils::FilePath fileDir; std::optional hidden = false; std::optional inherits; std::optional condition; std::optional> vendor; std::optional displayName; std::optional description; std::optional generator; std::optional architecture; std::optional toolset; std::optional toolchainFile; std::optional binaryDir; std::optional installDir; std::optional cmakeExecutable; std::optional cacheVariables; std::optional environment; std::optional warnings; std::optional errors; std::optional debug; }; class BuildPreset { public: void inheritFrom(const BuildPreset &other); QString name; Utils::FilePath fileDir; std::optional hidden = false; std::optional inherits; std::optional condition; std::optional> vendor; std::optional displayName; std::optional description; std::optional environment; std::optional configurePreset; std::optional inheritConfigureEnvironment = true; std::optional jobs; std::optional targets; std::optional configuration; std::optional verbose; std::optional cleanFirst; std::optional nativeToolOptions; }; } // namespace PresetsDetails class PresetsData { public: int version = 0; QVersionNumber cmakeMinimimRequired; QHash vendor; std::optional include; Utils::FilePath fileDir; QList configurePresets; QList buildPresets; }; class PresetsParser { PresetsData m_presetsData; public: bool parse(Utils::FilePath const &jsonFile, QString &errorMessage, int &errorLine); const PresetsData &presetsData() const; }; } // CMakeProjectManager::Internal