add module function
This commit is contained in:
parent
af2f9fe9c6
commit
3a6d024539
1 changed files with 8 additions and 14 deletions
22
build.zig
22
build.zig
|
@ -1,18 +1,7 @@
|
||||||
const std = @import("std");
|
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
|
|
||||||
// for restricting supported target set are available.
|
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
// Standard optimization options allow the person running `zig build` to select
|
|
||||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
|
|
||||||
// set a preferred release mode, allowing the user to decide how to optimize.
|
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
// Main executable
|
// Main executable
|
||||||
|
@ -68,9 +57,7 @@ pub fn build(b: *std.Build) void {
|
||||||
test_step.dependOn(&run_bdf_unit_tests.step);
|
test_step.dependOn(&run_bdf_unit_tests.step);
|
||||||
|
|
||||||
// Module
|
// Module
|
||||||
_ = b.addModule("binfon", .{
|
addModule(b);
|
||||||
.root_source_file = .{ .path = "src/lib.zig" },
|
|
||||||
});
|
|
||||||
|
|
||||||
// Library
|
// Library
|
||||||
const libbinfon = buildLibrary(b, .{
|
const libbinfon = buildLibrary(b, .{
|
||||||
|
@ -82,6 +69,13 @@ pub fn build(b: *std.Build) void {
|
||||||
b.getInstallStep().dependOn(&libzimalloc_install.step);
|
b.getInstallStep().dependOn(&libzimalloc_install.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Module function for depending on the binfon module
|
||||||
|
pub fn addModule(b: *std.Build) void {
|
||||||
|
_ = b.addModule("binfon", .{
|
||||||
|
.root_source_file = .{ .path = "src/lib.zig" },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const ModuleOptions = struct {
|
const ModuleOptions = struct {
|
||||||
target: std.Build.ResolvedTarget,
|
target: std.Build.ResolvedTarget,
|
||||||
optimize: std.builtin.Mode,
|
optimize: std.builtin.Mode,
|
||||||
|
|
Loading…
Reference in a new issue