@@ -36,17 +36,20 @@ const Maker = struct {
36
36
}
37
37
38
38
fn init (builder : * std.build.Builder ) ! Maker {
39
- const commit_hash = @embedFile (".git/refs/heads/master" );
39
+ // const commit_hash = @embedFile(".git/refs/heads/master");
40
+ const target = builder .standardTargetOptions (.{});
40
41
const config_header = builder .addConfigHeader (
41
42
.{ .style = .blank , .include_path = "build-info.h" },
42
43
.{
43
44
.BUILD_NUMBER = 0 ,
44
- .BUILD_COMMIT = commit_hash [0 .. commit_hash .len - 1 ], // omit newline
45
+ .BUILD_COMMIT = "12345" , // omit newline
46
+ .BUILD_COMPILER = "Zig 0.11.0" ,
47
+ .BUILD_TARGET = try target .allocDescription (builder .allocator ),
45
48
},
46
49
);
47
50
var m = Maker {
48
51
.builder = builder ,
49
- .target = builder . standardTargetOptions (.{}) ,
52
+ .target = target ,
50
53
.optimize = builder .standardOptimizeOption (.{}),
51
54
.config_header = config_header ,
52
55
.enable_lto = false ,
@@ -58,7 +61,7 @@ const Maker = struct {
58
61
try m .addCFlag ("-std=c11" );
59
62
try m .addCxxFlag ("-std=c++11" );
60
63
try m .addProjectInclude (&.{});
61
- try m .addProjectInclude (&.{"examples " });
64
+ try m .addProjectInclude (&.{"common " });
62
65
return m ;
63
66
}
64
67
@@ -71,6 +74,7 @@ const Maker = struct {
71
74
o .addCSourceFiles (&.{src }, m .cxxflags .items );
72
75
o .linkLibCpp ();
73
76
}
77
+ o .addConfigHeader (m .config_header );
74
78
for (m .include_dirs .items ) | i | o .addIncludePath (.{ .path = i });
75
79
o .want_lto = m .enable_lto ;
76
80
return o ;
@@ -104,15 +108,15 @@ pub fn build(b: *std.build.Builder) !void {
104
108
const ggml = make .obj ("ggml" , "ggml.c" );
105
109
const ggml_alloc = make .obj ("ggml-alloc" , "ggml-alloc.c" );
106
110
const llama = make .obj ("llama" , "llama.cpp" );
107
- const common = make .obj ("common" , "examples /common.cpp" );
108
- const console = make .obj ("common" , "examples /console.cpp" );
109
- const grammar_parser = make .obj ("grammar-parser" , "examples /grammar-parser.cpp" );
111
+ const common = make .obj ("common" , "common /common.cpp" );
112
+ const console = make .obj ("common" , "common /console.cpp" );
113
+ const grammar_parser = make .obj ("grammar-parser" , "common /grammar-parser.cpp" );
110
114
111
115
_ = make .exe ("main" , "examples/main/main.cpp" , &.{ ggml , ggml_alloc , llama , common , console , grammar_parser });
112
- _ = make .exe ("quantize" , "examples/quantize/quantize.cpp" , &.{ ggml , ggml_alloc , llama });
116
+ _ = make .exe ("quantize" , "examples/quantize/quantize.cpp" , &.{ ggml , ggml_alloc , llama , common });
113
117
_ = make .exe ("perplexity" , "examples/perplexity/perplexity.cpp" , &.{ ggml , ggml_alloc , llama , common });
114
118
_ = make .exe ("embedding" , "examples/embedding/embedding.cpp" , &.{ ggml , ggml_alloc , llama , common });
115
- _ = make .exe ("train-text-from-scratch" , "examples/train-text-from-scratch/train-text-from-scratch.cpp" , &.{ ggml , ggml_alloc , llama });
119
+ _ = make .exe ("train-text-from-scratch" , "examples/train-text-from-scratch/train-text-from-scratch.cpp" , &.{ ggml , ggml_alloc , llama , common });
116
120
117
121
const server = make .exe ("server" , "examples/server/server.cpp" , &.{ ggml , ggml_alloc , llama , common , grammar_parser });
118
122
if (server .target .isWindows ()) {
0 commit comments