Function create [src]

Prototype

pub fn create(owner: *std.Build, options: Options) *ConfigHeader

Parameters

owner: *std.Buildoptions: Options

Source

pub fn create(owner: *std.Build, options: Options) *ConfigHeader { const config_header = owner.allocator.create(ConfigHeader) catch @panic("OOM"); var include_path: []const u8 = "config.h"; if (options.style.getPath()) |s| default_include_path: { const sub_path = switch (s) { .src_path => |sp| sp.sub_path, .generated => break :default_include_path, .cwd_relative => |sub_path| sub_path, .dependency => |dependency| dependency.sub_path, }; const basename = std.fs.path.basename(sub_path); if (std.mem.endsWith(u8, basename, ".h.in")) { include_path = basename[0 .. basename.len - 3]; } } if (options.include_path) |p| { include_path = p; } const name = if (options.style.getPath()) |s| owner.fmt("configure {s} header {s} to {s}", .{ @tagName(options.style), s.getDisplayName(), include_path, }) else owner.fmt("configure {s} header to {s}", .{ @tagName(options.style), include_path }); config_header.* = .{ .step = Step.init(.{ .id = base_id, .name = name, .owner = owner, .makeFn = make, .first_ret_addr = options.first_ret_addr orelse @returnAddress(), }), .style = options.style, .values = std.StringArrayHashMap(Value).init(owner.allocator), .max_bytes = options.max_bytes, .include_path = include_path, .include_guard_override = options.include_guard_override, .output_file = .{ .step = &config_header.step }, }; return config_header; }