freetype: rename freetype_pkg to pkg

This commit is contained in:
Ali Chraghi 2022-06-08 11:05:22 +04:30 committed by Stephen Gutekanst
parent 772a821ce1
commit d98bfab809
3 changed files with 13 additions and 6 deletions

View file

@ -40,7 +40,7 @@ pub fn build(b: *std.build.Builder) void {
.{ .name = "instanced-cube", .packages = &[_]Pkg{Packages.zmath} }, .{ .name = "instanced-cube", .packages = &[_]Pkg{Packages.zmath} },
.{ .name = "advanced-gen-texture-light", .packages = &[_]Pkg{Packages.zmath} }, .{ .name = "advanced-gen-texture-light", .packages = &[_]Pkg{Packages.zmath} },
.{ .name = "fractal-cube", .packages = &[_]Pkg{Packages.zmath} }, .{ .name = "fractal-cube", .packages = &[_]Pkg{Packages.zmath} },
.{ .name = "gkurve", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg, freetype.freetype_pkg }, .std_platform_only = true }, .{ .name = "gkurve", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg, freetype.pkg }, .std_platform_only = true },
.{ .name = "textured-cube", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg } }, .{ .name = "textured-cube", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg } },
}) |example| { }) |example| {
// FIXME: this is workaround for a problem that some examples (having the std_platform_only=true field) as // FIXME: this is workaround for a problem that some examples (having the std_platform_only=true field) as
@ -62,7 +62,7 @@ pub fn build(b: *std.build.Builder) void {
); );
example_app.setBuildMode(mode); example_app.setBuildMode(mode);
inline for (example.packages) |p| { inline for (example.packages) |p| {
if (std.mem.eql(u8, p.name, freetype.freetype_pkg.name)) if (std.mem.eql(u8, p.name, freetype.pkg.name))
freetype.link(example_app.b, example_app.step, .{}); freetype.link(example_app.b, example_app.step, .{});
} }

View file

@ -33,6 +33,13 @@ pub fn build(b: *Builder) void {
} }
``` ```
and optionaly add harfbuzz:
```zig
exe.addPackage(freetype.harfbuzz_pkg);
freetype.link(b, exe, .{ .harfbuzz = .{} });
```
<details> <details>
<description>Optional: Using Gyro dependency manager</description> <description>Optional: Using Gyro dependency manager</description>

View file

@ -6,7 +6,7 @@ const ft_include_path = ft_root ++ "/include";
const hb_root = thisDir() ++ "/upstream/harfbuzz"; const hb_root = thisDir() ++ "/upstream/harfbuzz";
const hb_include_path = ft_root ++ "/src"; const hb_include_path = ft_root ++ "/src";
pub const freetype_pkg = std.build.Pkg{ pub const pkg = std.build.Pkg{
.name = "freetype", .name = "freetype",
.source = .{ .path = thisDir() ++ "/src/freetype/main.zig" }, .source = .{ .path = thisDir() ++ "/src/freetype/main.zig" },
}; };
@ -31,7 +31,7 @@ pub fn build(b: *std.build.Builder) !void {
const mode = b.standardReleaseOptions(); const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const freetype_tests = b.addTestSource(freetype_pkg.source); const freetype_tests = b.addTestSource(pkg.source);
freetype_tests.setBuildMode(mode); freetype_tests.setBuildMode(mode);
freetype_tests.setTarget(target); freetype_tests.setTarget(target);
link(b, freetype_tests, .{}); link(b, freetype_tests, .{});
@ -39,7 +39,7 @@ pub fn build(b: *std.build.Builder) !void {
const main_tests = b.addTest("test/main.zig"); const main_tests = b.addTest("test/main.zig");
main_tests.setBuildMode(mode); main_tests.setBuildMode(mode);
main_tests.setTarget(target); main_tests.setTarget(target);
main_tests.addPackage(freetype_pkg); main_tests.addPackage(pkg);
link(b, main_tests, .{ .freetype = .{ .ft_config_path = "./test/ft" } }); link(b, main_tests, .{ .freetype = .{ .ft_config_path = "./test/ft" } });
const test_step = b.step("test", "Run library tests"); const test_step = b.step("test", "Run library tests");
@ -53,7 +53,7 @@ pub fn build(b: *std.build.Builder) !void {
const example_exe = b.addExecutable("example-" ++ example, "examples/" ++ example ++ ".zig"); const example_exe = b.addExecutable("example-" ++ example, "examples/" ++ example ++ ".zig");
example_exe.setBuildMode(mode); example_exe.setBuildMode(mode);
example_exe.setTarget(target); example_exe.setTarget(target);
example_exe.addPackage(freetype_pkg); example_exe.addPackage(pkg);
link(b, example_exe, .{}); link(b, example_exe, .{});
example_exe.install(); example_exe.install();