add(examples/demo): application to showcase a more complex application
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 53s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 53s
Further improvements for example applications; Demo example is now default build target (when not providing example configuration).
This commit is contained in:
13
build.zig
13
build.zig
@@ -5,6 +5,7 @@ pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const Examples = enum {
|
||||
demo,
|
||||
// elements:
|
||||
button,
|
||||
input,
|
||||
@@ -21,7 +22,7 @@ pub fn build(b: *std.Build) void {
|
||||
errors,
|
||||
};
|
||||
|
||||
const example = b.option(Examples, "example", "Example to build and/or run. (default: vertical)") orelse .vertical;
|
||||
const example = b.option(Examples, "example", "Example to build and/or run. (default: demo)") orelse .demo;
|
||||
|
||||
const options = b.addOptions();
|
||||
options.addOption(Examples, "example", example);
|
||||
@@ -42,6 +43,15 @@ pub fn build(b: *std.Build) void {
|
||||
|
||||
//--- Examples ---
|
||||
|
||||
// demo:
|
||||
const demo = b.addExecutable(.{
|
||||
.name = "demo",
|
||||
.root_source_file = b.path("examples/demo.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
demo.root_module.addImport("zterm", lib);
|
||||
|
||||
// elements:
|
||||
const button = b.addExecutable(.{
|
||||
.name = "button",
|
||||
@@ -128,6 +138,7 @@ pub fn build(b: *std.Build) void {
|
||||
|
||||
// mapping of user selected example to compile step
|
||||
const exe = switch (example) {
|
||||
.demo => demo,
|
||||
// elements:
|
||||
.button => button,
|
||||
.input => input,
|
||||
|
||||
Reference in New Issue
Block a user