update
This commit is contained in:
parent
180b693a47
commit
80d468e681
1 changed files with 8 additions and 15 deletions
23
build.zig
23
build.zig
|
@ -1,16 +1,14 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.Build) void {
|
pub fn build(b: *std.build.Builder) void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardReleaseOptions();
|
||||||
const want_lto = b.option(bool, "lto", "Want -fLTO");
|
const want_lto = b.option(bool, "lto", "Want -fLTO");
|
||||||
|
|
||||||
const lib = b.addStaticLibrary(.{
|
const lib = b.addStaticLibrary("llama", "llama.cpp");
|
||||||
.name = "llama",
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
});
|
|
||||||
lib.want_lto = want_lto;
|
lib.want_lto = want_lto;
|
||||||
|
lib.setTarget(target);
|
||||||
|
lib.setBuildMode(optimize);
|
||||||
lib.linkLibCpp();
|
lib.linkLibCpp();
|
||||||
lib.addIncludePath(".");
|
lib.addIncludePath(".");
|
||||||
lib.addIncludePath("examples");
|
lib.addIncludePath("examples");
|
||||||
|
@ -44,20 +42,15 @@ pub fn build(b: *std.Build) void {
|
||||||
fn build_example(comptime name: []const u8, args: anytype) *std.build.LibExeObjStep {
|
fn build_example(comptime name: []const u8, args: anytype) *std.build.LibExeObjStep {
|
||||||
const b = args.b;
|
const b = args.b;
|
||||||
const lib = args.lib;
|
const lib = args.lib;
|
||||||
const target = args.target;
|
|
||||||
const optimize = args.optimize;
|
|
||||||
const want_lto = args.want_lto;
|
const want_lto = args.want_lto;
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(name, std.fmt.comptimePrint("examples/{s}/{s}.cpp", .{name, name}));
|
||||||
.name = name,
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
});
|
|
||||||
exe.want_lto = want_lto;
|
exe.want_lto = want_lto;
|
||||||
|
lib.setTarget(args.target);
|
||||||
|
lib.setBuildMode(args.optimize);
|
||||||
exe.addIncludePath(".");
|
exe.addIncludePath(".");
|
||||||
exe.addIncludePath("examples");
|
exe.addIncludePath("examples");
|
||||||
exe.addCSourceFiles(&.{
|
exe.addCSourceFiles(&.{
|
||||||
std.fmt.comptimePrint("examples/{s}/{s}.cpp", .{name, name}),
|
|
||||||
"examples/common.cpp",
|
"examples/common.cpp",
|
||||||
}, &.{"-std=c++11"});
|
}, &.{"-std=c++11"});
|
||||||
exe.linkLibrary(lib);
|
exe.linkLibrary(lib);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue