feat(config): add vbs migrate to scaffold build.cpp from CMakeLists
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 6s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 13s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 6s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 50s

This commit is contained in:
faumaray committed 2026-12-05 09:28:12 +03:00
1 parent 1b803f7a22
commit 399b52c31c
10 files changed
+599 -1

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
#pragma once
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <filesystem>
#include <string>
#include <vector>
namespace Void::Build::Config {
// One imported CMake target projected onto VBS declarations.
struct MigratedTarget {
std::string name;
std::string kind; // "executable", "static", "shared" or "interface"
std::vector<std::string> sources;
std::vector<std::string> public_links;
std::vector<std::string> private_links;
std::vector<std::string> public_includes;
std::vector<std::string> private_includes;
std::vector<std::string> public_defines;
std::vector<std::string> private_defines;
bool installed{false};
std::string install_destination;
};
struct MigrationResult {
std::string project_name;
std::vector<MigratedTarget> targets;
// Constructs that were recognised but not translated (reported, never silently dropped).
std::vector<std::string> notes;
};
// Bounded CMakeLists.txt reader: understands `project`, `set`, `add_executable`,
// `add_library`, `target_link_libraries`, `target_include_directories`,
// `target_compile_definitions`, and `install(TARGETS ...)`. Everything else is reported as a
// note. Generator expressions and most CMake language features are out of scope.
[[nodiscard]] Void::Result::Result<MigrationResult, Void::Result::Error>
import_cmake_lists(const std::filesystem::path &cmake_file,
const std::filesystem::path &project_root);
// Renders the imported targets as a `build.cpp` scaffold.
[[nodiscard]] std::string render_build_cpp(const MigrationResult &result);
} // namespace Void::Build::Config