feat(translation,ide): add native C driver, Ninja custom commands, CMake CXX_MODULES, and vbs ide integration
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
This commit is contained in:
1 parent
5e1916dc5c
commit
6c225c2dff
27 files changed
+3443
-331
No files matched your search
@@ -32,6 +32,7 @@ enum class TargetKind {
|
||||
enum class SourceKind { File, Glob, ModuleInterface, ModulePartition, HeaderUnit };
|
||||
enum class LinkKind { Local, Imported };
|
||||
enum class DependencySourceKind { Unspecified, Git, Package, Path, Archive, Conan };
|
||||
enum class CStandard { Default, C11, C17, C23 };
|
||||
enum class CxxStandard { Default, Cxx17, Cxx20, Cxx23, Cxx26 };
|
||||
enum class LtoMode { None, Full, Thin };
|
||||
enum class Sanitizer { Address, Undefined, Thread, Memory, Leak };
|
||||
@@ -44,6 +45,8 @@ enum class Sanitizer { Address, Undefined, Thread, Memory, Leak };
|
||||
[[nodiscard]] TargetKind parse_target_kind(std::string_view name);
|
||||
[[nodiscard]] std::string_view source_kind_name(SourceKind kind);
|
||||
[[nodiscard]] SourceKind parse_source_kind(std::string_view name);
|
||||
[[nodiscard]] std::string_view c_standard_name(CStandard standard);
|
||||
[[nodiscard]] CStandard parse_c_standard(std::string_view name);
|
||||
[[nodiscard]] std::string_view cxx_standard_name(CxxStandard standard);
|
||||
[[nodiscard]] CxxStandard parse_cxx_standard(std::string_view name);
|
||||
[[nodiscard]] std::string_view lto_mode_name(LtoMode mode);
|
||||
@@ -59,6 +62,7 @@ struct ProfileContext {
|
||||
std::vector<std::string> compile_options;
|
||||
std::vector<std::string> link_options;
|
||||
std::vector<std::string> defines;
|
||||
CStandard c_standard{CStandard::Default};
|
||||
CxxStandard cxx_standard{CxxStandard::Default};
|
||||
LtoMode lto{LtoMode::None};
|
||||
std::vector<Sanitizer> sanitizers;
|
||||
@@ -75,6 +79,7 @@ struct ProfileDescription {
|
||||
std::vector<std::string> link_options;
|
||||
std::vector<std::string> defines;
|
||||
std::optional<CompilerFamily> compiler;
|
||||
std::optional<CStandard> c_standard;
|
||||
std::optional<CxxStandard> cxx_standard;
|
||||
std::optional<LtoMode> lto;
|
||||
std::vector<Sanitizer> sanitizers;
|
||||
@@ -183,6 +188,7 @@ struct TargetRecord {
|
||||
std::vector<ScopedOption> defines;
|
||||
std::vector<ScopedOption> link_options;
|
||||
std::vector<std::string> prerequisites;
|
||||
CStandard c_standard{CStandard::Default};
|
||||
CxxStandard cxx_standard{CxxStandard::Default};
|
||||
std::string precompiled_header;
|
||||
bool unity_enabled{false};
|
||||
@@ -248,6 +254,7 @@ class Target {
|
||||
Target &link(const Target &target, Visibility visibility = Visibility::Private);
|
||||
Target &link(const ImportedTarget &target, Visibility visibility = Visibility::Private);
|
||||
Target &depends_on(const Target &producer);
|
||||
Target &c_standard(CStandard standard);
|
||||
Target &cxx_standard(CxxStandard standard);
|
||||
Target &precompiled_header(std::string header_path);
|
||||
Target &unity_build(bool enabled, std::size_t batch_size = 8);
|
||||
|
||||
@@ -51,6 +51,8 @@ struct PublishOptions {
|
||||
bool update_selection{false}; // False for watchers (never steal selection!).
|
||||
std::optional<std::uint64_t> reserved_ticket;
|
||||
bool manage_project_root_alias{true};
|
||||
std::filesystem::path sdk_include_dir;
|
||||
std::vector<std::filesystem::path> extra_build_sources;
|
||||
};
|
||||
|
||||
// Projects all compile actions across ALL configured enabled targets in `graph`
|
||||
@@ -59,6 +61,44 @@ struct PublishOptions {
|
||||
[[nodiscard]] std::vector<EditorCommandEntry>
|
||||
project_editor_commands(const Graph::BuildGraph &graph);
|
||||
|
||||
// Projects build description files (`build.cpp`, `build.profiles.cpp`, `build-support/`,
|
||||
// and extra sources) so clangd/IDEs index `<Void/Build.hpp>` natively.
|
||||
[[nodiscard]] std::vector<EditorCommandEntry> project_build_descriptor_commands(
|
||||
const std::filesystem::path &project_root, const std::filesystem::path &build_root,
|
||||
const std::filesystem::path &sdk_include_dir, const std::filesystem::path &host_cxx_compiler,
|
||||
const std::vector<std::filesystem::path> &extra_build_sources = {});
|
||||
|
||||
enum class IdeKind { Clangd, VsCode, CLion, Zed, All };
|
||||
|
||||
struct IdeConfigOptions {
|
||||
std::filesystem::path project_root;
|
||||
std::filesystem::path build_root;
|
||||
std::filesystem::path sdk_include_dir;
|
||||
std::filesystem::path vbs_executable{"vbs"};
|
||||
std::filesystem::path compdb_path;
|
||||
IdeKind editor{IdeKind::All};
|
||||
bool force{false};
|
||||
};
|
||||
|
||||
struct IdeConfigReport {
|
||||
std::vector<std::filesystem::path> written_files;
|
||||
std::vector<std::filesystem::path> skipped_existing_files;
|
||||
};
|
||||
|
||||
[[nodiscard]] Void::Result::Result<IdeKind, Void::Result::Error>
|
||||
parse_ide_kind(std::string_view name);
|
||||
|
||||
[[nodiscard]] std::string_view ide_kind_name(IdeKind kind);
|
||||
|
||||
// Writes non-destructive IDE configurations (.clangd, .vscode/, .idea/, .zed/) for `graph`.
|
||||
[[nodiscard]] Void::Result::Result<IdeConfigReport, Void::Result::Error>
|
||||
generate_ide_configs(const Graph::BuildGraph &graph, const IdeConfigOptions &options);
|
||||
|
||||
// Emits versioned JSON workspace/target metadata for external IDE plugins (`vbs ide query`).
|
||||
[[nodiscard]] std::string format_ide_query_json(const Graph::BuildGraph &graph,
|
||||
const std::filesystem::path &compdb_path,
|
||||
const std::filesystem::path &sdk_include_dir);
|
||||
|
||||
// Formats standard Clang JSONCompilationDatabase array (arguments/file/directory/output).
|
||||
[[nodiscard]] std::string
|
||||
format_compile_commands_json(const std::vector<EditorCommandEntry> &entries);
|
||||
|
||||
@@ -42,6 +42,7 @@ struct ImportedTargetInterface {
|
||||
std::vector<std::filesystem::path> shared_libraries;
|
||||
std::vector<std::filesystem::path> runtime_files;
|
||||
std::vector<std::filesystem::path> generated_prerequisites;
|
||||
std::map<std::string, std::filesystem::path, std::less<>> module_bmis;
|
||||
};
|
||||
|
||||
enum class ActionKind {
|
||||
@@ -79,6 +80,8 @@ struct ActionNode {
|
||||
std::vector<std::pair<std::filesystem::path, bool>> physical_include_dirs;
|
||||
std::vector<std::string> defines;
|
||||
std::vector<std::string> compile_options;
|
||||
bool is_c_source{false};
|
||||
CStandard c_standard{CStandard::Default};
|
||||
CxxStandard cxx_standard{CxxStandard::Default};
|
||||
LtoMode lto{LtoMode::None};
|
||||
std::vector<Sanitizer> sanitizers;
|
||||
@@ -98,6 +101,7 @@ struct ResolvedTargetSummary {
|
||||
std::vector<std::filesystem::path> expanded_sources;
|
||||
std::vector<std::filesystem::path> primary_outputs;
|
||||
std::vector<std::filesystem::path> runtime_shared_libraries;
|
||||
std::map<std::string, std::filesystem::path, std::less<>> exported_module_bmis;
|
||||
std::vector<std::string> action_ids;
|
||||
};
|
||||
|
||||
|
||||
@@ -51,9 +51,10 @@ scan_translation_unit(const Toolchain::ToolchainCapabilities &toolchain,
|
||||
|
||||
// Collates scanned module units into a cycle-free, duplicate-free, missing-import-checked
|
||||
// topological build plan with profile/compiler-isolated BMI paths and GCC mapper files (Plan 08).
|
||||
[[nodiscard]] Void::Result::Result<CollatedModulePlan, Void::Result::Error>
|
||||
collate_modules(const std::vector<ModuleScanUnit> &units, const std::filesystem::path &bmi_root,
|
||||
const std::string &context_isolation_key, std::string_view bmi_extension = ".gcm");
|
||||
[[nodiscard]] Void::Result::Result<CollatedModulePlan, Void::Result::Error> collate_modules(
|
||||
const std::vector<ModuleScanUnit> &units, const std::filesystem::path &bmi_root,
|
||||
const std::string &context_isolation_key, std::string_view bmi_extension = ".gcm",
|
||||
const std::map<std::string, std::filesystem::path, std::less<>> &external_module_bmis = {});
|
||||
|
||||
// Compiles an explicitly declared header unit into an isolated BMI/PCM (Plan 08).
|
||||
[[nodiscard]] Void::Result::Result<Toolchain::LoweredCommand, Void::Result::Error>
|
||||
|
||||
@@ -64,11 +64,12 @@ configure_cmake_for_translation(const ProviderRequest &request,
|
||||
const std::filesystem::path &configure_dir,
|
||||
std::stop_token stop = {});
|
||||
|
||||
// Audits a configured CMake File API codemodel against Plan 20's bounded native subset:
|
||||
// C++ STATIC_LIBRARY / SHARED_LIBRARY / OBJECT_LIBRARY / EXECUTABLE targets without
|
||||
// generated sources, custom UTILITY rules, foreign C++20 module fileSets, precompiled
|
||||
// headers, non-C++ languages, or untracked link fragments. Any unsupported construct is
|
||||
// reported explicitly and never silently dropped.
|
||||
// Audits a configured CMake File API codemodel against Plan 20/21's bounded native subset:
|
||||
// C and C++ STATIC_LIBRARY / SHARED_LIBRARY / OBJECT_LIBRARY / EXECUTABLE targets,
|
||||
// C++20 CXX_MODULES fileSets, and hermetic build.ninja CUSTOM_COMMAND generators / UTILITY
|
||||
// targets whose declared outputs remain inside `configure_dir`. Any unsupported construct
|
||||
// (console pools, .util-only/side-effect rules, out-of-tree writes, PCH, non-C/C++ languages,
|
||||
// or untracked link fragments) is reported explicitly and never silently dropped.
|
||||
[[nodiscard]] Void::Result::Result<TranslationAuditReport, Void::Result::Error>
|
||||
audit_cmake_codemodel(const std::filesystem::path &configure_dir);
|
||||
|
||||
@@ -96,9 +97,10 @@ configure_meson_for_translation(const ProviderRequest &request,
|
||||
const std::filesystem::path &configure_dir,
|
||||
std::stop_token stop = {});
|
||||
|
||||
// Audits a configured Meson `meson-info/intro-targets.json` against Plan 20's bounded native
|
||||
// subset: pure C++ `static library`, `shared library`, and `executable` targets without custom
|
||||
// targets, generated sources, non-C++ languages, or untracked link artifacts.
|
||||
// Audits a configured Meson `meson-info/intro-targets.json` against Plan 20/21's bounded native
|
||||
// subset: C and C++ `static library`, `shared library`, `executable`, and hermetic `custom`
|
||||
// targets / `generated_sources` backed by build.ninja CUSTOM_COMMAND rules without `run`
|
||||
// targets, `console: true` pools, out-of-tree writes, non-C/C++ languages, or untracked links.
|
||||
[[nodiscard]] Void::Result::Result<TranslationAuditReport, Void::Result::Error>
|
||||
audit_meson_introspection(const std::filesystem::path &configure_dir);
|
||||
|
||||
|
||||
@@ -18,16 +18,21 @@ namespace Void::Build::Toolchain {
|
||||
struct ToolchainCapabilities {
|
||||
CompilerFamily family{CompilerFamily::Gcc};
|
||||
std::filesystem::path cxx_compiler;
|
||||
std::filesystem::path c_compiler;
|
||||
std::filesystem::path archiver;
|
||||
std::optional<std::filesystem::path> module_scanner;
|
||||
std::string version_banner;
|
||||
std::string target_triple;
|
||||
std::string sysroot;
|
||||
std::string compiler_sha256;
|
||||
std::string c_compiler_sha256;
|
||||
std::string archiver_sha256;
|
||||
std::vector<std::string> default_include_dirs;
|
||||
std::map<std::string, std::string, std::less<>> relevant_env;
|
||||
|
||||
bool supports_c11{false};
|
||||
bool supports_c17{false};
|
||||
bool supports_c23{false};
|
||||
bool supports_cxx17{false};
|
||||
bool supports_cxx20{false};
|
||||
bool supports_cxx23{false};
|
||||
@@ -61,6 +66,8 @@ struct CompileRequest {
|
||||
std::vector<std::pair<std::filesystem::path, bool>> include_dirs; // (path, is_system)
|
||||
std::vector<std::string> defines;
|
||||
std::vector<std::string> compile_options;
|
||||
bool is_c_source{false};
|
||||
CStandard c_standard{CStandard::Default};
|
||||
CxxStandard cxx_standard{CxxStandard::Default};
|
||||
LtoMode lto{LtoMode::None};
|
||||
std::vector<Sanitizer> sanitizers;
|
||||
|
||||
Reference in new issue
Block a user