@@ -1,17 +1,16 @@
|
||||
// This file is in a package which has the root source file exposed as "@root".
|
||||
// It is included in the compilation unit when exporting an executable.
|
||||
|
||||
const root = @import("@root");
|
||||
const std = @import("std");
|
||||
|
||||
const want_start_symbol = switch(@compileVar("os")) {
|
||||
Os.linux => true,
|
||||
else => false,
|
||||
};
|
||||
const want_main_symbol = !want_start_symbol;
|
||||
const want_main_symbol = std.build.linkingLibrary("c");
|
||||
const want_start_symbol = !want_main_symbol;
|
||||
|
||||
const exit = switch(@compileVar("os")) {
|
||||
Os.linux => std.linux.exit,
|
||||
Os.darwin => std.darwin.exit,
|
||||
else => @compileError("Unsupported OS"),
|
||||
};
|
||||
|
||||
var argc: usize = undefined;
|
||||
|
||||
13
std/build.zig
Normal file
13
std/build.zig
Normal file
@@ -0,0 +1,13 @@
|
||||
const mem = @import("mem.zig");
|
||||
|
||||
pub fn linkingLibrary(lib_name: []const u8) -> bool {
|
||||
// TODO shouldn't need this if
|
||||
if (@compileVar("link_libs").len != 0) {
|
||||
for (@compileVar("link_libs")) |link_lib| {
|
||||
if (mem.eql(u8, link_lib, lib_name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
pub const build = @import("build.zig");
|
||||
pub const cstr = @import("cstr.zig");
|
||||
pub const debug = @import("debug.zig");
|
||||
pub const fmt = @import("fmt.zig");
|
||||
|
||||
@@ -7,7 +7,7 @@ const TestFn = struct {
|
||||
|
||||
extern var zig_test_fn_list: []TestFn;
|
||||
|
||||
pub fn runTests() -> %void {
|
||||
pub fn main(args: [][]u8) -> %void {
|
||||
for (zig_test_fn_list) |testFn, i| {
|
||||
%%io.stderr.printf("Test {}/{} {}...", i + 1, zig_test_fn_list.len, testFn.name);
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
const test_runner = @import("test_runner.zig");
|
||||
|
||||
export fn main(argc: c_int, argv: &&u8) -> c_int {
|
||||
test_runner.runTests() %% return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
const test_runner = @import("test_runner.zig");
|
||||
|
||||
pub fn main(args: [][]u8) -> %void {
|
||||
return test_runner.runTests();
|
||||
}
|
||||
Reference in New Issue
Block a user