-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
76 lines (69 loc) · 2.44 KB
/
Copy pathbuild.zig
File metadata and controls
76 lines (69 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const pgExe = b.addExecutable(.{
.name = "pg",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/pg.zig"),
.target = target,
}),
});
const pg = b.dependency("pg", .{});
pgExe.root_module.addImport("pg", pg.module("pg"));
b.installArtifact(pgExe);
const libpqExe = b.addExecutable(.{
.name = "libpq",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/libpq.zig"),
.target = target,
}),
});
const Translator = @import("translate_c").Translator;
const translate_c = b.dependency("translate_c", .{});
const translator: Translator = .init(translate_c, .{
.c_source_file = b.path("examples/libpq.h"),
.target = target,
.optimize = optimize,
});
translator.addIncludePath(.{ .cwd_relative = "/usr/include/postgresql" });
translator.mod.linkSystemLibrary("pq", .{});
libpqExe.root_module.addImport("libpq", translator.mod);
b.installArtifact(libpqExe);
const openaiExe = b.addExecutable(.{
.name = "openai",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/openai.zig"),
.target = target,
}),
});
openaiExe.root_module.addImport("pg", pg.module("pg"));
b.installArtifact(openaiExe);
const cohereExe = b.addExecutable(.{
.name = "cohere",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/cohere.zig"),
.target = target,
}),
});
cohereExe.root_module.addImport("pg", pg.module("pg"));
b.installArtifact(cohereExe);
const hybridExe = b.addExecutable(.{
.name = "hybrid",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/hybrid.zig"),
.target = target,
}),
});
hybridExe.root_module.addImport("pg", pg.module("pg"));
b.installArtifact(hybridExe);
const sparseExe = b.addExecutable(.{
.name = "sparse",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/sparse.zig"),
.target = target,
}),
});
sparseExe.root_module.addImport("pg", pg.module("pg"));
b.installArtifact(sparseExe);
}