Make it possible to use as a dependency

This commit is contained in:
Cameron Reed 2024-11-01 14:43:31 -06:00
parent f986fc76ec
commit ce9d6902d8

View File

@ -3,7 +3,7 @@ const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
pub fn build(b: *std.Build) !void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
@ -15,6 +15,12 @@ pub fn build(b: *std.Build) void {
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});
const zigjson_module = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
});
try b.modules.put(b.dupe("zigjson"), zigjson_module);
const lib = b.addStaticLibrary(.{
.name = "zigjson",
// In this case the main source file is merely a path, however, in more