1 Star 0 Fork 0

yalight/zig-postgres

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.zig 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
tonis2 提交于 2021-04-17 11:11 . Update file structure
const Builder = @import("std").build.Builder;
const examples = [2][]const u8{ "main", "custom_types" };
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const db_uri = b.option(
[]const u8,
"db",
"Specify the database url",
) orelse "postgresql://root@tonis-xps:26257?sslmode=disable";
inline for (examples) |example| {
const exe = b.addExecutable(example, "examples/" ++ example ++ ".zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.addBuildOption([]const u8, "db_uri", db_uri);
exe.addPackagePath("postgres", "src/postgres.zig");
exe.linkSystemLibrary("c");
exe.linkSystemLibrary("libpq");
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step(example, "Run the app");
run_step.dependOn(&run_cmd.step);
}
const tests = b.addTest("tests.zig");
tests.setBuildMode(mode);
tests.setTarget(target);
tests.linkSystemLibrary("c");
tests.linkSystemLibrary("libpq");
tests.addPackagePath("postgres", "src/postgres.zig");
tests.addBuildOption([]const u8, "db_uri", db_uri);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&tests.step);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cekongnet/zig-postgres.git
[email protected]:cekongnet/zig-postgres.git
cekongnet
zig-postgres
zig-postgres
main

搜索帮助