2017-03-31 10:48:15 +01:00
|
|
|
const root = @import("@build");
|
|
|
|
const std = @import("std");
|
|
|
|
const io = std.io;
|
|
|
|
const Builder = std.build.Builder;
|
|
|
|
const mem = std.mem;
|
|
|
|
|
2017-04-03 01:44:04 +01:00
|
|
|
error InvalidArgs;
|
|
|
|
|
2017-03-31 10:48:15 +01:00
|
|
|
pub fn main(args: [][]u8) -> %void {
|
2017-04-03 01:44:04 +01:00
|
|
|
if (args.len < 2) {
|
|
|
|
%%io.stderr.printf("Expected first argument to be path to zig compiler\n");
|
|
|
|
return error.InvalidArgs;
|
|
|
|
}
|
2017-03-31 10:48:15 +01:00
|
|
|
const zig_exe = args[1];
|
|
|
|
const leftover_args = args[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);
|
|
|
|
root.build(&builder);
|
|
|
|
%return builder.make(leftover_args);
|
|
|
|
}
|