diff --git a/README.md b/README.md index 4a822689ebbed09d4f7f14607a8abd93bccfe0c7..53520f0abcc74e6566790d06eeaef61080304e31 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,4 @@ | [zig-http](./zig-http) | zig-0.11.0 | Basic example of a HTTP 1.1 server without any routing etc. | | [zig-x11-box](./zig-x11-box) | zig-0.11.0 | Move a box around with arrow keys with Xlib and Zig. | | [zig-kv-store](./zig-kv-store) | zig-0.11.0 | Simple Key-value store that mimics memcached written in Zig. | | [zig-wad](./zig-wad) | zig-0.11.0 | Reads doom.wad and extracts the identification header. | +| [zig-os-props](./zig-os-props) | zig-0.11.0 | Detects properties of the target operating system. | diff --git a/zig-os-props/Makefile b/zig-os-props/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b962fd100009f048138a340c584a6029515bab18 --- /dev/null +++ b/zig-os-props/Makefile @@ -0,0 +1,2 @@ +default: + zig run main.zig diff --git a/zig-os-props/main.zig b/zig-os-props/main.zig new file mode 100644 index 0000000000000000000000000000000000000000..51665bf1f78ecf9622d5a73bd8a8a318c4f2338f --- /dev/null +++ b/zig-os-props/main.zig @@ -0,0 +1,10 @@ +const std = @import("std"); +const builtin = @import("builtin"); + +pub fn main() void { + std.debug.print("os: {any}\n", .{builtin.target.os.tag}); + std.debug.print("arch: {any}\n", .{builtin.target.cpu.arch}); + std.debug.print("gnu: {any}\n", .{builtin.target.isGnu()}); + std.debug.print("musl: {any}\n", .{builtin.target.isMusl()}); + std.debug.print("mingw: {any}\n", .{builtin.target.isMinGW()}); +}