Zeke Xiao

Zeke Xiao

github

Zig 使用 build.zig.zon

zig version 0.11.0-dev.2837+b55b8e774
zap 为例

  1. 新建项目 zig init-exe
  2. 添加文件 build.zig.zon
.{
    .name = "testZap",
    .version = "0.0.1",

    .dependencies = .{
        // zap release-0.0.12-test
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/release-0.0.12-test.tar.gz",
            .hash = "12201a5586b87c689c5c9f00075e84affc5207b0e2596efab0355025031da148d072",
        },
    },
}
  1. build.zig 中添加 dependency
    const zap = b.dependency("zap", .{
        .target = target,
        .optimize = optimize,
    });
    exe.addModule("zap", zap.module("zap"));
    exe.linkLibrary(zap.artifact("facil.io"));
  1. 直接 zig build 会拉取依赖
    有一个 open issues 14280,会加一个类似 zig build --fetch 的命令,有一个实现还没合并 15331
  1. zig 暂时不支持 proxy,需要使用全局 vpn
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.