Skip to content

Commit

Permalink
Fixup build.zig.zon for 0.14.0 / zig-master branch (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazfather authored Mar 6, 2025
1 parent 4e4dbf3 commit c0b5f25
Show file tree
Hide file tree
Showing 33 changed files with 82 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## What version of Zig to use

Zig 0.13.0
Zig 0.14.0

## Getting Started With MicroZig

Expand Down
2 changes: 1 addition & 1 deletion build-internals/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.{
.name = "build-internals",
.name = .build_internals,
.version = "0.0.0",
.dependencies = .{
.regz = .{ .path = "../tools/regz" },
Expand Down
8 changes: 5 additions & 3 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.{
.name = "microzig",
.name = .microzig,
// Note: This should be changed if you fork microzig!
.fingerprint = 0x605a83a849186d0f,
.version = "0.13.2",
.minimum_zig_version = "0.13.0",
.dependencies = .{
Expand Down Expand Up @@ -27,8 +29,8 @@

// used for creating package tarballs
.boxzer = .{
.url = "git+https://github.com/mattnite/boxzer.git#59da7d6bcbecb8cb7e76236ea9d18a7a6bcb4d00",
.hash = "1220457e3991f346f2eb4c7adfc1fcd60d71b10a127468949dd91e924e1ec44956f1",
.url = "git+https://github.com/mattnite/boxzer.git#ba48dc0beed520d3fd91738e3717776ac02df175",
.hash = "boxzer-0.1.0-UECMFB7WAAAOQio_OOb84Tmeft26gQ6Ec6jL5MUU_h1r",
},
},
.paths = .{
Expand Down
3 changes: 2 additions & 1 deletion core/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "core",
.name = .core,
.fingerprint = 0x6b8d854f5061dc46,
.version = "0.0.1",
.paths = .{
"LICENSE",
Expand Down
3 changes: 2 additions & 1 deletion drivers/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "microzig_driver_framework",
.name = .driverframework,
.fingerprint = 0xfec1b5453a206a46,
.version = "0.0.1",
.paths = .{
"LICENSE",
Expand Down
27 changes: 13 additions & 14 deletions drivers/stepper/stepper.zig
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ pub fn Stepper(comptime Driver: type) type {
steps_remaining: u32 = 0,
// Steps remaining in decel
steps_to_brake: u32 = 0,
// TODO: Just `.from_us(0)` with zig 0.14!
step_pulse: mdf.time.Duration = mdf.time.Duration.from_us(0),
cruise_step_pulse: mdf.time.Duration = mdf.time.Duration.from_us(0),
remainder: mdf.time.Duration = mdf.time.Duration.from_us(0),
last_action_end: mdf.time.Absolute = mdf.time.Absolute.from_us(0),
next_action_interval: mdf.time.Duration = mdf.time.Duration.from_us(0),
step_pulse: mdf.time.Duration = .from_us(0),
cruise_step_pulse: mdf.time.Duration = .from_us(0),
remainder: mdf.time.Duration = .from_us(0),
last_action_end: mdf.time.Absolute = .from_us(0),
next_action_interval: mdf.time.Duration = .from_us(0),
step_count: u32 = 0,
dir_state: mdf.base.Digital_IO.State = .low,
motor_steps: u16,
Expand Down Expand Up @@ -191,16 +190,16 @@ pub fn Stepper(comptime Driver: type) type {
}

pub fn start_move(self: *Self, steps: i32) void {
self.start_move_time(steps, mdf.time.Duration.from_us(0));
self.start_move_time(steps, .from_us(0));
}

pub fn start_move_time(self: *Self, steps: i32, time: mdf.time.Duration) void {
// set up new move
self.dir_state = if (steps >= 0) .high else .low;
self.last_action_end = mdf.time.Absolute.from_us(0);
self.last_action_end = .from_us(0);
self.steps_remaining = @abs(steps);
self.step_count = 0;
self.remainder = mdf.time.Duration.from_us(0);
self.remainder = .from_us(0);
switch (self.profile) {
.linear_speed => |p| {
const microstep_f: f64 = @floatFromInt(self.microsteps);
Expand Down Expand Up @@ -237,7 +236,7 @@ pub fn Stepper(comptime Driver: type) type {
self.cruise_step_pulse = get_step_pulse(self.motor_steps, self.microsteps, self.rpm);
self.step_pulse = self.cruise_step_pulse;
if (@intFromEnum(time) > self.steps_remaining * @intFromEnum(self.step_pulse)) {
self.step_pulse = mdf.time.Duration.from_us(@intFromFloat(@as(f64, @floatFromInt(time.to_us())) /
self.step_pulse = .from_us(@intFromFloat(@as(f64, @floatFromInt(time.to_us())) /
@as(f64, @floatFromInt(self.steps_remaining))));
}
},
Expand Down Expand Up @@ -272,7 +271,7 @@ pub fn Stepper(comptime Driver: type) type {
} else {
// The series approximates target, set the final value to what it should be instead
self.step_pulse = self.cruise_step_pulse;
self.remainder = mdf.time.Duration.from_us(0);
self.remainder = .from_us(0);
}
},
.decelerating => {
Expand All @@ -297,7 +296,7 @@ pub fn Stepper(comptime Driver: type) type {
self.clock.sleep_us(@intFromEnum(delay_us));
return;
}
const deadline = mdf.time.Deadline.init_relative(start_us, delay_us);
const deadline: mdf.time.Deadline = .init_relative(start_us, delay_us);
while (!deadline.is_reached_by(self.clock.get_time_since_boot())) {}
}

Expand All @@ -320,8 +319,8 @@ pub fn Stepper(comptime Driver: type) type {
self.next_action_interval = if (elapsed.less_than(pulse)) pulse.minus(elapsed) else @enumFromInt(1);
} else {
// end of move
self.last_action_end = mdf.time.Absolute.from_us(0);
self.next_action_interval = mdf.time.Duration.from_us(0);
self.last_action_end = .from_us(0);
self.next_action_interval = .from_us(0);
}
return self.next_action_interval;
}
Expand Down
5 changes: 3 additions & 2 deletions examples/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.{
.name = "examples",
.name = .examples,
.fingerprint = 0x7bd0ad455b19df59,
.version = "0.0.0",
.dependencies = .{
// examples
.@"espressif/esp" = .{ .path = "espressif/esp" },
.@"espressif/esp" = .{ .path = "espressif/esp" },
.@"gigadevice/gd32" = .{ .path = "gigadevice/gd32" },
.@"microchip/atsam" = .{ .path = "microchip/atsam" },
.@"microchip/avr" = .{ .path = "microchip/avr" },
Expand Down
3 changes: 2 additions & 1 deletion examples/espressif/esp/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/espressif/esp",
.name = .examples_espressif_esp,
.fingerprint = 0xa568458fa3375cb1,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion examples/gigadevice/gd32/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/gigadevice/gd32",
.name = .examples_gigadevice_gd32,
.fingerprint = 0x108c715b1d663409,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion examples/microchip/atsam/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/microchip/atsam",
.name = .examples_microchip_atsam,
.fingerprint = 0x43dbad7fe1a6b6e2,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion examples/microchip/avr/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/microchip/avr",
.name = .examples_microchip_avr,
.fingerprint = 0xd9cc1da3b729e043,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
2 changes: 1 addition & 1 deletion examples/no_hal/stm32_l031/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.{
.name = "examples/stmicro/stm32",
.name = .examples_stmicro_stm32,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion examples/nordic/nrf5x/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/nordic/nrf5x",
.name = .examples_nordic_nrf5x,
.fingerprint = 0x485c8762b6f2f539,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion examples/nxp/lpc/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/nxp/lpc",
.name = .examples_nxp_lpc,
.fingerprint = 0xde14b1aa923e4b02,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion examples/raspberrypi/rp2xxx/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/raspberrypi/rp2xxx",
.name = .examples_raspberrypi_rp2xxx,
.fingerprint = 0xffa4bfa151162a57,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion examples/stmicro/stm32/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "examples/stmicro/stm32",
.name = .examples_stmicro_stm32,
.fingerprint = 0xb5843068857d2eb,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
2 changes: 1 addition & 1 deletion examples/wch/ch32v/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.{
.name = "examples/wch/ch32v",
.name = .examples_wch_ch32v,
.version = "0.0.0",
.dependencies = .{
.microzig = .{ .path = "../../.." },
Expand Down
3 changes: 2 additions & 1 deletion modules/foundation-libc/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "foundation-libc",
.name = .foundationlibc,
.fingerprint = 0xfd6aab283c2e012c,
.version = "0.0.0",
.paths = .{
"LICENSE",
Expand Down
9 changes: 4 additions & 5 deletions modules/foundation-libc/test/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn build(b: *Build) void {
// Check if the syntax of all of our header files is valid:
const syntax_validator = b.addStaticLibrary(.{
.name = "syntax-validator",
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});
syntax_validator.addCSourceFile(.{
Expand Down Expand Up @@ -84,7 +84,7 @@ pub fn build(b: *Build) void {
// Check if the syntax of all of our header files is valid:
const assert_validator = b.addStaticLibrary(.{
.name = "assert-validator",
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});
assert_validator.addCSourceFile(.{
Expand All @@ -94,7 +94,7 @@ pub fn build(b: *Build) void {
assert_validator.linkLibrary(foundation);
_ = assert_validator.getEmittedBin();

assert_validator.defineCMacro("FOUNDATION_LIBC_ASSERT", assert_mode);
assert_validator.root_module.addCMacro("FOUNDATION_LIBC_ASSERT", assert_mode);

// Just compile, do not install:
validation_step.dependOn(&assert_validator.step);
Expand Down Expand Up @@ -128,7 +128,7 @@ fn target_can_multithread(target: Build.ResolvedTarget) bool {
};
}

const validation_target_list = [_]std.zig.CrossTarget{
const validation_target_list = [_]std.Target.Query{
.{}, // regular host platform
.{ .os_tag = .freestanding }, // host platform, but no OS

Expand Down Expand Up @@ -160,7 +160,6 @@ const validation_target_list = [_]std.zig.CrossTarget{
// sparc:
.{ .cpu_arch = .sparc, .os_tag = .freestanding },
.{ .cpu_arch = .sparc64, .os_tag = .freestanding },
.{ .cpu_arch = .sparcel, .os_tag = .freestanding },

// power:
.{ .cpu_arch = .powerpc, .os_tag = .freestanding },
Expand Down
3 changes: 2 additions & 1 deletion modules/foundation-libc/test/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "foundation-libc/test",
.name = .foundationlibc_test,
.fingerprint = 0xad325d06b2097ab,
.version = "0.0.0",
.dependencies = .{
.foundation_libc = .{ .path = ".." },
Expand Down
2 changes: 1 addition & 1 deletion port/espressif/esp/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.{
.name = "port/espressif/esp",
.name = .port_espressif_esp,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
3 changes: 2 additions & 1 deletion port/gigadevice/gd32/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "port/gigadevice/gd32",
.name = .port_gigadevice_gd32,
.fingerprint = 0x581d90a3331f3c5a,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
3 changes: 2 additions & 1 deletion port/microchip/atsam/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "port/microchip/atsam",
.name = .port_microchip_atsam,
.fingerprint = 0xb4a4c8787ed6ccf,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
3 changes: 2 additions & 1 deletion port/microchip/avr/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "port/microchip/avr",
.name = .port_microchip_avr,
.fingerprint = 0xd71805541d74311d,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
3 changes: 2 additions & 1 deletion port/nordic/nrf5x/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "port/nordic/nrf5x",
.name = .port_nordic_nrf5x,
.fingerprint = 0x47cc426a5789bfab,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
3 changes: 2 additions & 1 deletion port/nxp/lpc/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "port/nxp/lpc",
.name = .port_nxp_lpc,
.fingerprint = 0xa34b3f0c0a15a836,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
3 changes: 2 additions & 1 deletion port/raspberrypi/rp2xxx/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "port/raspberrypi/rp2xxx",
.name = .port_raspberrypi_rp2xxx,
.fingerprint = 0x841efcfeb290b1e6,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
3 changes: 2 additions & 1 deletion port/stmicro/stm32/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "port/stmicro/stm32",
.name = .port_stmicro_stm32,
.fingerprint = 0x58c5bf1b628dcc9,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
2 changes: 1 addition & 1 deletion port/wch/ch32v/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.{
.name = "port/wch/ch32v",
.name = .port_wch_ch32v,
.version = "0.0.0",
.dependencies = .{
.@"microzig/build-internals" = .{ .path = "../../../build-internals" },
Expand Down
4 changes: 3 additions & 1 deletion tools/package-test/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.{
.name = "package-test",
.name = .package_test,
.fingerprint = 0x63321bc42367f374,
.version = "0.0.0",
.dependencies = .{},
.paths = .{
"build.zig",
"build.zig.zon",
Expand Down
7 changes: 4 additions & 3 deletions tools/regz/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "tools/regz",
.name = .tools_regz,
.fingerprint = 0xf89cb48cac38901f,
.version = "0.0.0",
.paths = .{
"LICENSE",
Expand All @@ -12,11 +13,11 @@
.dependencies = .{
.libxml2 = .{
.url = "git+https://github.com/mattnite/zig-build-libxml2.git#ab99b56cc3709d2008ebc005b096d85d2a03b462",
.hash = "122053ef8368ce881da81fb6bcb95db162dc358243d935bdc52c85996fd53ad46b5f",
.hash = "N-V-__8AAF9angBT74NozogdqB-2vLldsWLcNYJD2TW9xSyF",
},
.sqlite = .{
.url = "git+https://github.com/mattnite/zig-sqlite.git#4e554ab43095859e153a5652667fd8a4d697b223",
.hash = "1220bbf36166a56f03ca55c2f455f70cdb3dd5f8dca1f7c78e57d9402add9635b2b9",
.hash = "sqlite-3.47.2-AAAAACdIpQC782FmpW8DylXC9FX3DNs91fjcoffHjlfZ",
},
},
}
3 changes: 2 additions & 1 deletion tools/uf2/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.{
.name = "tools/uf2",
.name = .tools_uf2,
.fingerprint = 0xc41375bcba522365,
.version = "0.0.0",
.paths = .{
"LICENSE",
Expand Down
Loading

0 comments on commit c0b5f25

Please sign in to comment.