Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
- uses: mlugg/setup-zig@v2
with:
version: 0.14.0
version: 0.15.1
- run: |
zig build -Dtarget=x86_64-windows
zig build -Dtarget=aarch64-windows
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ zig-cache/
zig-out/
compile_commands.json
.cache/

.DS_STORE
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The project aims to implement all core utilities, including but not limited to:

### Prerequisites

- Zig compiler (0.14 recommended)
- Zig compiler (0.15.1 recommended)

### Building from Source

Expand Down
17 changes: 10 additions & 7 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ const Executable = struct {
};
}

fn build(self: Executable, b: *std.Build, optimize: std.builtin.Mode, target: std.Build.ResolvedTarget, targets: *std.ArrayList(*std.Build.Step.Compile)) void {
fn build(self: Executable, b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.Build.ResolvedTarget, targets: *std.ArrayList(*std.Build.Step.Compile)) void {
const exe = b.addExecutable(.{
.name = self.name,
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
})
});
targets.append(exe) catch @panic("OOM");

for (self.cpp_sources) |source| {
exe.addCSourceFile(.{
.file = b.path(source),
Expand All @@ -32,6 +34,7 @@ const Executable = struct {
exe.addIncludePath(b.path(include_path));
}
b.installArtifact(exe);
targets.append(b.allocator, exe) catch @panic("OOM");

const run_cmd_name = std.fmt.allocPrint(b.allocator, "run-{s}", .{self.name}) catch @panic("OOM");
const run_cmd_info = std.fmt.allocPrint(b.allocator, "Run the {s} app", .{self.name}) catch @panic("OOM");
Expand All @@ -49,8 +52,8 @@ const Executable = struct {
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
var targets = std.ArrayList(*std.Build.Step.Compile).init(b.allocator);
defer targets.deinit();
var targets : std.ArrayList(*std.Build.Step.Compile) = .empty;
defer targets.deinit(b.allocator);

Executable.init("wc", &[_][]const u8{
"src/wc/main.cpp",
Expand All @@ -73,5 +76,5 @@ pub fn build(b: *std.Build) void {
"src/false",
}).build(b, optimize, target, &targets);

zcc.createStep(b, "cdb", targets.toOwnedSlice() catch @panic("OOM"));
_ = zcc.createStep(b, "cdb", targets.toOwnedSlice(b.allocator) catch @panic("OOM"));
}
6 changes: 3 additions & 3 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
.name = .wc,
.fingerprint = 0xf51ccd2c9e770ecf,
.version = "0.1.0",
.minimum_zig_version = "0.14.0",
.minimum_zig_version = "0.15.1",
.dependencies = .{
.compile_commands = .{
.url = "https://github.com/the-argus/zig-compile-commands/archive/1a71188d1816cc0741785d4694f790a1106a150a.tar.gz",
.hash = "N-V-__8AABjOAAD9JOGy29zdkAQcgyQyd0NaOn0zP0KyC40W",
.url = "https://github.com/the-argus/zig-compile-commands/archive/70fb439897e12cae896c071717d7c9c382918689.tar.gz",
.hash = "zig_compile_commands-0.0.1-OZg5-ULBAABTh3NXO3WXoSUX1474ez0EouuoT2yDANhz",
},
},
.paths = .{
Expand Down