feat(config): import CMake configure presets
This commit is contained in:
1 parent
7772697a48
commit
083af6af79
10 files changed
+387
-1
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/Functional/Error.hpp>
|
||||
#include <Void/Functional/Result.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Void::Build::Config {
|
||||
|
||||
// One imported CMake configure preset projected onto VBS concepts.
|
||||
struct ImportedPreset {
|
||||
std::string name;
|
||||
std::string generator; // Recorded for diagnostics; VBS has no generator.
|
||||
std::optional<std::string> build_dir; // binaryDir with ${sourceDir} expanded.
|
||||
std::string build_type; // Raw CMAKE_BUILD_TYPE (may be empty).
|
||||
std::string profile{"debug"}; // Mapped VBS profile: debug or release.
|
||||
std::string compiler{"gcc"}; // Mapped VBS compiler family: gcc or clang.
|
||||
std::map<std::string, std::string, std::less<>> cache_variables;
|
||||
};
|
||||
|
||||
// Parses `CMakePresets.json`-style configure presets, resolving `inherits`
|
||||
// (string or array) and projecting build type/compiler onto VBS defaults.
|
||||
// The project root is used to expand `${sourceDir}`.
|
||||
[[nodiscard]] Void::Result::Result<std::vector<ImportedPreset>, Void::Result::Error>
|
||||
load_cmake_presets(const std::filesystem::path &presets_file,
|
||||
const std::filesystem::path &project_root);
|
||||
|
||||
// Shell-safe single-quoted argument for the suggested `vbs` command line.
|
||||
[[nodiscard]] std::string suggested_build_command(const ImportedPreset &preset);
|
||||
|
||||
} // namespace Void::Build::Config
|
||||
Reference in new issue
Block a user