46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "breeze/Project.hpp"
|
|
|
|
/// The project's CMake presets, which are what a platform, an architecture and a compiler mean:
|
|
/// every SDK names its configure presets "<platform>-<arch>-<compiler>" (linux-x64-gcc,
|
|
/// windows-x64-clang-cl).
|
|
namespace breeze
|
|
{
|
|
|
|
struct Preset
|
|
{
|
|
std::string name;
|
|
std::string description;
|
|
std::string platform; // linux, macos, windows
|
|
std::string arch; // x64, x86, arm32, arm64
|
|
std::string compiler; // the rest of the name: gcc, clang, msvc, clang-cl, mingw64, ...
|
|
};
|
|
|
|
/// The configure presets usable on this machine (what `cmake --list-presets` shows).
|
|
std::vector<Preset> listPresets(const Project& project);
|
|
|
|
/// What was asked for; every field is optional and compared ignoring case and punctuation
|
|
/// ("ClangCl" finds clang-cl).
|
|
struct PresetQuery
|
|
{
|
|
std::optional<std::string> preset;
|
|
std::optional<std::string> platform;
|
|
std::optional<std::string> arch;
|
|
std::optional<std::string> compiler;
|
|
};
|
|
|
|
/// The preset a command should use: the named preset; else one made from the platform,
|
|
/// architecture and compiler given, the project's defaults and then this machine for whatever
|
|
/// is missing; else the project's default preset; else none (the SDK's own default). Throws an
|
|
/// Error that lists the choices when what was asked for doesn't exist. `note` gets a line to
|
|
/// show the user when the choice involved a guess.
|
|
std::optional<std::string> resolvePreset(const Project& project, const Defaults& defaults,
|
|
const PresetQuery& query, std::string* note = nullptr);
|
|
|
|
}
|