Skip to content

Commit

Permalink
update to zig master
Browse files Browse the repository at this point in the history
  • Loading branch information
leecannon committed Jan 8, 2024
1 parent 005412e commit b71ff35
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 47 deletions.
6 changes: 0 additions & 6 deletions .vscode/extensions.json

This file was deleted.

45 changes: 24 additions & 21 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
const std = @import("std");

// TODO: https://github.com/ziglang/zig/issues/15301
const disable_risc32 = true;

pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Run library tests");

const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const target_64 = std.zig.CrossTarget{ .cpu_arch = .riscv64, .os_tag = .freestanding };
const module = b.addModule("sbi", .{
.root_source_file = .{ .path = "sbi.zig" },
.target = target,
.optimize = optimize,
});
_ = module;

buildTests(b, optimize);
}

const test_64 = b.addStaticLibrary(.{
fn buildTests(b: *std.Build, optimize: std.builtin.OptimizeMode) void {
const test_step = b.step("test", "Run library tests");

const target_64 = b.resolveTargetQuery(.{ .cpu_arch = .riscv64, .os_tag = .freestanding });
const build_test_64 = b.addStaticLibrary(.{
.name = "test_64",
.root_source_file = .{ .path = "sbi.zig" },
.target = target_64,
.optimize = optimize,
});
test_step.dependOn(&test_64.step);

if (!disable_risc32) {
const target_32 = std.zig.CrossTarget{ .cpu_arch = .riscv32, .os_tag = .freestanding };

const test_32 = b.addStaticLibrary(.{
.name = "test_32",
.root_source_file = .{ .path = "sbi.zig" },
.target = target_32,
.optimize = optimize,
});
test_step.dependOn(&test_32.step);
}
test_step.dependOn(&build_test_64.step);

b.default_step = test_step;
const target_32 = b.resolveTargetQuery(.{ .cpu_arch = .riscv32, .os_tag = .freestanding });
const build_test_32 = b.addStaticLibrary(.{
.name = "test_32",
.root_source_file = .{ .path = "sbi.zig" },
.target = target_32,
.optimize = optimize,
});
test_step.dependOn(&build_test_32.step);
}
11 changes: 11 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "sbi",

.version = "2.0.3",

.minimum_zig_version = "0.12.0-dev.2063+804cee3b9",

.dependencies = .{},

.paths = .{ "build.zig", "build.zig.zon", "sbi.zig", "LICENCE" },
}
14 changes: 0 additions & 14 deletions gyro.zzz

This file was deleted.

6 changes: 0 additions & 6 deletions zig.mod

This file was deleted.

0 comments on commit b71ff35

Please sign in to comment.