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

[FYI]Regarding zig-network installation #95

Open
g41797 opened this issue Oct 8, 2024 · 2 comments
Open

[FYI]Regarding zig-network installation #95

g41797 opened this issue Oct 8, 2024 · 2 comments

Comments

@g41797
Copy link
Contributor

g41797 commented Oct 8, 2024

Add zig-network to build.zig.zon:

zig fetch --save=network git+https://github.com/ikskuh/zig-network

Import zig-network:

    const zig_network = b.dependency("network", .{
        .target = target,
        .optimize = optimize,
    });

    const lib = b.addStaticLibrary(..);
    lib.root_module.addImport("network", zig_network.module("network"));

    const lib_unit_tests = b.addTest(...);
    lib_unit_tests.root_module.addImport("network", zig_network.module("network"));
@payolin
Copy link

payolin commented Nov 24, 2024

Can you expand the arguments for b.addStaticLibrary ?
On zig version 0.13.0, trying @import("network") and building throws an error about the module not being found with this build.zig:

    const network_dep = b.dependency("network", .{
        .target = target,
        .optimize = optimize,
    });
    const network_lib = b.addStaticLibrary(.{ 
        .name = "network",
        .target = target,
        .optimize = optimize
    });
    network_lib.root_module.addImport("network", network_dep.module("network"));

I am unable to find up-to-date information on the package manager, so maybe I'm not filling the arguments correctly, or perhaps this is not up to date.

@g41797
Copy link
Contributor Author

g41797 commented Nov 24, 2024

May be build.zig will help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants