build: depend on mach-freetype via package manager
This commit is contained in:
parent
a20476adef
commit
50cf1d1e85
4 changed files with 9 additions and 14 deletions
6
.gitmodules
vendored
6
.gitmodules
vendored
|
|
@ -9,9 +9,6 @@
|
||||||
shallow = true
|
shallow = true
|
||||||
branch = "mach"
|
branch = "mach"
|
||||||
|
|
||||||
[submodule "freetype/upstream"]
|
|
||||||
path = libs/freetype/upstream
|
|
||||||
url = https://github.com/hexops-graveyard/freetype
|
|
||||||
[submodule "glfw/upstream"]
|
[submodule "glfw/upstream"]
|
||||||
path = libs/glfw/upstream
|
path = libs/glfw/upstream
|
||||||
url = https://github.com/hexops-graveyard/glfw
|
url = https://github.com/hexops-graveyard/glfw
|
||||||
|
|
@ -30,9 +27,6 @@
|
||||||
[submodule "libs/mach-gpu-dawn"]
|
[submodule "libs/mach-gpu-dawn"]
|
||||||
path = libs/mach-gpu-dawn
|
path = libs/mach-gpu-dawn
|
||||||
url = https://github.com/hexops/mach-gpu-dawn
|
url = https://github.com/hexops/mach-gpu-dawn
|
||||||
[submodule "libs/mach-freetype"]
|
|
||||||
path = libs/mach-freetype
|
|
||||||
url = https://github.com/hexops/mach-freetype
|
|
||||||
[submodule "libs/mach-core"]
|
[submodule "libs/mach-core"]
|
||||||
path = libs/mach-core
|
path = libs/mach-core
|
||||||
url = https://github.com/hexops/mach-core
|
url = https://github.com/hexops/mach-core
|
||||||
|
|
|
||||||
12
build.zig
12
build.zig
|
|
@ -1,6 +1,5 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const freetype = @import("libs/mach-freetype/build.zig");
|
|
||||||
const glfw = @import("mach_glfw");
|
const glfw = @import("mach_glfw");
|
||||||
const sysaudio = @import("mach_sysaudio");
|
const sysaudio = @import("mach_sysaudio");
|
||||||
pub const gpu_dawn = @import("libs/mach-gpu-dawn/build.zig"); // TODO(build-system): make this private
|
pub const gpu_dawn = @import("libs/mach-gpu-dawn/build.zig"); // TODO(build-system): make this private
|
||||||
|
|
@ -44,10 +43,7 @@ pub fn module(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig
|
||||||
return _module.?;
|
return _module.?;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const Options = struct {
|
pub const Options = struct { sysaudio: sysaudio.Options = .{} };
|
||||||
sysaudio: sysaudio.Options = .{},
|
|
||||||
freetype: freetype.Options = .{},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
@ -126,7 +122,10 @@ pub const App = struct {
|
||||||
if (options.deps) |v| try deps.appendSlice(v);
|
if (options.deps) |v| try deps.appendSlice(v);
|
||||||
try deps.append(.{ .name = "mach", .module = module(b, options.optimize, options.target) });
|
try deps.append(.{ .name = "mach", .module = module(b, options.optimize, options.target) });
|
||||||
try deps.append(.{ .name = "sysaudio", .module = sysaudio.module(b, options.optimize, options.target) });
|
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) });
|
if (options.use_freetype) |name| {
|
||||||
|
const freetype_dep = b.dependency("mach_freetype", .{ .target = options.target, .optimize = options.optimize });
|
||||||
|
try deps.append(.{ .name = name, .module = freetype_dep.module("mach-freetype") });
|
||||||
|
}
|
||||||
|
|
||||||
const app = try core.App.init(b, .{
|
const app = try core.App.init(b, .{
|
||||||
.name = options.name,
|
.name = options.name,
|
||||||
|
|
@ -152,7 +151,6 @@ pub const App = struct {
|
||||||
|
|
||||||
pub fn link(app: *const App, options: Options) !void {
|
pub fn link(app: *const App, options: Options) !void {
|
||||||
sysaudio.link(app.b, app.compile, options.sysaudio);
|
sysaudio.link(app.b, app.compile, options.sysaudio);
|
||||||
if (app.use_freetype) |_| freetype.link(app.b, app.compile, options.freetype);
|
|
||||||
|
|
||||||
// TODO: basisu support in wasm
|
// TODO: basisu support in wasm
|
||||||
if (app.platform != .web) {
|
if (app.platform != .web) {
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@
|
||||||
.url = "https://pkg.machengine.org/mach-glfw/8e78e0175951117213ea65fec32fd61f2e39f4ea.tar.gz",
|
.url = "https://pkg.machengine.org/mach-glfw/8e78e0175951117213ea65fec32fd61f2e39f4ea.tar.gz",
|
||||||
.hash = "12202c9e56ab6822cf9a16f1b5c15ff17ba17c67c1ec12aa77bc2313dfe9d3c235ec",
|
.hash = "12202c9e56ab6822cf9a16f1b5c15ff17ba17c67c1ec12aa77bc2313dfe9d3c235ec",
|
||||||
},
|
},
|
||||||
|
.mach_freetype = .{
|
||||||
|
.url = "https://pkg.machengine.org/mach-freetype/1f064ee503c6fbc25585a08e29e97977a39967ee.tar.gz",
|
||||||
|
.hash = "1220d25639a4f634e294a83787bbd70088f4d1fd03d840ca3cda2d2e76c1765ecebb",
|
||||||
|
},
|
||||||
.glfw = .{
|
.glfw = .{
|
||||||
.url = "https://pkg.machengine.org/glfw/0e4cdba4216c6def0423462a2f21fef80683d56d.tar.gz",
|
.url = "https://pkg.machengine.org/glfw/0e4cdba4216c6def0423462a2f21fef80683d56d.tar.gz",
|
||||||
.hash = "1220a0b036095c2c54af347c86514ed9dab431299f0140b0e434ed119f85a976c32b",
|
.hash = "1220a0b036095c2c54af347c86514ed9dab431299f0140b0e434ed119f85a976c32b",
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 1c9e2d001bce6ea59544c84363e87e38841ea2ea
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue