build: update for zig-0.12.0-dev.2208+4debd4338

This commit is contained in:
torque 2024-01-15 16:54:51 -08:00
parent 4b9dbeea65
commit 2a4b73c0f5
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk
3 changed files with 20 additions and 6 deletions

View File

@ -9,8 +9,9 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const cmark = b.addModule("cmark", .{
.source_file = .{ .path = "src/cmark.zig" },
.root_source_file = .{ .path = "src/cmark.zig" },
});
cmark.addIncludePath(.{ .path = b.getInstallPath(.header, "") });
const cmark_c = cmark_build.cmark_lib(b, .{
.name = "cmark-c",
@ -26,7 +27,7 @@ pub fn build(b: *std.Build) void {
}
const ExampleOptions = struct {
target: std.zig.CrossTarget,
target: std.Build.ResolvedTarget,
cmark_module: *std.Build.Module,
cmark_c: *std.Build.Step.Compile,
};
@ -40,7 +41,7 @@ const examples = [_]Example{
.{ .name = "render_html", .file = "examples/render_html.zig" },
};
pub fn add_examples(b: *std.build, options: ExampleOptions) void {
pub fn add_examples(b: *std.Build, options: ExampleOptions) void {
const example_step = b.step("examples", "build examples");
inline for (examples) |example| {
@ -51,7 +52,7 @@ pub fn add_examples(b: *std.build, options: ExampleOptions) void {
.optimize = .Debug,
});
ex_exe.addModule("cmark", options.cmark_module);
ex_exe.root_module.addImport("cmark", options.cmark_module);
ex_exe.linkLibrary(options.cmark_c);
const install = b.addInstallArtifact(ex_exe, .{});

13
build.zig.zon Normal file
View File

@ -0,0 +1,13 @@
.{
.name = "cmark-zig",
.version = "0.1.0-pre",
.dependencies = .{},
.paths = .{
"src",
"deps/cmark/src",
"deps/cmark/COPYING",
"build.zig",
"build.zig.zon",
"license",
},
}

View File

@ -5,7 +5,7 @@ const std = @import("std");
const CmarkBuildOptions = struct {
name: []const u8 = "cmark-c",
target: std.zig.CrossTarget,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
};
@ -22,7 +22,7 @@ pub fn cmark_lib(
const cflags = [_][]const u8{};
lib.linkLibC();
lib.addCSourceFiles(&common_sources, &cflags);
lib.addCSourceFiles(.{ .files = &common_sources, .flags = &cflags });
lib.addIncludePath(.{ .path = cmark_src_prefix ++ "include" });
const config_h = b.addConfigHeader(.{