-
Notifications
You must be signed in to change notification settings - Fork 312
Expand file tree
/
Copy pathPackage.swift
More file actions
91 lines (82 loc) · 2.12 KB
/
Package.swift
File metadata and controls
91 lines (82 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// swift-tools-version:6.0
import PackageDescription
let cxxSettings: [CXXSetting] = [
.headerSearchPath("../include/"),
.define("USEARCH_USE_NUMKONG", to: "1"),
.define("NK_DYNAMIC_DISPATCH", to: "1"),
.define("NK_NATIVE_F16", to: "0"),
.define("NK_NATIVE_BF16", to: "0"),
]
var targets: [Target] = []
// Conditionally build the Objective-C target only on non-Linux platforms.
#if !os(Linux)
targets.append(
.target(
name: "USearchObjectiveC",
dependencies: [
.product(name: "CNumKongDispatch", package: "NumKong"),
],
path: "objc",
sources: ["USearchObjective.mm"],
cxxSettings: cxxSettings
)
)
#endif
// Always build the C and Swift targets.
targets += [
.target(
name: "USearchC",
dependencies: [
.product(name: "CNumKongDispatch", package: "NumKong"),
],
path: "c",
sources: ["usearch.h", "lib.cpp"],
publicHeadersPath: ".",
cxxSettings: cxxSettings
),
.target(
name: "USearch",
dependencies: ["USearchC"],
path: "swift",
exclude: ["README.md", "Test.swift"],
sources: ["USearchIndex.swift", "USearchIndex+Sugar.swift", "Util.swift"],
cxxSettings: cxxSettings
),
.testTarget(
name: "USearchTestsSwift",
dependencies: ["USearch"],
path: "swift",
sources: ["Test.swift"]
),
]
// Configure products similarly.
var products: [Product] = []
#if !os(Linux)
products.append(
.library(
name: "USearchObjectiveC",
targets: ["USearchObjectiveC"]
)
)
#endif
products.append(
.library(
name: "USearch",
targets: ["USearch"]
)
)
let package = Package(
name: "USearch",
platforms: [
.macOS(.v12),
.iOS(.v15),
.watchOS(.v8),
.tvOS(.v15),
],
products: products,
dependencies: [
.package(url: "https://github.com/ashvardanian/NumKong", from: "7.5.0"),
],
targets: targets,
cxxLanguageStandard: CXXLanguageStandard.cxx11
)