Function addCSourceFiles [src]

Handy when you have many non-Zig source files and want them all to have the same flags.

Prototype

pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void

Parameters

m: *Moduleoptions: AddCSourceFilesOptions

Source

pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void { const b = m.owner; const allocator = b.allocator; for (options.files) |path| { if (std.fs.path.isAbsolute(path)) { std.debug.panic( "file paths added with 'addCSourceFiles' must be relative, found absolute path '{s}'", .{path}, ); } } const c_source_files = allocator.create(CSourceFiles) catch @panic("OOM"); c_source_files.* = .{ .root = options.root orelse b.path(""), .files = b.dupeStrings(options.files), .flags = b.dupeStrings(options.flags), .language = options.language, }; m.link_objects.append(allocator, .{ .c_source_files = c_source_files }) catch @panic("OOM"); }