update zig

This commit is contained in:
Mitchell Hashimoto
2023-08-02 14:39:19 -07:00
parent 4b3b42bc54
commit d649b3f6d4
11 changed files with 75 additions and 49 deletions

View File

@ -684,11 +684,11 @@ fn addDeps(
// stb_image_resize
const stb_image_resize_step = try stb_image_resize.link(b, step, .{});
try static_libs.append(.{ .generated = &stb_image_resize_step.output_path_source });
try static_libs.append(stb_image_resize_step.getEmittedBin());
// utf8proc
const utf8proc_step = try utf8proc.link(b, step);
try static_libs.append(.{ .generated = &utf8proc_step.output_path_source });
try static_libs.append(utf8proc_step.getEmittedBin());
// Imgui, we have to do this later since we need some information
const imgui_backends = if (step.target.isDarwin())
@ -702,7 +702,7 @@ fn addDeps(
// Dynamic link
if (!static) {
step.addIncludePath(freetype.include_path_self);
step.addIncludePath(.{ .path = freetype.include_path_self });
step.linkSystemLibrary("bzip2");
step.linkSystemLibrary("freetype2");
step.linkSystemLibrary("harfbuzz");
@ -716,7 +716,7 @@ fn addDeps(
// Other dependencies, we may dynamically link
if (static) {
const zlib_step = try zlib.link(b, step);
try static_libs.append(.{ .generated = &zlib_step.output_path_source });
try static_libs.append(zlib_step.getEmittedBin());
const libpng_step = try libpng.link(b, step, .{
.zlib = .{
@ -724,7 +724,7 @@ fn addDeps(
.include = &zlib.include_paths,
},
});
try static_libs.append(.{ .generated = &libpng_step.output_path_source });
try static_libs.append(libpng_step.getEmittedBin());
// Freetype
const freetype_step = try freetype.link(b, step, .{
@ -740,7 +740,7 @@ fn addDeps(
.include = &zlib.include_paths,
},
});
try static_libs.append(.{ .generated = &freetype_step.output_path_source });
try static_libs.append(freetype_step.getEmittedBin());
// Harfbuzz
const harfbuzz_step = try harfbuzz.link(b, step, .{
@ -755,11 +755,11 @@ fn addDeps(
},
});
system_sdk.include(b, harfbuzz_step, .{});
try static_libs.append(.{ .generated = &harfbuzz_step.output_path_source });
try static_libs.append(harfbuzz_step.getEmittedBin());
// Pixman
const pixman_step = try pixman.link(b, step, .{});
try static_libs.append(.{ .generated = &pixman_step.output_path_source });
try static_libs.append(pixman_step.getEmittedBin());
// Only Linux gets fontconfig
if (font_backend.hasFontconfig()) {
@ -874,8 +874,8 @@ fn benchSteps(
.root_source_file = .{ .path = path },
.target = target,
.optimize = optimize,
.main_pkg_path = .{ .path = "./src" },
});
c_exe.setMainPkgPath("./src");
if (install) b.installArtifact(c_exe);
_ = try addDeps(b, c_exe, true);
}

6
flake.lock generated
View File

@ -126,11 +126,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1690503794,
"narHash": "sha256-KeJI6b2CxOFeCzp8wWJCdct5XSgUKpsDap0rkWttVXc=",
"lastModified": 1690978078,
"narHash": "sha256-+S9s6sjOGuGCtA9njTdduJ7KjZm2tskxKhwGRKBK/xM=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "cdf67ad78726cd7919984efbb83924ea47b4c0f1",
"rev": "c9f51464f2c2c9c75f3d7fdc58c157d252545dec",
"type": "github"
},
"original": {

View File

@ -41,8 +41,8 @@ pub fn link(
) !*std.build.LibExeObjStep {
const lib = try buildFreetype(b, step, opt);
step.linkLibrary(lib);
step.addIncludePath(include_path);
step.addIncludePath(include_path_self);
step.addIncludePath(.{ .path = include_path });
step.addIncludePath(.{ .path = include_path_self });
return lib;
}
@ -59,7 +59,7 @@ pub fn buildFreetype(
});
// Include
lib.addIncludePath(include_path);
lib.addIncludePath(.{ .path = include_path });
// Link
lib.linkLibC();
@ -70,7 +70,7 @@ pub fn buildFreetype(
lib.linkSystemLibrary("libpng");
if (opt.libpng.include) |dirs|
for (dirs) |dir| lib.addIncludePath(dir);
for (dirs) |dir| lib.addIncludePath(.{ .path = dir });
}
if (opt.zlib.enabled) {
if (opt.zlib.step) |zlib|
@ -79,7 +79,7 @@ pub fn buildFreetype(
lib.linkSystemLibrary("z");
if (opt.zlib.include) |dirs|
for (dirs) |dir| lib.addIncludePath(dir);
for (dirs) |dir| lib.addIncludePath(.{ .path = dir });
}
// Compile
@ -100,16 +100,30 @@ pub fn buildFreetype(
// C files
lib.addCSourceFiles(srcs, flags.items);
switch (target.getOsTag()) {
.linux => lib.addCSourceFile(root ++ "builds/unix/ftsystem.c", flags.items),
.windows => lib.addCSourceFile(root ++ "builds/windows/ftsystem.c", flags.items),
else => lib.addCSourceFile(root ++ "src/base/ftsystem.c", flags.items),
.linux => lib.addCSourceFile(.{
.file = .{ .path = root ++ "builds/unix/ftsystem.c" },
.flags = flags.items,
}),
.windows => lib.addCSourceFile(.{
.file = .{ .path = root ++ "builds/windows/ftsystem.c" },
.flags = flags.items,
}),
else => lib.addCSourceFile(.{
.file = .{ .path = root ++ "src/base/ftsystem.c" },
.flags = flags.items,
}),
}
switch (target.getOsTag()) {
.windows => {
lib.addCSourceFile(root ++ "builds/windows/ftdebug.c", flags.items);
lib.addCSourceFile(root ++ "src/base/ftver.c", flags.items);
lib.addCSourceFiles(&.{
root ++ "builds/windows/ftdebug.c",
root ++ "src/base/ftver.c",
}, flags.items);
},
else => lib.addCSourceFile(root ++ "src/base/ftdebug.c", flags.items),
else => lib.addCSourceFile(.{
.file = .{ .path = root ++ "src/base/ftdebug.c" },
.flags = flags.items,
}),
}
return lib;

View File

@ -45,7 +45,7 @@ pub fn link(
) !*std.build.LibExeObjStep {
const lib = try buildHarfbuzz(b, step, opt);
step.linkLibrary(lib);
step.addIncludePath(include_path);
step.addIncludePath(.{ .path = include_path });
return lib;
}
@ -61,7 +61,7 @@ pub fn buildHarfbuzz(
});
// Include
lib.addIncludePath(include_path);
lib.addIncludePath(.{ .path = include_path });
// Link
lib.linkLibC();
@ -73,7 +73,7 @@ pub fn buildHarfbuzz(
lib.linkSystemLibrary("freetype2");
if (opt.freetype.include) |dirs|
for (dirs) |dir| lib.addIncludePath(dir);
for (dirs) |dir| lib.addIncludePath(.{ .path = dir });
}
// Compile

View File

@ -32,7 +32,7 @@ pub fn link(
) !*std.build.LibExeObjStep {
const lib = try buildLib(b, step, opt);
step.linkLibrary(lib);
step.addIncludePath(include_path);
step.addIncludePath(.{ .path = include_path });
return lib;
}
@ -49,8 +49,8 @@ pub fn buildLib(
});
// Include
lib.addIncludePath(include_path);
lib.addIncludePath(include_path_pnglibconf);
lib.addIncludePath(.{ .path = include_path });
lib.addIncludePath(.{ .path = include_path_pnglibconf });
// Link
lib.linkLibC();
@ -64,7 +64,7 @@ pub fn buildLib(
lib.linkSystemLibrary("z");
if (opt.zlib.include) |dirs|
for (dirs) |dir| lib.addIncludePath(dir);
for (dirs) |dir| lib.addIncludePath(.{ .path = dir });
// Compile
var flags = std.ArrayList([]const u8).init(b.allocator);

View File

@ -27,8 +27,14 @@ pub fn link(
.target = step.target,
.optimize = step.optimize,
});
step.addCSourceFile(comptime thisDir() ++ "/os/log.c", flags.items);
step.addCSourceFile(comptime thisDir() ++ "/text/ext.c", flags.items);
step.addCSourceFile(.{
.file = .{ .path = comptime thisDir() ++ "/os/log.c" },
.flags = flags.items,
});
step.addCSourceFile(.{
.file = .{ .path = comptime thisDir() ++ "/text/ext.c" },
.flags = flags.items,
});
step.linkFramework("CoreFoundation");
step.linkFramework("CoreText");
return lib;

View File

@ -42,8 +42,8 @@ pub fn link(
) !*std.build.LibExeObjStep {
const lib = try buildPixman(b, step, opt);
step.linkLibrary(lib);
step.addIncludePath(include_path);
step.addIncludePath(include_path_self);
step.addIncludePath(.{ .path = include_path });
step.addIncludePath(.{ .path = include_path_self });
return lib;
}
@ -62,8 +62,8 @@ pub fn buildPixman(
});
// Include
lib.addIncludePath(include_path);
lib.addIncludePath(include_path_self);
lib.addIncludePath(.{ .path = include_path });
lib.addIncludePath(.{ .path = include_path_self });
// Link
lib.linkLibC();

View File

@ -25,7 +25,7 @@ pub fn link(
) !*std.build.LibExeObjStep {
const lib = try buildStbImageResize(b, step, opt);
step.linkLibrary(lib);
inline for (include_paths) |path| step.addIncludePath(path);
inline for (include_paths) |path| step.addIncludePath(.{ .path = path });
return lib;
}
@ -43,7 +43,7 @@ pub fn buildStbImageResize(
});
// Include
inline for (include_paths) |path| lib.addIncludePath(path);
inline for (include_paths) |path| lib.addIncludePath(.{ .path = path });
// Link
lib.linkLibC();
@ -56,7 +56,10 @@ pub fn buildStbImageResize(
});
// C files
lib.addCSourceFile(root ++ "/stb_image_resize.c", flags.items);
lib.addCSourceFile(.{
.file = .{ .path = root ++ "/stb_image_resize.c" },
.flags = flags.items,
});
return lib;
}

View File

@ -16,7 +16,7 @@ fn thisDir() []const u8 {
pub fn link(b: *std.Build, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep {
const tracy = try buildTracy(b, step);
step.linkLibrary(tracy);
step.addIncludePath(root);
step.addIncludePath(.{ .path = root });
return tracy;
}
@ -45,11 +45,14 @@ pub fn buildTracy(
});
}
lib.addIncludePath(root);
lib.addCSourceFile(try std.fs.path.join(
lib.addIncludePath(.{ .path = root });
lib.addCSourceFile(.{
.file = .{ .path = try std.fs.path.join(
b.allocator,
&.{ root, "TracyClient.cpp" },
), flags.items);
) },
.flags = flags.items,
});
lib.linkLibC();
lib.linkSystemLibrary("c++");

View File

@ -19,7 +19,7 @@ fn thisDir() []const u8 {
pub fn link(b: *std.Build, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep {
const lib = try buildLib(b, step);
step.linkLibrary(lib);
step.addIncludePath(include_path);
step.addIncludePath(.{ .path = include_path });
return lib;
}
@ -34,7 +34,7 @@ pub fn buildLib(
});
// Include
lib.addIncludePath(include_path);
lib.addIncludePath(.{ .path = include_path });
// Link
lib.linkLibC();

View File

@ -18,7 +18,7 @@ fn thisDir() []const u8 {
pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep {
const lib = try buildLib(b, step);
step.linkLibrary(lib);
step.addIncludePath(include_path);
step.addIncludePath(.{ .path = include_path });
return lib;
}
@ -33,7 +33,7 @@ pub fn buildLib(
});
// Include
lib.addIncludePath(include_path);
lib.addIncludePath(.{ .path = include_path });
// Link
lib.linkLibC();