Skip to content

Recursively search for TranslateC steps #91

@ypsvlq

Description

@ypsvlq

// Find TranslateC dependencies and add system path
var iter = artifact.root_module.import_table.iterator();
while (iter.next()) |it| {
const module = it.value_ptr.*;
const root_source_file = module.root_source_file orelse continue;
switch (root_source_file) {
.generated => |gen| {
const step = gen.file.step;
if (step.id != .translate_c) {
continue;
}
const c_translate_target = module.resolved_target orelse continue;
if (!c_translate_target.result.abi.isAndroid()) {
continue;
}
const translate_c: *std.Build.Step.TranslateC = @fieldParentPtr("step", step);
translate_c.addIncludePath(.{ .cwd_relative = apk.ndk.include_path });
translate_c.addSystemIncludePath(.{ .cwd_relative = apk.getSystemIncludePath(c_translate_target) });
},
else => continue,
}
}

This does not work for TranslateC steps in dependencies of the root module.

As std.Build.Step.TranslateC is also going to be removed in favour of a package, it might be preferable to add a public API to get the include paths for a given target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions