mirror of
https://github.com/ziglang/zig.git
synced 2024-12-04 19:09:32 +00:00
1c6000d047
* add std.buf_map.BufMap * add std.buf_set.BufSet * add std.mem.split * zig build system improvements (See #204) - automatically parses NIX_CFLAGS_COMPILE and NIX_LDFLAGS - add builder.addCIncludePath - add builder.addRPath - add builder.addLibPath - add exe.linkLibrary
27 lines
759 B
Zig
27 lines
759 B
Zig
const root = @import("@build");
|
|
const std = @import("std");
|
|
const io = std.io;
|
|
const os = std.os;
|
|
const Builder = std.build.Builder;
|
|
const mem = std.mem;
|
|
|
|
error InvalidArgs;
|
|
|
|
pub fn main() -> %void {
|
|
if (os.args.count() < 2) {
|
|
%%io.stderr.printf("Expected first argument to be path to zig compiler\n");
|
|
return error.InvalidArgs;
|
|
}
|
|
const zig_exe = os.args.at(1);
|
|
const leftover_arg_index = 2;
|
|
|
|
// TODO use a more general purpose allocator here
|
|
var inc_allocator = %%mem.IncrementingAllocator.init(10 * 1024 * 1024);
|
|
defer inc_allocator.deinit();
|
|
|
|
var builder = Builder.init(zig_exe, &inc_allocator.allocator);
|
|
defer builder.deinit();
|
|
root.build(&builder);
|
|
%return builder.make(leftover_arg_index);
|
|
}
|