地圖 (Jido) is a lightweight Unix TUI file explorer designed for speed and simplicity.
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 19850bb5087d83d1c2ffeb00976e6907133b1352 72 lines 2.4 kB view raw
1const std = @import("std"); 2const builtin = @import("builtin"); 3 4const targets: []const std.Target.Query = &.{ 5 .{ .cpu_arch = .aarch64, .os_tag = .macos }, 6 .{ .cpu_arch = .aarch64, .os_tag = .linux }, 7 .{ .cpu_arch = .x86_64, .os_tag = .linux }, 8 .{ .cpu_arch = .x86_64, .os_tag = .macos }, 9}; 10 11fn createExe(b: *std.Build, exe_name: []const u8, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) !*std.Build.Step.Compile { 12 const libvaxis = b.dependency("vaxis", .{ .target = target }).module("vaxis"); 13 const fuzzig = b.dependency("fuzzig", .{ .target = target }).module("fuzzig"); 14 const zuid = b.dependency("zuid", .{ .target = target }).module("zuid"); 15 const zeit = b.dependency("zeit", .{ .target = target }).module("zeit"); 16 17 const exe = b.addExecutable(.{ 18 .name = exe_name, 19 .root_source_file = b.path("src/main.zig"), 20 .target = target, 21 .optimize = optimize, 22 }); 23 24 exe.root_module.addImport("vaxis", libvaxis); 25 exe.root_module.addImport("fuzzig", fuzzig); 26 exe.root_module.addImport("zuid", zuid); 27 exe.root_module.addImport("zeit", zeit); 28 29 return exe; 30} 31 32pub fn build(b: *std.Build) !void { 33 const target = b.standardTargetOptions(.{}); 34 const optimize = b.standardOptimizeOption(.{}); 35 36 // Building targets for release. 37 const build_all = b.option(bool, "all-targets", "Build all targets in ReleaseSafe mode.") orelse false; 38 if (build_all) { 39 try buildTargets(b); 40 return; 41 } 42 43 const exe = try createExe(b, "jido", target, optimize); 44 b.installArtifact(exe); 45 46 const run_cmd = b.addRunArtifact(exe); 47 run_cmd.step.dependOn(b.getInstallStep()); 48 if (b.args) |args| { 49 run_cmd.addArgs(args); 50 } 51 const run_step = b.step("run", "Run the app"); 52 run_step.dependOn(&run_cmd.step); 53} 54 55fn buildTargets(b: *std.Build) !void { 56 for (targets) |t| { 57 const target = b.resolveTargetQuery(t); 58 59 const exe = try createExe(b, "jido", target, .ReleaseSafe); 60 b.installArtifact(exe); 61 62 const target_output = b.addInstallArtifact(exe, .{ 63 .dest_dir = .{ 64 .override = .{ 65 .custom = try t.zigTriple(b.allocator), 66 }, 67 }, 68 }); 69 70 b.getInstallStep().dependOn(&target_output.step); 71 } 72}