Added example of detecting OS props for target operating system

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2024-09-18 23:00:20 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2024-09-18 23:00:20 +0200
Commit 6e63960189e4e3e374e6956f6c86f561fc3df61a (patch)
-rw-r--r-- README.md 1
-rw-r--r-- zig-os-props/Makefile 2
-rw-r--r-- zig-os-props/main.zig 10
3 files changed, 13 insertions, 0 deletions
diff --git a/README.md b/README.md
...
25
| [zig-x11-box](./zig-x11-box)     | zig-0.11.0 | Move a box around with arrow keys with Xlib and Zig.           |
25
| [zig-x11-box](./zig-x11-box)     | zig-0.11.0 | Move a box around with arrow keys with Xlib and Zig.           |
26
| [zig-kv-store](./zig-kv-store)   | zig-0.11.0 | Simple Key-value store that mimics memcached written in Zig.   |
26
| [zig-kv-store](./zig-kv-store)   | zig-0.11.0 | Simple Key-value store that mimics memcached written in Zig.   |
27
| [zig-wad](./zig-wad)             | zig-0.11.0 | Reads doom.wad and extracts the identification header.         |
27
| [zig-wad](./zig-wad)             | zig-0.11.0 | Reads doom.wad and extracts the identification header.         |
  
28
| [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
  
1
default:
  
2
	zig run main.zig
diff --git a/zig-os-props/main.zig b/zig-os-props/main.zig
  
1
const std = @import("std");
  
2
const builtin = @import("builtin");
  
3
  
  
4
pub fn main() void {
  
5
    std.debug.print("os: {any}\n", .{builtin.target.os.tag});
  
6
    std.debug.print("arch: {any}\n", .{builtin.target.cpu.arch});
  
7
    std.debug.print("gnu: {any}\n", .{builtin.target.isGnu()});
  
8
    std.debug.print("musl: {any}\n", .{builtin.target.isMusl()});
  
9
    std.debug.print("mingw: {any}\n", .{builtin.target.isMinGW()});
  
10
}