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

6
flake.lock generated
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ pub fn link(
) !*std.build.LibExeObjStep { ) !*std.build.LibExeObjStep {
const lib = try buildStbImageResize(b, step, opt); const lib = try buildStbImageResize(b, step, opt);
step.linkLibrary(lib); step.linkLibrary(lib);
inline for (include_paths) |path| step.addIncludePath(path); inline for (include_paths) |path| step.addIncludePath(.{ .path = path });
return lib; return lib;
} }
@ -43,7 +43,7 @@ pub fn buildStbImageResize(
}); });
// Include // Include
inline for (include_paths) |path| lib.addIncludePath(path); inline for (include_paths) |path| lib.addIncludePath(.{ .path = path });
// Link // Link
lib.linkLibC(); lib.linkLibC();
@ -56,7 +56,10 @@ pub fn buildStbImageResize(
}); });
// C files // 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; 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 { pub fn link(b: *std.Build, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep {
const tracy = try buildTracy(b, step); const tracy = try buildTracy(b, step);
step.linkLibrary(tracy); step.linkLibrary(tracy);
step.addIncludePath(root); step.addIncludePath(.{ .path = root });
return tracy; return tracy;
} }
@ -45,11 +45,14 @@ pub fn buildTracy(
}); });
} }
lib.addIncludePath(root); lib.addIncludePath(.{ .path = root });
lib.addCSourceFile(try std.fs.path.join( lib.addCSourceFile(.{
.file = .{ .path = try std.fs.path.join(
b.allocator, b.allocator,
&.{ root, "TracyClient.cpp" }, &.{ root, "TracyClient.cpp" },
), flags.items); ) },
.flags = flags.items,
});
lib.linkLibC(); lib.linkLibC();
lib.linkSystemLibrary("c++"); 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 { pub fn link(b: *std.Build, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep {
const lib = try buildLib(b, step); const lib = try buildLib(b, step);
step.linkLibrary(lib); step.linkLibrary(lib);
step.addIncludePath(include_path); step.addIncludePath(.{ .path = include_path });
return lib; return lib;
} }
@ -34,7 +34,7 @@ pub fn buildLib(
}); });
// Include // Include
lib.addIncludePath(include_path); lib.addIncludePath(.{ .path = include_path });
// Link // Link
lib.linkLibC(); 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 { pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep {
const lib = try buildLib(b, step); const lib = try buildLib(b, step);
step.linkLibrary(lib); step.linkLibrary(lib);
step.addIncludePath(include_path); step.addIncludePath(.{ .path = include_path });
return lib; return lib;
} }
@ -33,7 +33,7 @@ pub fn buildLib(
}); });
// Include // Include
lib.addIncludePath(include_path); lib.addIncludePath(.{ .path = include_path });
// Link // Link
lib.linkLibC(); lib.linkLibC();