2024-03-05 22:37:51 -08:00
|
|
|
// This file is licensed under the CC0 1.0 license.
|
|
|
|
// See: https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
|
|
|
|
|
|
|
const std = @import("std");
|
|
|
|
const libyaml_build = @import("./libyaml.build.zig");
|
|
|
|
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
|
|
|
|
const yaml_zig = b.addModule("libyaml", .{
|
2024-03-06 20:54:31 -08:00
|
|
|
.source_file = .{ .path = "src/yaml.zig" },
|
2024-03-05 22:37:51 -08:00
|
|
|
});
|
|
|
|
// yaml_zig.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
|
|
|
|
// _ = yaml_zig;
|
|
|
|
|
|
|
|
const libyaml = libyaml_build.libyamlLib(b, .{
|
|
|
|
.name = "libyaml",
|
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
|
|
|
|
2024-03-07 22:33:57 -08:00
|
|
|
const example_step = b.step("example", "build example");
|
|
|
|
|
|
|
|
const ex_exe = b.addExecutable(.{
|
2024-03-05 22:37:51 -08:00
|
|
|
.name = "yamltest",
|
2024-03-07 22:33:57 -08:00
|
|
|
.root_source_file = .{ .path = "example/main.zig" },
|
2024-03-05 22:37:51 -08:00
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
2024-03-07 22:33:57 -08:00
|
|
|
ex_exe.linkLibrary(libyaml);
|
|
|
|
ex_exe.addModule("yaml", yaml_zig);
|
2024-03-05 22:37:51 -08:00
|
|
|
|
2024-03-07 22:33:57 -08:00
|
|
|
const install = b.addInstallArtifact(ex_exe, .{});
|
|
|
|
example_step.dependOn(&install.step);
|
2024-03-05 22:37:51 -08:00
|
|
|
}
|