make sunriset available as a module
This commit is contained in:
parent
ddd6f3b61f
commit
5c1d6f41e6
2 changed files with 27 additions and 0 deletions
26
build.zig
26
build.zig
|
|
@ -19,6 +19,28 @@ pub fn build(b: *std.Build) void {
|
||||||
|
|
||||||
const maxminddb_upstream = b.dependency("maxminddb", .{});
|
const maxminddb_upstream = b.dependency("maxminddb", .{});
|
||||||
|
|
||||||
|
// Build sunriset as a static library
|
||||||
|
const sunriset = b.addLibrary(.{
|
||||||
|
.name = "sunriset",
|
||||||
|
.linkage = .static,
|
||||||
|
.root_module = b.createModule(.{
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
.link_libc = true,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
sunriset.addIncludePath(b.path("libs/sunriset"));
|
||||||
|
sunriset.addCSourceFiles(.{
|
||||||
|
.root = b.path("libs/sunriset"),
|
||||||
|
.files = &.{
|
||||||
|
"sunriset.c",
|
||||||
|
},
|
||||||
|
.flags = &.{ "-D_DEFAULT_SOURCE", "-DSUNRISET_NO_MAIN" },
|
||||||
|
});
|
||||||
|
sunriset.linkLibC();
|
||||||
|
sunriset.linkSystemLibrary("m");
|
||||||
|
|
||||||
// Build phoon as a static library
|
// Build phoon as a static library
|
||||||
const phoon = b.addLibrary(.{
|
const phoon = b.addLibrary(.{
|
||||||
.name = "phoon",
|
.name = "phoon",
|
||||||
|
|
@ -98,9 +120,11 @@ pub fn build(b: *std.Build) void {
|
||||||
exe.root_module.addOptions("build_options", build_options);
|
exe.root_module.addOptions("build_options", build_options);
|
||||||
exe.root_module.addIncludePath(maxminddb_upstream.path("include"));
|
exe.root_module.addIncludePath(maxminddb_upstream.path("include"));
|
||||||
exe.root_module.addIncludePath(b.path("libs/phoon_14Aug2014"));
|
exe.root_module.addIncludePath(b.path("libs/phoon_14Aug2014"));
|
||||||
|
exe.root_module.addIncludePath(b.path("libs/sunriset"));
|
||||||
exe.root_module.addConfigHeader(maxminddb_config);
|
exe.root_module.addConfigHeader(maxminddb_config);
|
||||||
exe.linkLibrary(maxminddb);
|
exe.linkLibrary(maxminddb);
|
||||||
exe.linkLibrary(phoon);
|
exe.linkLibrary(phoon);
|
||||||
|
exe.linkLibrary(sunriset);
|
||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
|
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
|
|
@ -135,9 +159,11 @@ pub fn build(b: *std.Build) void {
|
||||||
tests.root_module.addOptions("build_options", test_options);
|
tests.root_module.addOptions("build_options", test_options);
|
||||||
tests.root_module.addIncludePath(maxminddb_upstream.path("include"));
|
tests.root_module.addIncludePath(maxminddb_upstream.path("include"));
|
||||||
tests.root_module.addIncludePath(b.path("libs/phoon_14Aug2014"));
|
tests.root_module.addIncludePath(b.path("libs/phoon_14Aug2014"));
|
||||||
|
tests.root_module.addIncludePath(b.path("libs/sunriset"));
|
||||||
tests.root_module.addConfigHeader(maxminddb_config);
|
tests.root_module.addConfigHeader(maxminddb_config);
|
||||||
tests.linkLibrary(maxminddb);
|
tests.linkLibrary(maxminddb);
|
||||||
tests.linkLibrary(phoon);
|
tests.linkLibrary(phoon);
|
||||||
|
tests.linkLibrary(sunriset);
|
||||||
tests.linkLibC();
|
tests.linkLibC();
|
||||||
|
|
||||||
const run_tests = b.addRunArtifact(tests);
|
const run_tests = b.addRunArtifact(tests);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
.hash = "zeit-0.6.0-5I6bk36tAgATpSl9wjFmRPMqYN2Mn0JQHgIcRNcqDpJA",
|
.hash = "zeit-0.6.0-5I6bk36tAgATpSl9wjFmRPMqYN2Mn0JQHgIcRNcqDpJA",
|
||||||
},
|
},
|
||||||
.phoon = .{ .path = "libs/phoon_14Aug2014" },
|
.phoon = .{ .path = "libs/phoon_14Aug2014" },
|
||||||
|
.sunriset = .{ .path = "libs/sunriset" },
|
||||||
},
|
},
|
||||||
.fingerprint = 0x710c2b57e81aa678,
|
.fingerprint = 0x710c2b57e81aa678,
|
||||||
.minimum_zig_version = "0.15.2",
|
.minimum_zig_version = "0.15.2",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue