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
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
zig: [0.15.1, master]
runs-on: ${{matrix.os}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: ${{matrix.zig}}
- name: Check format
continue-on-error: true
run: zig fmt --check .
Expand Down
12 changes: 6 additions & 6 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/zflecs.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});

module.addOptions("build-options", options);
Expand Down Expand Up @@ -657,29 +658,28 @@ pub fn build(b: *std.Build) void {
.linkage = if (opt_use_shared) .dynamic else .static,
.root_module = module,
});
lib.linkLibC();
b.installArtifact(lib);

if (target.result.os.tag == .windows) {
lib.linkSystemLibrary("ws2_32");
lib.linkSystemLibrary("dbghelp");
lib.root_module.linkSystemLibrary("ws2_32", .{});
lib.root_module.linkSystemLibrary("dbghelp", .{});
}
const test_step = b.step("test", "Run zflecs tests");

const tests_module = b.createModule(.{
.root_source_file = b.path("src/tests.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
tests_module.addOptions("build-options", options);
tests_module.addIncludePath(b.path("libs/flecs"));
tests_module.linkLibrary(lib);

const tests = b.addTest(.{
.name = "zflecs-tests",
.root_module = tests_module,
});
tests.addIncludePath(b.path("libs/flecs"));
tests.linkLibrary(lib);
tests.linkLibC();
b.installArtifact(tests);

test_step.dependOn(&b.addRunArtifact(tests).step);
Expand Down
2 changes: 1 addition & 1 deletion src/tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Walking = struct {};
const Direction = enum { north, south, east, west };

test {
std.testing.refAllDeclsRecursive(@This());
std.testing.refAllDecls(@This());
}

test "extern struct ABI compatibility" {
Expand Down
13 changes: 11 additions & 2 deletions src/zflecs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1319,9 +1319,18 @@ const EcsAllocator = struct {
};

fn flecs_abort() callconv(.c) noreturn {
std.debug.dumpCurrentStackTrace(@returnAddress());
if (builtin.zig_version.major == 0 and builtin.zig_version.minor <= 15) {
std.debug.dumpCurrentStackTrace(@returnAddress());
} else {
std.debug.dumpCurrentStackTrace(.{
.first_address = @returnAddress(),
// TODO: Not sure about that
// .allow_unsafe_unwind = false,
// .context = null,
});
}
@breakpoint();
std.posix.exit(1);
std.process.exit(1);
}

//--------------------------------------------------------------------------------------------------
Expand Down
Loading