Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest master after Zig PR #18160 #82

Merged
merged 4 commits into from
Jan 6, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Install zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.12.0-dev.1710+2bffd8101
version: 0.12.0-dev.2058+04ac028a2

- name: test
run: zig build test --summary all
Expand Down
28 changes: 14 additions & 14 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

_ = b.addModule("xev", .{ .source_file = .{ .path = "src/main.zig" } });
_ = b.addModule("xev", .{ .root_source_file = .{ .path = "src/main.zig" } });

const man_pages = b.option(
bool,
Expand Down Expand Up @@ -51,7 +51,7 @@ pub fn build(b: *std.Build) !void {

// Our tests require libc on Linux and Mac. Note that libxev itself
// does NOT require libc.
const test_libc = switch (target.getOsTag()) {
const test_libc = switch (target.result.os.tag) {
.linux, .macos => true,
else => false,
};
Expand All @@ -73,7 +73,7 @@ pub fn build(b: *std.Build) !void {
test_step.dependOn(&tests_run.step);

// Static C lib
const static_c_lib: ?*std.build.Step.Compile = if (target.getOsTag() != .wasi) lib: {
const static_c_lib: ?*std.Build.Step.Compile = if (target.result.os.tag != .wasi) lib: {
const static_lib = b.addStaticLibrary(.{
.name = "xev",
.root_source_file = .{ .path = "src/c_api.zig" },
Expand All @@ -84,7 +84,7 @@ pub fn build(b: *std.Build) !void {
static_lib.linkLibC();

// Link required libraries if targeting Windows
if (target.getOsTag() == .windows) {
if (target.result.os.tag == .windows) {
static_lib.linkSystemLibrary("ws2_32");
static_lib.linkSystemLibrary("mswsock");
}
Expand Down Expand Up @@ -114,7 +114,7 @@ pub fn build(b: *std.Build) !void {

// Dynamic C lib. We only build this if this is the native target so we
// can link to libxml2 on our native system.
if (target.isNative()) {
if (target.query.isNative()) {
const dynamic_lib_name = "xev";

const dynamic_lib = b.addSharedLibrary(.{
Expand Down Expand Up @@ -190,14 +190,14 @@ pub fn build(b: *std.Build) !void {

fn benchTargets(
b: *std.Build,
target: std.zig.CrossTarget,
mode: std.builtin.Mode,
target: std.Build.ResolvedTarget,
mode: std.builtin.OptimizeMode,
install: bool,
install_name: ?[]const u8,
) !std.StringHashMap(*CompileStep) {
) !std.StringHashMap(*std.Build.Step.Compile) {
_ = mode;

var map = std.StringHashMap(*CompileStep).init(b.allocator);
var map = std.StringHashMap(*std.Build.Step.Compile).init(b.allocator);

// Open the directory
const c_dir_path = (comptime thisDir()) ++ "/src/bench";
Expand Down Expand Up @@ -230,7 +230,7 @@ fn benchTargets(
.target = target,
.optimize = .ReleaseFast, // benchmarks are always release fast
});
c_exe.addModule("xev", b.modules.get("xev").?);
c_exe.root_module.addImport("xev", b.modules.get("xev").?);
if (install) {
const install_step = b.addInstallArtifact(c_exe, .{
.dest_dir = .{ .override = .{ .custom = "bench" } },
Expand All @@ -247,9 +247,9 @@ fn benchTargets(

fn exampleTargets(
b: *std.Build,
target: std.zig.CrossTarget,
optimize: std.builtin.Mode,
c_lib_: ?*std.build.Step.Compile,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
c_lib_: ?*std.Build.Step.Compile,
install: bool,
install_name: ?[]const u8,
) !void {
Expand Down Expand Up @@ -288,7 +288,7 @@ fn exampleTargets(
.target = target,
.optimize = optimize,
});
c_exe.addModule("xev", b.modules.get("xev").?);
c_exe.root_module.addImport("xev", b.modules.get("xev").?);
if (install) {
const install_step = b.addInstallArtifact(c_exe, .{
.dest_dir = .{ .override = .{ .custom = "example" } },
Expand Down
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/bench/ping-pongs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ const Server = struct {
// Echo it back
const c_echo = self.completion_pool.create() catch unreachable;
const buf_write = self.buffer_pool.create() catch unreachable;
std.mem.copy(u8, buf_write, buf.slice[0..n]);
@memcpy(buf_write, buf.slice[0..n]);
socket.write(loop, c_echo, .{ .slice = buf_write[0..n] }, Server, self, writeCallback);

// Read again
Expand Down
4 changes: 2 additions & 2 deletions src/build/ScdocStep.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const std = @import("std");
const mem = std.mem;
const fs = std.fs;
const Step = std.build.Step;
const Step = std.Build.Step;
const Build = std.Build;

/// ScdocStep generates man pages using scdoc(1).
Expand Down Expand Up @@ -46,7 +46,7 @@ pub fn init(builder: *Build) ScdocStep {
};
}

fn make(step: *std.build.Step, progress: *std.Progress.Node) !void {
fn make(step: *std.Build.Step, progress: *std.Progress.Node) !void {
_ = progress;

const self = @fieldParentPtr(ScdocStep, "step", step);
Expand Down
Loading