Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (pull_request) Failing after 5m10s
The main executable contains a simple `Element` implementation example showing how interaction through and outside of the event loop can be implemented to impact the rendered contents.
67 lines
2.2 KiB
Zig
67 lines
2.2 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const zg = b.dependency("zg", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
// library
|
|
const lib = b.addModule("zterm", .{
|
|
.root_source_file = b.path("src/zterm.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
lib.addImport("code_point", zg.module("code_point"));
|
|
|
|
// main executable (usually used for testing)
|
|
const exe = b.addExecutable(.{
|
|
.name = "zterm",
|
|
.root_source_file = b.path("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
exe.root_module.addImport("zterm", lib);
|
|
|
|
// TODO: add example execution through optional argument to `zig run` to run
|
|
// an example application instead of the main executable
|
|
|
|
// example applications (usually used for documentation and demonstrations)
|
|
const container = b.addExecutable(.{
|
|
.name = "container",
|
|
.root_source_file = b.path("examples/container.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
container.root_module.addImport("zterm", lib);
|
|
b.installArtifact(container);
|
|
|
|
// zig build run
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
// Allow additional arguments, like this: `zig build run -- arg1 arg2 etc`
|
|
if (b.args) |args| run_cmd.addArgs(args);
|
|
|
|
// This creates a build step. It will be visible in the `zig build --help` menu,
|
|
// and can be selected like this: `zig build run`
|
|
// This will evaluate the `run` step rather than the default, which is "install".
|
|
const run_step = b.step("run", "Run the app");
|
|
run_step.dependOn(&run_cmd.step);
|
|
|
|
// zig build test
|
|
const lib_unit_tests = b.addTest(.{
|
|
.root_source_file = b.path("src/zterm.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
lib_unit_tests.root_module.addImport("code_point", zg.module("code_point"));
|
|
|
|
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
|
|
|
const test_step = b.step("test", "Run unit tests");
|
|
test_step.dependOn(&run_lib_unit_tests.step);
|
|
}
|