|
1 | 1 | const std = @import("std"); |
2 | | - |
3 | | -const boost_version: std.SemanticVersion = .{ |
4 | | - .major = 1, |
5 | | - .minor = 89, |
6 | | - .patch = 0, |
7 | | -}; |
| 2 | +const zon = @import("build.zig.zon"); |
8 | 3 |
|
9 | 4 | const boost_libs = [_][]const u8{ |
10 | 5 | "core", |
@@ -131,13 +126,15 @@ const boost_libs = [_][]const u8{ |
131 | 126 | "bloom", |
132 | 127 | }; |
133 | 128 |
|
134 | | -pub fn build(b: *std.Build) void { |
| 129 | +pub fn build(b: *std.Build) !void { |
135 | 130 | const target = b.standardTargetOptions(.{}); |
136 | 131 | const optimize = b.standardOptimizeOption(.{}); |
| 132 | + const version = try std.SemanticVersion.parse(zon.version); |
137 | 133 |
|
138 | 134 | const boost = boostLibraries(b, .{ |
139 | 135 | .target = target, |
140 | 136 | .optimize = optimize, |
| 137 | + .boost_version = version, |
141 | 138 | .module = .{ |
142 | 139 | .atomic = b.option(bool, "atomic", "Build boost.atomic library (default: false)") orelse false, |
143 | 140 | .charconv = b.option(bool, "charconv", "Build boost.charconv library (default: false)") orelse false, |
@@ -182,7 +179,7 @@ pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { |
182 | 179 | .optimize = config.optimize, |
183 | 180 | }), |
184 | 181 | .linkage = if (shared) .dynamic else .static, |
185 | | - .version = boost_version, |
| 182 | + .version = config.boost_version, |
186 | 183 | }); |
187 | 184 |
|
188 | 185 | inline for (boost_libs) |name| { |
@@ -278,6 +275,7 @@ pub const Config = struct { |
278 | 275 | target: std.Build.ResolvedTarget, |
279 | 276 | optimize: std.builtin.OptimizeMode, |
280 | 277 | module: ?boostLibrariesModules = null, |
| 278 | + boost_version: ?std.SemanticVersion = null, |
281 | 279 | }; |
282 | 280 |
|
283 | 281 | // No header-only libraries |
@@ -1088,7 +1086,7 @@ fn checkSystemLibrary(compile: *std.Build.Step.Compile, name: []const u8) bool { |
1088 | 1086 | } |
1089 | 1087 | } |
1090 | 1088 |
|
1091 | | - const target = compile.rootModuleTarget(); |
| 1089 | + const target = &compile.rootModuleTarget(); |
1092 | 1090 |
|
1093 | 1091 | if (std.zig.target.isLibCLibName(target, name)) { |
1094 | 1092 | return is_linking_libc; |
|
0 commit comments