diff --git a/build.zig b/build.zig index 936fbf2..7028cd1 100644 --- a/build.zig +++ b/build.zig @@ -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, .{}); diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..8d689b4 --- /dev/null +++ b/build.zig.zon @@ -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", + }, +} diff --git a/cmark.build.zig b/cmark.build.zig index 77b3e2c..3b610b1 100644 --- a/cmark.build.zig +++ b/cmark.build.zig @@ -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(.{