refactor(build): don't use the preprocessor when generating headers

Using the preprocessor before generating prototypes provides some
"niceties" but the places that rely on these are pretty few.
Vastly simplifying the BUILD SYSTEM is a better trade-off.

Unbalancing { } blocks due to the preprocessor is cringe anyway (think
of the tree-sitter trees!), write these in a different way.

Add some workarounds for plattform specific features.

INCLUDE_GENERATED_DECLARATIONS flag is now technically redundant,
but will be cleaned up in a follow-up PR as it is a big mess.
This commit is contained in:
bfredl committed 2025-08-06 15:10:25 +02:00
1 parent b4c092a092
commit 79c8159f41
24 files changed
+74 -143

No files matched your search

+3 -3
View File
@@ -232,8 +232,8 @@ pub fn build(b: *std.Build) !void {
\\
, .{medium}));
// TODO(zig): using getEmittedIncludeTree() is ugly af. we want run_preprocessor()
// to use the std.build.Module include_path thing
// TODO(zig): using getEmittedIncludeTree() is ugly af. we want unittests
// to reuse the std.build.Module include_path thing
const include_path = [_]LazyPath{
b.path("src/"),
gen_config.getDirectory(),
@@ -245,7 +245,7 @@ pub fn build(b: *std.Build) !void {
treesitter.artifact("tree-sitter").getEmittedIncludeTree(),
};
const gen_headers, const funcs_data = try gen.nvim_gen_sources(b, nlua0, &nvim_sources, &nvim_headers, &api_headers, &include_path, target, versiondef_git, version_lua);
const gen_headers, const funcs_data = try gen.nvim_gen_sources(b, nlua0, &nvim_sources, &nvim_headers, &api_headers, versiondef_git, version_lua);
const test_config_step = b.addWriteFiles();
_ = test_config_step.add("test/cmakeconfig/paths.lua", try test_config(b));