Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
const std = @import("std");

const version: std.SemanticVersion = .{ .major = 2, .minor = 13, .patch = 5 };

pub fn build(b: *std.Build) void {
const upstream = b.dependency("libxml2", .{});
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

// get version from zon file
const versionString = @import("./build.zig.zon").version;
const version = std.SemanticVersion.parse(versionString) catch @panic("OOM");
const versionNumber = version.major * 1_00_00 + version.minor * 1_00 + version.patch;

const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode") orelse .static;
const strip = b.option(bool, "strip", "Omit debug information");
const pic = b.option(bool, "pie", "Produce Position Independent Code");
Expand Down Expand Up @@ -84,8 +87,8 @@ pub fn build(b: *std.Build) void {
.include_path = "libxml/xmlversion.h",
.style = .{ .cmake = upstream.path("include/libxml/xmlversion.h.in") },
}, .{
.VERSION = b.fmt("{f}", .{version}),
.LIBXML_VERSION_NUMBER = @as(i64, version.major * 10000 + version.major * 100 + version.patch),
.VERSION = b.fmt("{f}", .{std.SemanticVersion{ .major = version.major, .minor = version.minor, .patch = version.patch }}),
.LIBXML_VERSION_NUMBER = @as(i64, @intCast(versionNumber)),
.LIBXML_VERSION_EXTRA = "",
.WITH_THREADS = threads,
.WITH_THREAD_ALLOC = thread_alloc,
Expand Down