Microkernel thing OS experiment (Zig ⚡)
at dev 1.2 kB view raw
1const std = @import("std"); 2const build_helpers = @import("build_helpers"); 3 4pub fn build(b: *std.Build) void { 5 const arch = b.option(build_helpers.Architecture, "arch", "The target root_server architecture") orelse .amd64; 6 const number = b.option(usize, "number", "The syscall number to use") orelse 0x69; 7 8 // set CPU features based on the architecture 9 const target = b.resolveTargetQuery(.{ 10 .cpu_arch = arch.get(), 11 .os_tag = .freestanding, 12 .abi = .none, 13 }); 14 const optimize = b.standardOptimizeOption(.{}); 15 16 const main_mod = b.createModule(.{ 17 .root_source_file = b.path("src/main.zig"), 18 .target = target, 19 .optimize = optimize, 20 }); 21 22 const config = b.addOptions(); 23 config.addOption(build_helpers.Architecture, "arch", arch); 24 config.addOption(usize, "number", number); 25 26 const build_helpers_dep = b.dependency("build_helpers", .{}); 27 28 main_mod.addImport("config", config.createModule()); 29 main_mod.addImport("build_helpers", build_helpers_dep.module("build_helpers")); 30 31 const exe = b.addExecutable(.{ 32 .name = "root_server", 33 .root_module = main_mod, 34 }); 35 36 b.installArtifact(exe); 37}