Skip to content

Commit

Permalink
build: Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ibokuri committed Jan 20, 2024
1 parent 0200960 commit 9ca7537
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
15 changes: 5 additions & 10 deletions examples/build.zig
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const std = @import("std");

const module_name = "getty";
const module_path = "../src/getty.zig";

const examples = .{
"bool-serializer",
"bool-deserializer",
"seq-serializer",
"seq-deserializer",
};

pub fn build(b: *std.build.Builder) void {
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const target_optimize = .{ .target = target, .optimize = optimize };

const getty_module = b.dependency("getty", target_optimize).module("getty");

inline for (examples) |e| {
const example_path = e ++ "/main.zig";
Expand All @@ -26,12 +26,7 @@ pub fn build(b: *std.build.Builder) void {
.target = target,
.optimize = optimize,
});
const module = b.addModule(module_name, .{
.source_file = .{ .path = module_path },
});

exe.addModule(module_name, module);

exe.root_module.addImport("getty", getty_module);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step(run_name, run_desc);
Expand Down
16 changes: 16 additions & 0 deletions examples/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.{
.name = "examples",
.version = "0.1.0",
.paths = .{
"build.zig",
"build.zig.zon",
"README.md",
"bool-deserializer/",
"bool-serializer/",
"seq-deserializer/",
"seq-serializer/",
},
.dependencies = .{
.getty = .{ .path = "../" },
},
}

0 comments on commit 9ca7537

Please sign in to comment.