Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Build › Module › addCSourceFiles Public Function addCSourceFiles Doc Source Public Function std.Build.Module.addCSourceFiles
pub fn addCSourceFiles (m : *Module , options : AddCSourceFilesOptions ) void Params File Build/Module.zig: 388
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410 pub fn addCSourceFiles (m : *Module , options : AddCSourceFilesOptions ) void {
const b = m .owner ;
const graph = m .owner .graph ;
const arena = graph .arena ;
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 = arena .create (CSourceFiles ) catch @panic ("OOM" );
c_source_files .* = .{
.root = options .root orelse b .path ("" ),
.files = b .graph .dupeStrings (options .files ),
.flags = b .graph .dupeStrings (options .flags ),
.language = options .language ,
};
m .link_objects .append (arena , .{ .c_source_files = c_source_files }) catch @panic ("OOM" );
}
Handy when you have many non-Zig source files and want them all to have the same flags.