Skip to content

Commit 927bc26

Browse files
committed
Add a Package.swift for SwiftPM support
1 parent a18c192 commit 927bc26

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.vscode/
66
.DS_Store
77

8+
.build/
89
build/
910
build-em/
1011
build-debug/
@@ -25,3 +26,7 @@ compile_commands.json
2526

2627
.envrc
2728
.direnv/
29+
30+
.venv
31+
__pycache__
32+
.swiftpm

Package.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// swift-tools-version:5.3
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "llama",
7+
products: [
8+
.library(name: "llama", targets: ["llama"]),
9+
],
10+
targets: [
11+
.target(
12+
name: "llama",
13+
path: ".",
14+
exclude: ["main.cpp", "tests", "quantize.cpp"],
15+
publicHeadersPath: "spm-headers",
16+
cSettings: [.unsafeFlags(["-Wno-shorten-64-to-32"])]
17+
),
18+
],
19+
cxxLanguageStandard: .cxx11
20+
)

llama.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ extern "C" {
117117

118118
// TODO: improve the last_n_tokens interface ?
119119
LLAMA_API llama_token llama_sample_top_p_top_k(
120-
llama_context * ctx,
120+
struct llama_context * ctx,
121121
const llama_token * last_n_tokens_data,
122122
int last_n_tokens_size,
123123
int top_k,

spm-headers/llama.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../llama.h

0 commit comments

Comments
 (0)