@@ -9,8 +9,6 @@ pub fn build(b: *std.Build) !void {
9
9
const optimize = b .standardOptimizeOption (.{});
10
10
const zig_triple = try target .result .linuxTriple (b .allocator );
11
11
12
- var objs = std .ArrayList (* std .Build .Step .Compile ).init (b .allocator );
13
-
14
12
// godot-cpp
15
13
const lib_godot = b .addStaticLibrary (.{
16
14
.name = "godot-cpp" ,
@@ -70,127 +68,19 @@ pub fn build(b: *std.Build) !void {
70
68
try cxxflags .appendSlice (flags .items );
71
69
72
70
const include_paths = [_ ][]const u8 { "llama.cpp" , "llama.cpp/common" };
73
- const llama = buildObj (.{
74
- .b = b ,
75
- .name = "llama" ,
76
- .target = target ,
77
- .optimize = optimize ,
78
- .sources = &.{"llama.cpp/llama.cpp" },
79
- .include_paths = & include_paths ,
80
- .link_lib_cpp = true ,
81
- .link_lib_c = false ,
82
- .flags = cxxflags .items ,
83
- });
84
- const ggml = buildObj (.{
85
- .b = b ,
86
- .name = "ggml" ,
87
- .target = target ,
88
- .optimize = optimize ,
89
- .sources = &.{"llama.cpp/ggml.c" },
90
- .include_paths = & include_paths ,
91
- .link_lib_c = true ,
92
- .link_lib_cpp = false ,
93
- .flags = cflags .items ,
94
- });
95
- const common = buildObj (.{
96
- .b = b ,
97
- .name = "common" ,
98
- .target = target ,
99
- .optimize = optimize ,
100
- .sources = &.{"llama.cpp/common/common.cpp" },
101
- .include_paths = & include_paths ,
102
- .link_lib_cpp = true ,
103
- .link_lib_c = false ,
104
- .flags = cxxflags .items ,
105
- });
106
- const console = buildObj (.{
107
- .b = b ,
108
- .name = "console" ,
109
- .target = target ,
110
- .optimize = optimize ,
111
- .sources = &.{"llama.cpp/common/console.cpp" },
112
- .include_paths = & include_paths ,
113
- .link_lib_cpp = true ,
114
- .link_lib_c = false ,
115
- .flags = cxxflags .items ,
116
- });
117
- const sampling = buildObj (.{
118
- .b = b ,
119
- .name = "sampling" ,
120
- .target = target ,
121
- .optimize = optimize ,
122
- .sources = &.{"llama.cpp/common/sampling.cpp" },
123
- .include_paths = & include_paths ,
124
- .link_lib_cpp = true ,
125
- .link_lib_c = false ,
126
- .flags = cxxflags .items ,
127
- });
128
- const grammar_parser = buildObj (.{
129
- .b = b ,
130
- .name = "grammar_parser" ,
131
- .target = target ,
132
- .optimize = optimize ,
133
- .sources = &.{"llama.cpp/common/grammar-parser.cpp" },
134
- .include_paths = & include_paths ,
135
- .link_lib_cpp = true ,
136
- .link_lib_c = false ,
137
- .flags = cxxflags .items ,
138
- });
139
- const build_info = buildObj (.{
140
- .b = b ,
141
- .name = "build_info" ,
142
- .target = target ,
143
- .optimize = optimize ,
144
- .sources = &.{"llama.cpp/common/build-info.cpp" },
145
- .include_paths = & include_paths ,
146
- .link_lib_cpp = true ,
147
- .link_lib_c = false ,
148
- .flags = cxxflags .items ,
149
- });
150
- const ggml_alloc = buildObj (.{
151
- .b = b ,
152
- .name = "ggml_alloc" ,
153
- .target = target ,
154
- .optimize = optimize ,
155
- .sources = &.{"llama.cpp/ggml-alloc.c" },
156
- .include_paths = & include_paths ,
157
- .link_lib_c = true ,
158
- .link_lib_cpp = false ,
159
- .flags = cflags .items ,
160
- });
161
- const ggml_backend = buildObj (.{
162
- .b = b ,
163
- .name = "ggml_backend" ,
164
- .target = target ,
165
- .optimize = optimize ,
166
- .sources = &.{"llama.cpp/ggml-backend.c" },
167
- .include_paths = & include_paths ,
168
- .link_lib_c = true ,
169
- .link_lib_cpp = false ,
170
- .flags = cflags .items ,
171
- });
172
- const ggml_quants = buildObj (.{
173
- .b = b ,
174
- .name = "ggml_quants" ,
175
- .target = target ,
176
- .optimize = optimize ,
177
- .sources = &.{"llama.cpp/ggml-quants.c" },
178
- .include_paths = & include_paths ,
179
- .link_lib_c = true ,
180
- .link_lib_cpp = false ,
181
- .flags = cflags .items ,
182
- });
183
- const unicode = buildObj (.{
184
- .b = b ,
185
- .name = "unicode" ,
186
- .target = target ,
187
- .optimize = optimize ,
188
- .sources = &.{"llama.cpp/unicode.cpp" },
189
- .include_paths = & include_paths ,
190
- .link_lib_c = false ,
191
- .link_lib_cpp = true ,
192
- .flags = cxxflags .items ,
193
- });
71
+ const llama = buildObj (.{ .b = b , .name = "llama" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/llama.cpp" }, .include_paths = & include_paths , .link_lib_cpp = true , .link_lib_c = false , .flags = cxxflags .items });
72
+ const ggml = buildObj (.{ .b = b , .name = "ggml" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/ggml.c" }, .include_paths = & include_paths , .link_lib_c = true , .link_lib_cpp = false , .flags = cflags .items });
73
+ const common = buildObj (.{ .b = b , .name = "common" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/common/common.cpp" }, .include_paths = & include_paths , .link_lib_cpp = true , .link_lib_c = false , .flags = cxxflags .items });
74
+ const console = buildObj (.{ .b = b , .name = "console" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/common/console.cpp" }, .include_paths = & include_paths , .link_lib_cpp = true , .link_lib_c = false , .flags = cxxflags .items });
75
+ const sampling = buildObj (.{ .b = b , .name = "sampling" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/common/sampling.cpp" }, .include_paths = & include_paths , .link_lib_cpp = true , .link_lib_c = false , .flags = cxxflags .items });
76
+ const grammar_parser = buildObj (.{ .b = b , .name = "grammar_parser" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/common/grammar-parser.cpp" }, .include_paths = & include_paths , .link_lib_cpp = true , .link_lib_c = false , .flags = cxxflags .items });
77
+ const build_info = buildObj (.{ .b = b , .name = "build_info" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/common/build-info.cpp" }, .include_paths = & include_paths , .link_lib_cpp = true , .link_lib_c = false , .flags = cxxflags .items });
78
+ const ggml_alloc = buildObj (.{ .b = b , .name = "ggml_alloc" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/ggml-alloc.c" }, .include_paths = & include_paths , .link_lib_c = true , .link_lib_cpp = false , .flags = cflags .items });
79
+ const ggml_backend = buildObj (.{ .b = b , .name = "ggml_backend" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/ggml-backend.c" }, .include_paths = & include_paths , .link_lib_c = true , .link_lib_cpp = false , .flags = cflags .items });
80
+ const ggml_quants = buildObj (.{ .b = b , .name = "ggml_quants" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/ggml-quants.c" }, .include_paths = & include_paths , .link_lib_c = true , .link_lib_cpp = false , .flags = cflags .items });
81
+ const unicode = buildObj (.{ .b = b , .name = "unicode" , .target = target , .optimize = optimize , .sources = &.{"llama.cpp/unicode.cpp" }, .include_paths = & include_paths , .link_lib_c = false , .link_lib_cpp = true , .flags = cxxflags .items });
82
+
83
+ var objs = std .ArrayList (* std .Build .Step .Compile ).init (b .allocator );
194
84
try objs .appendSlice (&.{ llama , ggml , common , console , sampling , grammar_parser , build_info , ggml_alloc , ggml_backend , ggml_quants , unicode });
195
85
196
86
if (target .result .os .tag == .macos ) {
@@ -280,11 +170,7 @@ const BuildObjectParams = struct {
280
170
};
281
171
282
172
fn buildObj (params : BuildObjectParams ) * std.Build.Step.Compile {
283
- const obj = params .b .addObject (.{
284
- .name = params .name ,
285
- .target = params .target ,
286
- .optimize = params .optimize ,
287
- });
173
+ const obj = params .b .addObject (.{ .name = params .name , .target = params .target , .optimize = params .optimize });
288
174
if (params .target .result .os .tag == .windows ) {
289
175
const vk_path = params .b .graph .env_map .get ("VK_SDK_PATH" ) orelse @panic ("VK_SDK_PATH not set" );
290
176
obj .addIncludePath (.{ .path = params .b .pathJoin (&.{ vk_path , "include" }) });
0 commit comments