-
Notifications
You must be signed in to change notification settings - Fork 80
/
Package.swift
47 lines (46 loc) · 1.68 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
// swift-tools-version:5.9
import PackageDescription
let package = Package(
name: "StringZilla",
platforms: [
// Linux doesn't have to be explicitly listed
.iOS(.v13), // For iOS, version 13 and later
.tvOS(.v13), // For tvOS, version 13 and later
.macOS(.v10_15), // For macOS, version 10.15 (Catalina) and later
.watchOS(.v6) // For watchOS, version 6 and later
],
products: [
.library(
name: "StringZilla",
targets: ["StringZillaC", "StringZilla"]
)
],
targets: [
.target(
name: "StringZillaC",
path: "include/stringzilla", // Adjust the path to include your C source files
sources: ["../../c/lib.c"], // Include the source file here
publicHeadersPath: ".",
cSettings: [
.define("SZ_DYNAMIC_DISPATCH", to: "1"), // Define a macro
.define("SZ_AVOID_LIBC", to: "0"), // We need `malloc` from LibC
.define("SZ_DEBUG", to: "0"), // We don't need any extra assertions in the C layer
.headerSearchPath("include/stringzilla"), // Specify header search paths
.unsafeFlags(["-Wall"]) // Use with caution: specify custom compiler flags
]
),
.target(
name: "StringZilla",
dependencies: ["StringZillaC"],
path: "swift",
exclude: ["Test.swift"]
),
.testTarget(
name: "StringZillaTests",
dependencies: ["StringZilla"],
path: "swift",
sources: ["Test.swift"]
)
],
cLanguageStandard: CLanguageStandard.c99
)