diff --git a/.github/workflows/zig_build.yml b/.github/workflows/zig_build.yml index 49861a0a..eb1db35c 100644 --- a/.github/workflows/zig_build.yml +++ b/.github/workflows/zig_build.yml @@ -14,9 +14,7 @@ jobs: with: submodules: recursive fetch-depth: 0 - - uses: goto-bus-stop/setup-zig@v2 - with: - version: 0.12.0 + - uses: mlugg/setup-zig@v1 # default latest-release version - name: Build Summary run: zig build -DBUILD_TESTS -DBUILD_EXAMPLES -DUSE_SYSTEM_MINIZIP --summary all -freference-trace diff --git a/.gitignore b/.gitignore index 4124b881..773d015d 100644 --- a/.gitignore +++ b/.gitignore @@ -61,5 +61,5 @@ cmake .vscode -zig-cache/ -zig-out/ \ No newline at end of file +*zig-cache/ +zig-out/ diff --git a/build.zig b/build.zig index a0a3d40d..efad9a0f 100644 --- a/build.zig +++ b/build.zig @@ -1,18 +1,13 @@ const std = @import("std"); -// Although this function looks imperative, note that its job is to -// declaratively construct a build graph that will be libcuted by an external -// runner. +const xlsxw_version: std.SemanticVersion = .{ + .major = 1, + .minor = 1, + .patch = 9, +}; + pub fn build(b: *std.Build) void { - // Standard target options allows the person running `zig build` to choose - // what target to build for. Here we do not override the defaults, which - // means any target is allowed, and the default is native. Other options - // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); - - // Standard optimization options allow the person running `zig build` to select - // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not - // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); const shared = b.option(bool, "SHARED_LIBRARY", "Build the Shared Library [default: false]") orelse false; @@ -27,11 +22,7 @@ pub fn build(b: *std.Build) void { .name = "xlsxwriter", .target = target, .optimize = optimize, - .version = .{ - .major = 1, - .minor = 1, - .patch = 7, - }, + .version = xlsxw_version, }) else b.addStaticLibrary(.{ .name = "xlsxwriter", .target = target, @@ -95,17 +86,26 @@ pub fn build(b: *std.Build) void { // md5 if (!md5) - lib.addCSourceFile(.{ .file = .{ .path = "third_party/md5/md5.c" }, .flags = cflags }) + lib.addCSourceFile(.{ + .file = b.path("third_party/md5/md5.c"), + .flags = cflags, + }) else lib.linkSystemLibrary("crypto"); // dtoa if (dtoa) - lib.addCSourceFile(.{ .file = b.path("third_party/dtoa/emyg_dtoa.c"), .flags = cflags }); + lib.addCSourceFile(.{ + .file = b.path("third_party/dtoa/emyg_dtoa.c"), + .flags = cflags, + }); // tmpfileplus if (stdtmpfile) - lib.addCSourceFile(.{ .file = .{ .path = "third_party/tmpfileplus/tmpfileplus.c" }, .flags = cflags }) + lib.addCSourceFile(.{ + .file = b.path("third_party/tmpfileplus/tmpfileplus.c"), + .flags = cflags, + }) else lib.defineCMacro("USE_STANDARD_TMPFILE", null); @@ -253,10 +253,13 @@ fn buildExe(b: *std.Build, info: BuildInfo) void { .optimize = info.lib.root_module.optimize.?, .target = info.lib.root_module.resolved_target.?, }); - exe.addCSourceFile(.{ .file = b.path(info.path), .flags = cflags }); + exe.addCSourceFile(.{ + .file = b.path(info.path), + .flags = cflags, + }); exe.linkLibrary(info.lib); for (info.lib.root_module.include_dirs.items) |include| { - exe.root_module.include_dirs.append(b.allocator, include) catch {}; + exe.root_module.include_dirs.append(b.allocator, include) catch @panic("OOM"); } exe.linkLibC(); b.installArtifact(exe); @@ -281,8 +284,14 @@ fn buildTest(b: *std.Build, info: BuildInfo) void { .target = info.lib.root_module.resolved_target.?, }); exe.defineCMacro("TESTING", null); - exe.addCSourceFile(.{ .file = b.path(info.path), .flags = cflags }); - exe.addCSourceFile(.{ .file = b.path("test/unit/test_all.c"), .flags = cflags }); + exe.addCSourceFile(.{ + .file = b.path(info.path), + .flags = cflags, + }); + exe.addCSourceFile(.{ + .file = b.path("test/unit/test_all.c"), + .flags = cflags, + }); exe.addIncludePath(b.path("test/unit")); for (info.lib.root_module.include_dirs.items) |include| { exe.root_module.include_dirs.append(b.allocator, include) catch {}; diff --git a/build.zig.zon b/build.zig.zon index cb15792b..cc74b309 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,11 +1,10 @@ .{ .name = "libxlsxwriter", - .version = "1.1.7", + .version = "1.1.9", .dependencies = .{ .zlib = .{ - .url = "git+https://github.com/madler/zlib#0f51fb4933fc9ce18199cb2554dacea8033e7fd3", - .hash = "12204f12291d6eeb1e05f19d8ab0c7f46c9073fae4c3568dcae7aade149db0b45047", - .lazy = true, + .url = "git+https://github.com/madler/zlib#v1.3.1", + .hash = "1220fed0c74e1019b3ee29edae2051788b080cd96e90d56836eea857b0b966742efb", }, }, .paths = .{ @@ -13,6 +12,9 @@ "build.zig.zon", "Readme.md", "License.txt", + "src", + "include", + "third_party", }, } //syntax tip: zig - anon struct (json-like)