zig build

This commit is contained in:
Matheus C. França 2023-04-23 15:08:04 -03:00 committed by John McNamara
parent f477741dd3
commit f43e53e018
3 changed files with 75 additions and 0 deletions

3
.gitignore vendored
View file

@ -60,3 +60,6 @@ cmake
!cmake/i686-toolchain.cmake
.vscode
zig-cache/
zig-out/

66
build.zig Normal file
View file

@ -0,0 +1,66 @@
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.
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", "Build the Shared Library [default: false]") orelse false;
const lib = if (shared) b.addSharedLibrary(.{
.name = "xlsxwriter",
.target = target,
.optimize = optimize,
.version = .{
.major = 1,
.minor = 1,
.patch = 6,
},
}) else b.addStaticLibrary(.{
.name = "xlsxwriter",
.target = target,
.optimize = optimize,
});
lib.addCSourceFiles(&.{
"src/vml.c",
"src/chartsheet.c",
"src/theme.c",
"src/content_types.c",
"src/xmlwriter.c",
"src/app.c",
"src/styles.c",
"src/core.c",
"src/comment.c",
"src/utility.c",
"src/metadata.c",
"src/custom.c",
"src/hash_table.c",
"src/relationships.c",
"src/drawing.c",
"src/chart.c",
"src/shared_strings.c",
"src/worksheet.c",
"src/format.c",
"src/table.c",
"src/workbook.c",
"src/packager.c",
}, &.{
"-Wall",
"-Wextra",
});
lib.addIncludePath("include");
lib.addIncludePath("third_party");
lib.linkLibC();
lib.installHeadersDirectory("include", "");
b.installArtifact(lib);
}

6
build.zig.zon Normal file
View file

@ -0,0 +1,6 @@
.{
.name = "libxlsxwriter",
.version = "1.1.6",
.dependencies = .{},
}
//syntax tip: zig - anon struct (json-like)