From 0df603ec00eb2b038275d82a94b65cd2c27dde9f Mon Sep 17 00:00:00 2001 From: Matt Knight Date: Tue, 21 Nov 2023 19:41:15 -0800 Subject: [PATCH] Allow for regz to be used as a module (#116) --- build.zig | 12 ++++++++++++ src/main.zig | 1 - src/module.zig | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/module.zig diff --git a/build.zig b/build.zig index 3476b18..c7b63ca 100644 --- a/build.zig +++ b/build.zig @@ -19,6 +19,14 @@ pub fn build(b: *std.build.Builder) !void { .optimize = optimize, }); + const xml = b.addStaticLibrary(.{ + .name = "xml2", + .target = target, + .optimize = optimize, + }); + xml.linkLibrary(libxml2_dep.artifact("xml2")); + b.installArtifact(xml); + const regz = b.addExecutable(.{ .name = "regz", .root_source_file = .{ .path = "src/main.zig" }, @@ -29,6 +37,10 @@ pub fn build(b: *std.build.Builder) !void { regz.linkLibrary(libxml2_dep.artifact("xml2")); b.installArtifact(regz); + _ = b.addModule("regz", .{ + .source_file = .{ .path = "src/module.zig" }, + }); + const run_cmd = b.addRunArtifact(regz); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { diff --git a/src/main.zig b/src/main.zig index c23aaac..b8e8869 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,7 +1,6 @@ const std = @import("std"); const clap = @import("clap"); const xml = @import("xml.zig"); -const svd = @import("svd.zig"); const Database = @import("Database.zig"); const ArenaAllocator = std.heap.ArenaAllocator; diff --git a/src/module.zig b/src/module.zig new file mode 100644 index 0000000..13b8588 --- /dev/null +++ b/src/module.zig @@ -0,0 +1 @@ +pub const Database = @import("Database.zig");