Skip to content

Commit fdca3e4

Browse files
leroycepjmcnamara
authored andcommitted
update build.zig to zig 0.16.0
1 parent 2894634 commit fdca3e4

3 files changed

Lines changed: 24 additions & 23 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ third_party/zlib-1.2.8/zlib.pc
5858

5959
*zig-cache/
6060
zig-out/
61+
zig-pkg/
6162

62-
.swiftpm/
63+
.swiftpm/

build.zig

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn build(b: *std.Build) void {
3333
}
3434
if (tests)
3535
lib.root_module.addCMacro("TESTING", "");
36-
lib.addCSourceFiles(.{
36+
lib.root_module.addCSourceFiles(.{
3737
.files = &.{
3838
"src/vml.c",
3939
"src/chartsheet.c",
@@ -67,7 +67,7 @@ pub fn build(b: *std.Build) void {
6767

6868
// minizip
6969
if (minizip) {
70-
lib.addCSourceFiles(.{
70+
lib.root_module.addCSourceFiles(.{
7171
.files = switch (lib.rootModuleTarget().os.tag) {
7272
.windows => minizip_src ++ [_][]const u8{
7373
"third_party/minizip/iowin32.c",
@@ -79,37 +79,37 @@ pub fn build(b: *std.Build) void {
7979
}
8080

8181
const zlib = buildZlib(b, options);
82-
lib.linkLibrary(zlib);
82+
lib.root_module.linkLibrary(zlib);
8383
lib.installLibraryHeaders(zlib);
8484

8585
// md5
8686
if (!md5)
87-
lib.addCSourceFile(.{
87+
lib.root_module.addCSourceFile(.{
8888
.file = b.path("third_party/md5/md5.c"),
8989
.flags = cflags,
9090
})
9191
else
92-
lib.linkSystemLibrary("crypto");
92+
lib.root_module.linkSystemLibrary("crypto", .{});
9393

9494
// dtoa
9595
if (dtoa)
96-
lib.addCSourceFile(.{
96+
lib.root_module.addCSourceFile(.{
9797
.file = b.path("third_party/dtoa/emyg_dtoa.c"),
9898
.flags = cflags,
9999
});
100100

101101
// tmpfileplus
102102
if (stdtmpfile)
103-
lib.addCSourceFile(.{
103+
lib.root_module.addCSourceFile(.{
104104
.file = b.path("third_party/tmpfileplus/tmpfileplus.c"),
105105
.flags = cflags,
106106
})
107107
else
108108
lib.root_module.addCMacro("USE_STANDARD_TMPFILE", "");
109109

110-
lib.addIncludePath(b.path("include"));
111-
lib.addIncludePath(b.path("third_party"));
112-
lib.linkLibC();
110+
lib.root_module.addIncludePath(b.path("include"));
111+
lib.root_module.addIncludePath(b.path("third_party"));
112+
lib.root_module.link_libc = true;
113113

114114
// get headers on include to zig-out/include
115115
lib.installHeadersDirectory(b.path("include"), "", .{});
@@ -280,15 +280,15 @@ fn buildExe(b: *std.Build, info: BuildExec) void {
280280
.name = info.filename(),
281281
.root_module = createModule(b, info.options),
282282
});
283-
exe.addCSourceFile(.{
283+
exe.root_module.addCSourceFile(.{
284284
.file = b.path(info.path),
285285
.flags = cflags,
286286
});
287-
exe.linkLibrary(info.lib);
287+
exe.root_module.linkLibrary(info.lib);
288288
for (info.lib.root_module.include_dirs.items) |include| {
289289
exe.root_module.include_dirs.append(b.allocator, include) catch @panic("OOM");
290290
}
291-
exe.linkLibC();
291+
exe.root_module.link_libc = true;
292292
b.installArtifact(exe);
293293

294294
const run_cmd = b.addRunArtifact(exe);
@@ -310,20 +310,20 @@ fn buildTest(b: *std.Build, info: BuildExec) void {
310310
.root_module = createModule(b, info.options),
311311
});
312312
exe.root_module.addCMacro("TESTING", "");
313-
exe.addCSourceFile(.{
313+
exe.root_module.addCSourceFile(.{
314314
.file = b.path(info.path),
315315
.flags = cflags,
316316
});
317-
exe.addCSourceFile(.{
317+
exe.root_module.addCSourceFile(.{
318318
.file = b.path("test/unit/test_all.c"),
319319
.flags = cflags,
320320
});
321-
exe.addIncludePath(b.path("test/unit"));
322-
exe.linkLibrary(info.lib);
321+
exe.root_module.addIncludePath(b.path("test/unit"));
322+
exe.root_module.linkLibrary(info.lib);
323323
for (info.lib.root_module.include_dirs.items) |include| {
324324
exe.root_module.include_dirs.append(b.allocator, include) catch @panic("OOM");
325325
}
326-
exe.linkLibC();
326+
exe.root_module.link_libc = true;
327327
b.installArtifact(exe);
328328

329329
const run_cmd = b.addRunArtifact(exe);
@@ -383,8 +383,8 @@ fn buildZlib(b: *std.Build, options: BuildConfig) *std.Build.Step.Compile {
383383
.target = options.target,
384384
.optimize = options.optimize,
385385
})) |zlib_path| {
386-
libz.addIncludePath(zlib_path.path(""));
387-
libz.addCSourceFiles(.{
386+
libz.root_module.addIncludePath(zlib_path.path(""));
387+
libz.root_module.addCSourceFiles(.{
388388
.root = zlib_path.path(""),
389389
.files = &.{
390390
"adler32.c",
@@ -408,6 +408,6 @@ fn buildZlib(b: *std.Build, options: BuildConfig) *std.Build.Step.Compile {
408408
libz.installHeader(zlib_path.path("zconf.h"), "zconf.h");
409409
libz.installHeader(zlib_path.path("zlib.h"), "zlib.h");
410410
}
411-
libz.linkLibC();
411+
libz.root_module.link_libc = true;
412412
return libz;
413413
}

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.name = .libxlsxwriter,
33
.version = "1.1.9",
44
.fingerprint = 0xa28d9a85f22fad0e,
5-
.minimum_zig_version = "0.15.1",
5+
.minimum_zig_version = "0.16.0",
66
.dependencies = .{
77
.zlib = .{
88
.url = "git+https://github.com/madler/zlib#v1.3.1",

0 commit comments

Comments
 (0)