-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.zig
More file actions
47 lines (41 loc) · 1.57 KB
/
Copy pathbuild.zig
File metadata and controls
47 lines (41 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const vaxis_dep = b.dependency("vaxis", .{
.target = target,
.optimize = optimize,
});
const ts_dep = b.dependency("tree_sitter", .{
.target = target,
.optimize = optimize,
});
// Grammar packages ship no build.zig; we compile parser.c ourselves.
const grammar_dep = b.dependency("tree_sitter_zig", .{});
const exe = b.addExecutable(.{
.name = "zide",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("vaxis", vaxis_dep.module("vaxis"));
exe.root_module.addImport("tree-sitter", ts_dep.module("tree-sitter"));
exe.root_module.addCSourceFile(.{
.file = grammar_dep.path("src/parser.c"),
.flags = &.{"-std=c11"},
});
exe.root_module.addIncludePath(grammar_dep.path("src"));
exe.linkLibC();
// Size discipline (nullclaw-style): strip symbols outside Debug and let
// the linker drop unreferenced sections.
if (optimize != .Debug) exe.root_module.strip = true;
exe.link_function_sections = true;
exe.link_data_sections = true;
exe.link_gc_sections = true;
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| run_cmd.addArgs(args);
const run_step = b.step("run", "Run the editor");
run_step.dependOn(&run_cmd.step);
}