sysaudio: use mach-sysjs via package manager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
a69119c279
commit
dfcfc20db8
5 changed files with 32 additions and 14 deletions
|
|
@ -16,7 +16,6 @@ const gpu = @import("libs/gpu/sdk.zig").Sdk(.{
|
|||
});
|
||||
const sysaudio = @import("libs/sysaudio/sdk.zig").Sdk(.{
|
||||
.system_sdk = system_sdk,
|
||||
.sysjs = sysjs,
|
||||
});
|
||||
const core = @import("libs/core/sdk.zig").Sdk(.{
|
||||
.gpu = gpu,
|
||||
|
|
@ -44,7 +43,7 @@ pub fn module(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig
|
|||
.dependencies = &.{
|
||||
.{ .name = "core", .module = core.module(b) },
|
||||
.{ .name = "ecs", .module = ecs_dep.module("mach-ecs") },
|
||||
.{ .name = "sysaudio", .module = sysaudio.module(b) },
|
||||
.{ .name = "sysaudio", .module = sysaudio.module(b, optimize, target) },
|
||||
.{ .name = "earcut", .module = earcut_dep.module("mach-earcut") },
|
||||
},
|
||||
});
|
||||
|
|
@ -180,7 +179,7 @@ pub const App = struct {
|
|||
var deps = std.ArrayList(std.build.ModuleDependency).init(b.allocator);
|
||||
if (options.deps) |v| try deps.appendSlice(v);
|
||||
try deps.append(.{ .name = "mach", .module = module(b, options.optimize, options.target) });
|
||||
try deps.append(.{ .name = "sysaudio", .module = sysaudio.module(b) });
|
||||
try deps.append(.{ .name = "sysaudio", .module = sysaudio.module(b, options.optimize, options.target) });
|
||||
if (options.use_freetype) |_| try deps.append(.{ .name = "freetype", .module = freetype.module(b) });
|
||||
|
||||
const app = try core.App.init(b, .{
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
const std = @import("std");
|
||||
const sysaudio_sdk = @import("sdk.zig");
|
||||
const system_sdk = @import("libs/mach-glfw/system_sdk.zig");
|
||||
const sysjs = @import("libs/mach-sysjs/build.zig");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const sysaudio = sysaudio_sdk.Sdk(.{
|
||||
.system_sdk = system_sdk,
|
||||
.sysjs = sysjs,
|
||||
});
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
|
|
@ -23,7 +21,7 @@ pub fn build(b: *std.Build) void {
|
|||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
example_exe.addModule("sysaudio", sysaudio.module(b));
|
||||
example_exe.addModule("sysaudio", sysaudio.module(b, optimize, target));
|
||||
sysaudio.link(b, example_exe, .{});
|
||||
b.installArtifact(example_exe);
|
||||
|
||||
|
|
|
|||
11
libs/sysaudio/build.zig.zon
Normal file
11
libs/sysaudio/build.zig.zon
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
.{
|
||||
.name = "mach-sysaudio",
|
||||
.version = "0.2.0",
|
||||
|
||||
.dependencies = .{
|
||||
.mach_sysjs = .{
|
||||
.url = "https://github.com/hexops/mach-sysjs/archive/b71eb0531f337fcca5a2b245f595355260109a34.tar.gz",
|
||||
.hash = "12208b30f1d9c229d1e64483354610207c9aa06350a46558560b818d597800ed86e0",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../sysjs
|
||||
|
|
@ -11,14 +11,25 @@ pub fn Sdk(comptime deps: anytype) type {
|
|||
|
||||
var _module: ?*std.build.Module = null;
|
||||
|
||||
pub fn module(b: *std.Build) *std.build.Module {
|
||||
pub fn module(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *std.build.Module {
|
||||
if (_module) |m| return m;
|
||||
_module = b.createModule(.{
|
||||
.source_file = .{ .path = sdkPath("/src/main.zig") },
|
||||
.dependencies = &.{
|
||||
.{ .name = "sysjs", .module = deps.sysjs.module(b) },
|
||||
},
|
||||
});
|
||||
|
||||
if (target.getCpuArch() == .wasm32) {
|
||||
const sysjs_dep = b.dependency("mach_sysjs", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
_module = b.createModule(.{
|
||||
.source_file = .{ .path = sdkPath("/src/main.zig") },
|
||||
.dependencies = &.{
|
||||
.{ .name = "sysjs", .module = sysjs_dep.module("mach-sysjs") },
|
||||
},
|
||||
});
|
||||
} else {
|
||||
_module = b.createModule(.{
|
||||
.source_file = .{ .path = sdkPath("/src/main.zig") },
|
||||
});
|
||||
}
|
||||
return _module.?;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue