Skip to content

Commit b12fa0d

Browse files
cebtenzzrekassane
andauthored
build : link against build info instead of compiling against it (ggml-org#3879)
* cmake : fix build when .git does not exist * cmake : simplify BUILD_INFO target * cmake : add missing dependencies on BUILD_INFO * build : link against build info instead of compiling against it * zig : make build info a .cpp source instead of a header Co-authored-by: Matheus C. França <[email protected]> * cmake : revert change to CMP0115 --------- Co-authored-by: Matheus C. França <[email protected]>
1 parent 4d719a6 commit b12fa0d

36 files changed

+143
-191
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ models-mnt
6565
/parallel
6666
/train-text-from-scratch
6767
/vdot
68-
build-info.h
68+
/common/build-info.cpp
6969
arm_neon.h
7070
compile_commands.json
7171
CMakeSettings.json

Diff for: CMakeLists.txt

-33
Original file line numberDiff line numberDiff line change
@@ -100,39 +100,6 @@ option(LLAMA_BUILD_TESTS "llama: build tests" ${LLAMA_STANDALO
100100
option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE})
101101
option(LLAMA_BUILD_SERVER "llama: build server example" ON)
102102

103-
#
104-
# Build info header
105-
#
106-
107-
# Generate initial build-info.h
108-
include(${CMAKE_CURRENT_SOURCE_DIR}/scripts/build-info.cmake)
109-
110-
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
111-
set(GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.git")
112-
113-
# Is git submodule
114-
if(NOT IS_DIRECTORY "${GIT_DIR}")
115-
file(READ ${GIT_DIR} REAL_GIT_DIR_LINK)
116-
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" REAL_GIT_DIR ${REAL_GIT_DIR_LINK})
117-
set(GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${REAL_GIT_DIR}")
118-
endif()
119-
120-
# Add a custom target for build-info.h
121-
add_custom_target(BUILD_INFO ALL DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/build-info.h")
122-
123-
# Add a custom command to rebuild build-info.h when .git/index changes
124-
add_custom_command(
125-
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/build-info.h"
126-
COMMENT "Generating build details from Git"
127-
COMMAND ${CMAKE_COMMAND} -DMSVC=${MSVC} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION} -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_VS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -P "${CMAKE_CURRENT_SOURCE_DIR}/scripts/build-info.cmake"
128-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
129-
DEPENDS "${GIT_DIR}/index"
130-
VERBATIM
131-
)
132-
else()
133-
message(WARNING "Git repository not found; to enable automatic generation of build info, make sure Git is installed and the project is a Git repository.")
134-
endif()
135-
136103
#
137104
# Compile flags
138105
#

Diff for: Makefile

+37-34
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,9 @@ llama.o: llama.cpp ggml.h ggml-alloc.h ggml-backend.h ggml-cuda.h ggml-metal.h l
542542
$(CXX) $(CXXFLAGS) -c $< -o $@
543543

544544
COMMON_H_DEPS = common/common.h common/sampling.h common/log.h
545-
COMMON_DEPS = common.o sampling.o grammar-parser.o
545+
COMMON_DEPS = common.o sampling.o grammar-parser.o build-info.o
546546

547-
common.o: common/common.cpp build-info.h $(COMMON_H_DEPS)
547+
common.o: common/common.cpp $(COMMON_H_DEPS)
548548
$(CXX) $(CXXFLAGS) -c $< -o $@
549549

550550
sampling.o: common/sampling.cpp $(COMMON_H_DEPS)
@@ -563,46 +563,46 @@ libllama.so: llama.o ggml.o $(OBJS)
563563
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
564564

565565
clean:
566-
rm -vrf *.o tests/*.o *.so *.dll benchmark-matmult build-info.h *.dot $(COV_TARGETS) $(BUILD_TARGETS) $(TEST_TARGETS)
566+
rm -vrf *.o tests/*.o *.so *.dll benchmark-matmult common/build-info.cpp *.dot $(COV_TARGETS) $(BUILD_TARGETS) $(TEST_TARGETS)
567567

568568
#
569569
# Examples
570570
#
571571

572-
main: examples/main/main.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) console.o grammar-parser.o $(OBJS)
572+
main: examples/main/main.cpp ggml.o llama.o $(COMMON_DEPS) console.o grammar-parser.o $(OBJS)
573573
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
574574
@echo
575575
@echo '==== Run ./main -h for help. ===='
576576
@echo
577577

578-
infill: examples/infill/infill.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) console.o grammar-parser.o $(OBJS)
578+
infill: examples/infill/infill.cpp ggml.o llama.o $(COMMON_DEPS) console.o grammar-parser.o $(OBJS)
579579
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
580580

581-
simple: examples/simple/simple.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
581+
simple: examples/simple/simple.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
582582
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
583583

584-
batched: examples/batched/batched.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
584+
batched: examples/batched/batched.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
585585
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
586586

587-
batched-bench: examples/batched-bench/batched-bench.cpp build-info.h ggml.o llama.o common.o $(OBJS)
587+
batched-bench: examples/batched-bench/batched-bench.cpp build-info.o ggml.o llama.o common.o $(OBJS)
588588
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
589589

590-
quantize: examples/quantize/quantize.cpp build-info.h ggml.o llama.o $(OBJS)
590+
quantize: examples/quantize/quantize.cpp build-info.o ggml.o llama.o $(OBJS)
591591
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
592592

593-
quantize-stats: examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o llama.o $(OBJS)
593+
quantize-stats: examples/quantize-stats/quantize-stats.cpp build-info.o ggml.o llama.o $(OBJS)
594594
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
595595

596-
perplexity: examples/perplexity/perplexity.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
596+
perplexity: examples/perplexity/perplexity.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
597597
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
598598

599-
embedding: examples/embedding/embedding.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
599+
embedding: examples/embedding/embedding.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
600600
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
601601

602-
save-load-state: examples/save-load-state/save-load-state.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
602+
save-load-state: examples/save-load-state/save-load-state.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
603603
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
604604

605-
server: examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp examples/server/index.html.hpp examples/server/index.js.hpp examples/server/completion.js.hpp examples/llava/clip.cpp examples/llava/clip.h common/stb_image.h build-info.h ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
605+
server: examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp examples/server/index.html.hpp examples/server/index.js.hpp examples/server/completion.js.hpp examples/llava/clip.cpp examples/llava/clip.h common/stb_image.h ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
606606
$(CXX) $(CXXFLAGS) -Iexamples/server $(filter-out %.h,$(filter-out %.hpp,$^)) -o $@ $(LDFLAGS) $(LWINSOCK2) -Wno-cast-qual
607607

608608
gguf: examples/gguf/gguf.cpp ggml.o llama.o $(OBJS)
@@ -614,7 +614,7 @@ train-text-from-scratch: examples/train-text-from-scratch/train-text-from-scratc
614614
convert-llama2c-to-ggml: examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp ggml.o llama.o $(OBJS)
615615
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
616616

617-
llama-bench: examples/llama-bench/llama-bench.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
617+
llama-bench: examples/llama-bench/llama-bench.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
618618
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
619619

620620
llava: examples/llava/llava.cpp examples/llava/llava-utils.h examples/llava/clip.cpp examples/llava/clip.h common/stb_image.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
@@ -623,19 +623,19 @@ llava: examples/llava/llava.cpp examples/llava/llava-utils.h examples/llava/clip
623623
baby-llama: examples/baby-llama/baby-llama.cpp ggml.o llama.o $(COMMON_DEPS) train.o $(OBJS)
624624
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
625625

626-
beam-search: examples/beam-search/beam-search.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
626+
beam-search: examples/beam-search/beam-search.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
627627
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
628628

629-
finetune: examples/finetune/finetune.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) train.o $(OBJS)
629+
finetune: examples/finetune/finetune.cpp ggml.o llama.o $(COMMON_DEPS) train.o $(OBJS)
630630
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
631631

632-
export-lora: examples/export-lora/export-lora.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
632+
export-lora: examples/export-lora/export-lora.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
633633
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
634634

635-
speculative: examples/speculative/speculative.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
635+
speculative: examples/speculative/speculative.cpp ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
636636
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
637637

638-
parallel: examples/parallel/parallel.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
638+
parallel: examples/parallel/parallel.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
639639
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
640640

641641
ifdef LLAMA_METAL
@@ -648,21 +648,24 @@ swift: examples/batched.swift
648648
(cd examples/batched.swift; make build)
649649
endif
650650

651-
build-info.h: $(wildcard .git/index) scripts/build-info.sh
651+
common/build-info.cpp: $(wildcard .git/index) scripts/build-info.sh
652652
@sh scripts/build-info.sh $(CC) > $@.tmp
653653
@if ! cmp -s $@.tmp $@; then \
654654
mv $@.tmp $@; \
655655
else \
656656
rm $@.tmp; \
657657
fi
658658

659+
build-info.o: common/build-info.cpp
660+
$(CXX) $(CXXFLAGS) -c $(filter-out %.h,$^) -o $@
661+
659662
#
660663
# Tests
661664
#
662665

663666
tests: $(TEST_TARGETS)
664667

665-
benchmark-matmult: examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o $(OBJS)
668+
benchmark-matmult: examples/benchmark/benchmark-matmult.cpp build-info.o ggml.o $(OBJS)
666669
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
667670

668671
run-benchmark-matmult: benchmark-matmult
@@ -676,40 +679,40 @@ vdot: pocs/vdot/vdot.cpp ggml.o $(OBJS)
676679
q8dot: pocs/vdot/q8dot.cpp ggml.o $(OBJS)
677680
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
678681

679-
tests/test-llama-grammar: tests/test-llama-grammar.cpp build-info.h ggml.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
682+
tests/test-llama-grammar: tests/test-llama-grammar.cpp ggml.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
680683
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
681684

682-
tests/test-grammar-parser: tests/test-grammar-parser.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
685+
tests/test-grammar-parser: tests/test-grammar-parser.cpp ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
683686
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
684687

685-
tests/test-double-float: tests/test-double-float.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
688+
tests/test-double-float: tests/test-double-float.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
686689
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
687690

688-
tests/test-grad0: tests/test-grad0.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
691+
tests/test-grad0: tests/test-grad0.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
689692
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
690693

691-
tests/test-opt: tests/test-opt.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
694+
tests/test-opt: tests/test-opt.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
692695
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
693696

694-
tests/test-quantize-fns: tests/test-quantize-fns.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
697+
tests/test-quantize-fns: tests/test-quantize-fns.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
695698
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
696699

697-
tests/test-quantize-perf: tests/test-quantize-perf.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
700+
tests/test-quantize-perf: tests/test-quantize-perf.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
698701
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
699702

700-
tests/test-sampling: tests/test-sampling.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
703+
tests/test-sampling: tests/test-sampling.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
701704
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
702705

703-
tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
706+
tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
704707
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
705708

706-
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
709+
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
707710
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
708711

709-
tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
712+
tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
710713
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
711714

712-
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp build-info.h ggml.o llama.o $(COMMON_DEPS) $(OBJS)
715+
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
713716
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
714717

715718
tests/test-c.o: tests/test-c.c llama.h

Diff for: build.zig

+17-21
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const Maker = struct {
1010
builder: *std.build.Builder,
1111
target: CrossTarget,
1212
optimize: Mode,
13-
config_header: *ConfigHeader,
1413
enable_lto: bool,
1514

1615
include_dirs: ArrayList([]const u8),
@@ -41,26 +40,24 @@ const Maker = struct {
4140
const commit_hash = try std.ChildProcess.exec(
4241
.{ .allocator = builder.allocator, .argv = &.{ "git", "rev-parse", "HEAD" } },
4342
);
44-
const config_header = builder.addConfigHeader(
45-
.{ .style = .blank, .include_path = "build-info.h" },
46-
.{
47-
.BUILD_NUMBER = 0,
48-
.BUILD_COMMIT = commit_hash.stdout[0 .. commit_hash.stdout.len - 1], // omit newline
49-
.BUILD_COMPILER = builder.fmt("Zig {s}", .{zig_version}),
50-
.BUILD_TARGET = try target.allocDescription(builder.allocator),
51-
},
52-
);
43+
try std.fs.cwd().writeFile("common/build-info.cpp", builder.fmt(
44+
\\int LLAMA_BUILD_NUMBER = {};
45+
\\char const *LLAMA_COMMIT = "{s}";
46+
\\char const *LLAMA_COMPILER = "Zig {s}";
47+
\\char const *LLAMA_BUILD_TARGET = "{s}";
48+
\\
49+
, .{ 0, commit_hash.stdout[0 .. commit_hash.stdout.len - 1], zig_version, try target.allocDescription(builder.allocator) }));
5350
var m = Maker{
5451
.builder = builder,
5552
.target = target,
5653
.optimize = builder.standardOptimizeOption(.{}),
57-
.config_header = config_header,
5854
.enable_lto = false,
5955
.include_dirs = ArrayList([]const u8).init(builder.allocator),
6056
.cflags = ArrayList([]const u8).init(builder.allocator),
6157
.cxxflags = ArrayList([]const u8).init(builder.allocator),
6258
.objs = ArrayList(*Compile).init(builder.allocator),
6359
};
60+
6461
try m.addCFlag("-std=c11");
6562
try m.addCxxFlag("-std=c++11");
6663
try m.addProjectInclude(&.{});
@@ -72,7 +69,7 @@ const Maker = struct {
7269
const o = m.builder.addObject(.{ .name = name, .target = m.target, .optimize = m.optimize });
7370
if (o.target.getAbi() != .msvc)
7471
o.defineCMacro("_GNU_SOURCE", null);
75-
o.addConfigHeader(m.config_header);
72+
7673
if (std.mem.endsWith(u8, src, ".c")) {
7774
o.addCSourceFiles(&.{src}, m.cflags.items);
7875
o.linkLibC();
@@ -85,7 +82,6 @@ const Maker = struct {
8582
o.linkLibCpp();
8683
}
8784
}
88-
o.addConfigHeader(m.config_header);
8985
for (m.include_dirs.items) |i| o.addIncludePath(.{ .path = i });
9086
o.want_lto = m.enable_lto;
9187
return o;
@@ -105,7 +101,6 @@ const Maker = struct {
105101
// linkLibCpp already add (libc++ + libunwind + libc)
106102
e.linkLibCpp();
107103
}
108-
e.addConfigHeader(m.config_header);
109104
m.builder.installArtifact(e);
110105
e.want_lto = m.enable_lto;
111106
return e;
@@ -121,21 +116,22 @@ pub fn build(b: *std.build.Builder) !void {
121116
const ggml_backend = make.obj("ggml-backend", "ggml-backend.c");
122117
const ggml_quants = make.obj("ggml-quants", "ggml-quants.c");
123118
const llama = make.obj("llama", "llama.cpp");
119+
const buildinfo = make.obj("common", "common/build-info.cpp");
124120
const common = make.obj("common", "common/common.cpp");
125121
const console = make.obj("console", "common/console.cpp");
126122
const sampling = make.obj("sampling", "common/sampling.cpp");
127123
const grammar_parser = make.obj("grammar-parser", "common/grammar-parser.cpp");
128124
const train = make.obj("train", "common/train.cpp");
129125
const clip = make.obj("clip", "examples/llava/clip.cpp");
130126

131-
_ = make.exe("main", "examples/main/main.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, sampling, console, grammar_parser });
132-
_ = make.exe("quantize", "examples/quantize/quantize.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common });
133-
_ = make.exe("perplexity", "examples/perplexity/perplexity.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common });
134-
_ = make.exe("embedding", "examples/embedding/embedding.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common });
135-
_ = make.exe("finetune", "examples/finetune/finetune.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, train });
136-
_ = make.exe("train-text-from-scratch", "examples/train-text-from-scratch/train-text-from-scratch.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, train });
127+
_ = make.exe("main", "examples/main/main.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, buildinfo, sampling, console, grammar_parser });
128+
_ = make.exe("quantize", "examples/quantize/quantize.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, buildinfo });
129+
_ = make.exe("perplexity", "examples/perplexity/perplexity.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, buildinfo });
130+
_ = make.exe("embedding", "examples/embedding/embedding.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, buildinfo });
131+
_ = make.exe("finetune", "examples/finetune/finetune.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, buildinfo, train });
132+
_ = make.exe("train-text-from-scratch", "examples/train-text-from-scratch/train-text-from-scratch.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, buildinfo, train });
137133

138-
const server = make.exe("server", "examples/server/server.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, sampling, grammar_parser, clip });
134+
const server = make.exe("server", "examples/server/server.cpp", &.{ ggml, ggml_alloc, ggml_backend, ggml_quants, llama, common, buildinfo, sampling, grammar_parser, clip });
139135
if (server.target.isWindows()) {
140136
server.linkSystemLibrary("ws2_32");
141137
}

0 commit comments

Comments
 (0)