DoxigAlpha

create

Function parameters

Parameters

#
owner:*std.Build

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
addModule
Creates a module from the translated source and adds it to the package's
createModule
Creates a private module from the translated source to be used by the
defineCMacro
If the value is omitted, it is set to 1.
defineCMacroRaw
name_and_value looks like [name]=[value].

= .translate_c

Values

#
base_id
= .translate_c

Source

Implementation

#
pub fn create(owner: *std.Build, options: Options) *TranslateC {
    const translate_c = owner.allocator.create(TranslateC) catch @panic("OOM");
    const source = options.root_source_file.dupe(owner);
    translate_c.* = .{
        .step = Step.init(.{
            .id = base_id,
            .name = "translate-c",
            .owner = owner,
            .makeFn = make,
        }),
        .source = source,
        .include_dirs = std.array_list.Managed(std.Build.Module.IncludeDir).init(owner.allocator),
        .c_macros = std.array_list.Managed([]const u8).init(owner.allocator),
        .out_basename = undefined,
        .target = options.target,
        .optimize = options.optimize,
        .output_file = .{ .step = &translate_c.step },
        .link_libc = options.link_libc,
        .use_clang = options.use_clang,
    };
    source.addStepDependencies(&translate_c.step);
    return translate_c;
}