Compare commits

...

3 Commits

Author SHA1 Message Date
f431f7aa1c build: update for zig-0.13 2024-06-18 12:48:32 -07:00
a9f2298132 fix useless var
Unlike lists, this isn't mutated for maps because there's no
intermediate builder object being used for maps (lists are assembled
with an ArrayList, after which they are converted to plain slices).
2024-05-12 18:49:22 -07:00
2b643c5221 build: update for zig-0.12.0 2024-05-12 18:45:27 -07:00
3 changed files with 9 additions and 10 deletions

View File

@@ -9,10 +9,8 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const yaml_zig = b.addModule("zaye", .{
.source_file = .{ .path = "src/zaye.zig" },
.root_source_file = b.path("src/zaye.zig"),
});
// yaml_zig.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
// _ = yaml_zig;
const libyaml = libyaml_build.libyamlLib(b, .{
.name = "libyaml",
@@ -20,16 +18,17 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});
yaml_zig.linkLibrary(libyaml);
const example_step = b.step("example", "build example");
const ex_exe = b.addExecutable(.{
.name = "yamltest",
.root_source_file = .{ .path = "example/main.zig" },
.root_source_file = b.path("example/main.zig"),
.target = target,
.optimize = optimize,
});
ex_exe.linkLibrary(libyaml);
ex_exe.addModule("yaml", yaml_zig);
ex_exe.root_module.addImport("yaml", yaml_zig);
const install = b.addInstallArtifact(ex_exe, .{});
example_step.dependOn(&install.step);

View File

@@ -5,7 +5,7 @@ const std = @import("std");
const LibyamlOptions = struct {
name: []const u8,
target: std.zig.CrossTarget,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
};
@@ -22,8 +22,8 @@ pub fn libyamlLib(
const cflags = [_][]const u8{};
lib.linkLibC();
lib.addIncludePath(.{ .path = include_prefix });
lib.addCSourceFiles(&sources, &cflags);
lib.addIncludePath(b.path(include_prefix));
lib.addCSourceFiles(.{ .files = &sources, .flags = &cflags });
lib.defineCMacro("YAML_VERSION_MAJOR", "0");
lib.defineCMacro("YAML_VERSION_MINOR", "2");
lib.defineCMacro("YAML_VERSION_PATCH", "5");

View File

@@ -266,7 +266,7 @@ pub const Value = union(enum) {
}
fn endMap(self: *Builder, diag: *ParseDiagnostic) !void {
var top = self.container_stack.pop();
const top = self.container_stack.pop();
if (top != .map) {
diag.setMessage("map ended when a map was not the top container");