-
Notifications
You must be signed in to change notification settings - Fork 175
/
Copy pathPackage.swift
77 lines (68 loc) · 1.69 KB
/
Package.swift
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
// swift-tools-version:5.9
import PackageDescription
let cxxSettings: [CXXSetting] = [
.headerSearchPath("../include/"),
.headerSearchPath("../fp16/include/"),
.headerSearchPath("../simsimd/include/"),
.define("USEARCH_USE_FP16LIB", to: "1"),
.define("USEARCH_USE_SIMSIMD", to: "1"),
]
var targets: [Target] = []
// Conditionally build the Objective-C target only on non-Linux platforms.
#if !os(Linux)
targets.append(
.target(
name: "USearchObjectiveC",
path: "objc",
sources: ["USearchObjective.mm", "../simsimd/c/lib.c"],
cxxSettings: cxxSettings
)
)
#endif
// Always build the C and Swift targets.
targets += [
.target(
name: "USearchC",
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",
products: products,
dependencies: [],
targets: targets,
cxxLanguageStandard: CXXLanguageStandard.cxx11
)