Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Allow for regz to be used as a module (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnite authored Nov 22, 2023
1 parent d66ffd5 commit 0df603e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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| {
Expand Down
1 change: 0 additions & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/module.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub const Database = @import("Database.zig");

0 comments on commit 0df603e

Please sign in to comment.