| ... | @@ -28,7 +28,6 @@ const usage = | ... | @@ -28,7 +28,6 @@ const usage = |
| 28 | \\ build-exe [source] Create executable from source or object files | 28 | \\ build-exe [source] Create executable from source or object files |
| 29 | \\ build-lib [source] Create library from source or object files | 29 | \\ build-lib [source] Create library from source or object files |
| 30 | \\ build-obj [source] Create object from source or assembly | 30 | \\ build-obj [source] Create object from source or assembly |
| 31 | \\ cc [args] Call the system c compiler and pass args through | | |
| 32 | \\ fmt [source] Parse file and render in canonical zig format | 31 | \\ fmt [source] Parse file and render in canonical zig format |
| 33 | \\ run [source] Create executable and run immediately | 32 | \\ run [source] Create executable and run immediately |
| 34 | \\ targets List available compilation targets | 33 | \\ targets List available compilation targets |
| ... | @@ -69,7 +68,6 @@ pub fn main() !void { | ... | @@ -69,7 +68,6 @@ pub fn main() !void { |
| 69 | Command { .name = "build-exe", .exec = cmdBuildExe }, | 68 | Command { .name = "build-exe", .exec = cmdBuildExe }, |
| 70 | Command { .name = "build-lib", .exec = cmdBuildLib }, | 69 | Command { .name = "build-lib", .exec = cmdBuildLib }, |
| 71 | Command { .name = "build-obj", .exec = cmdBuildObj }, | 70 | Command { .name = "build-obj", .exec = cmdBuildObj }, |
| 72 | Command { .name = "cc", .exec = cmdCc }, | | |
| 73 | Command { .name = "fmt", .exec = cmdFmt }, | 71 | Command { .name = "fmt", .exec = cmdFmt }, |
| 74 | Command { .name = "run", .exec = cmdRun }, | 72 | Command { .name = "run", .exec = cmdRun }, |
| 75 | Command { .name = "targets", .exec = cmdTargets }, | 73 | Command { .name = "targets", .exec = cmdTargets }, |
| ... | @@ -630,42 +628,6 @@ fn cmdBuildObj(allocator: &Allocator, args: []const []const u8) !void { | ... | @@ -630,42 +628,6 @@ fn cmdBuildObj(allocator: &Allocator, args: []const []const u8) !void { |
| 630 | try buildOutputType(allocator, args, Module.Kind.Obj); | 628 | try buildOutputType(allocator, args, Module.Kind.Obj); |
| 631 | } | 629 | } |
| 632 | | 630 | |
| 633 | // cmd:cc ////////////////////////////////////////////////////////////////////////////////////////// | | |
| 634 | | | |
| 635 | fn cmdCc(allocator: &Allocator, args: []const []const u8) !void { | | |
| 636 | // TODO: using libclang directly would be nice, but it may not expose argument parsing nicely | | |
| 637 | var command = ArrayList([]const u8).init(allocator); | | |
| 638 | defer command.deinit(); | | |
| 639 | | | |
| 640 | try command.append("cc"); | | |
| 641 | try command.appendSlice(args); | | |
| 642 | | | |
| 643 | var proc = try os.ChildProcess.init(command.toSliceConst(), allocator); | | |
| 644 | defer proc.deinit(); | | |
| 645 | | | |
| 646 | var term = try proc.spawnAndWait(); | | |
| 647 | switch (term) { | | |
| 648 | os.ChildProcess.Term.Exited => |status| { | | |
| 649 | if (status != 0) { | | |
| 650 | try stderr.print("cc exited with status {}\n", status); | | |
| 651 | os.exit(1); | | |
| 652 | } | | |
| 653 | }, | | |
| 654 | os.ChildProcess.Term.Signal => |signal| { | | |
| 655 | try stderr.print("cc killed by signal {}\n", signal); | | |
| 656 | os.exit(1); | | |
| 657 | }, | | |
| 658 | os.ChildProcess.Term.Stopped => |signal| { | | |
| 659 | try stderr.print("cc stopped by signal {}\n", signal); | | |
| 660 | os.exit(1); | | |
| 661 | }, | | |
| 662 | os.ChildProcess.Term.Unknown => |status| { | | |
| 663 | try stderr.print("cc encountered unknown failure {}\n", status); | | |
| 664 | os.exit(1); | | |
| 665 | }, | | |
| 666 | } | | |
| 667 | } | | |
| 668 | | | |
| 669 | // cmd:fmt ///////////////////////////////////////////////////////////////////////////////////////// | 631 | // cmd:fmt ///////////////////////////////////////////////////////////////////////////////////////// |
| 670 | | 632 | |
| 671 | const usage_fmt = | 633 | const usage_fmt = |
| ... | @@ -966,7 +928,6 @@ fn cmdRun(allocator: &Allocator, args: []const []const u8) !void { | ... | @@ -966,7 +928,6 @@ fn cmdRun(allocator: &Allocator, args: []const []const u8) !void { |
| 966 | break; | 928 | break; |
| 967 | } | 929 | } |
| 968 | } | 930 | } |
| 969 | | | |
| 970 | var flags = try Args.parse(allocator, args_run_spec, compile_args); | 931 | var flags = try Args.parse(allocator, args_run_spec, compile_args); |
| 971 | defer flags.deinit(); | 932 | defer flags.deinit(); |
| 972 | | 933 | |