mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.Build: add support for passing comptime_int, float and comptime_float options
This commit is contained in:
parent
7e76818132
commit
7aea384e44
1 changed files with 8 additions and 1 deletions
|
|
@ -465,13 +465,20 @@ fn userInputOptionsFromArgs(allocator: Allocator, args: anytype) UserInputOption
|
|||
.used = false,
|
||||
}) catch @panic("OOM");
|
||||
},
|
||||
.Int => {
|
||||
.ComptimeInt, .Int => {
|
||||
user_input_options.put(field.name, .{
|
||||
.name = field.name,
|
||||
.value = .{ .scalar = std.fmt.allocPrint(allocator, "{d}", .{v}) catch @panic("OOM") },
|
||||
.used = false,
|
||||
}) catch @panic("OOM");
|
||||
},
|
||||
.ComptimeFloat, .Float => {
|
||||
user_input_options.put(field.name, .{
|
||||
.name = field.name,
|
||||
.value = .{ .scalar = std.fmt.allocPrint(allocator, "{e}", .{v}) catch @panic("OOM") },
|
||||
.used = false,
|
||||
}) catch @panic("OOM");
|
||||
},
|
||||
else => @compileError("option '" ++ field.name ++ "' has unsupported type: " ++ @typeName(T)),
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue