karlseguin / websocket.zig

A websocket implementation for zig
MIT License
283 stars 25 forks source link

zig package manager support #24

Closed chiumichael closed 8 months ago

chiumichael commented 9 months ago

Adds a simplebuild.zig.zon file that enables zig package manager support thereby avoiding the need for git submodules

karlseguin commented 8 months ago

I don't think this is necessary? Pretty sure the existing build.zig is all that's needed.

In your own project, you'll need a build.zig.zon with this entry:

.websocket = .{
  .url = "https://github.com/karlseguin/websocket.zig/archive/2717469d68bf90d513f7250c37a56adf9756a4e1.tar.gz",
  .hash = "1220d88669d3548a74996facc403f8fbefc9b2e2d38a0595c15d08f97bcdc337d268"
}

And in your build.zig, you can get the websocket module via:

const dep_opts = .{.target = target, .optimize = optimize};
const ws_module = b.dependency("websocket", dep_opts).module("websocket");
chiumichael commented 8 months ago

hrmm you're right. that's neat.

imabadparent commented 8 months ago

I think adding a build.zig.zon file would still be useful as it allows for better integration with zig fetch and zls completions