-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackage.swift
More file actions
106 lines (93 loc) · 3.65 KB
/
Copy pathPackage.swift
File metadata and controls
106 lines (93 loc) · 3.65 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
var platformName: String {
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
return "apple"
#elseif os(Linux)
return "linux"
#else
return "windows"
#endif
}
let mgClientVersion = "\"1.4.1\""
let package = Package(
name: "SwiftMemgraphClient",
platforms: [
.macOS(.v10_15),
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(name: "Cmgclient", targets: ["Cmgclient"]),
.library(name: "SwiftMemgraphClient", targets: ["SwiftMemgraphClient"]),
],
dependencies: [
// Add the OpenSSL package dependency
.package(url: "https://github.com/krzyzanowskim/OpenSSL-Package.git", from: "3.3.1000")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "Cmgclient",
dependencies: [
// Link the OpenSSL package to your target
.product(name: "OpenSSL", package: "OpenSSL-Package")
],
path: "Sources/Cmgclient",
exclude: [
"mgclient/build",
"mgclient/cmake",
"mgclient/examples",
"mgclient/mgclient_cpp",
"mgclient/tests",
"mgclient/tools",
"mgclient/wasm"
],
sources: [
"mgclient/src/\(platformName)/mgsocket.c",
"mgclient/src/mgallocator.c",
"mgclient/src/mgclient.c",
"mgclient/src/mgmessage.c",
"mgclient/src/mgsession-decoder.c",
"mgclient/src/mgsession-encoder.c",
"mgclient/src/mgsession.c",
"mgclient/src/mgtransport.c",
"mgclient/src/mgvalue.h",
"mgclient/src/mgvalue.c"
],
publicHeadersPath: "include",
cSettings: [
.define("MGCLIENT_VERSION", to: mgClientVersion),
.headerSearchPath("include"),
.headerSearchPath("mgclient/include"),
.headerSearchPath("mgclient/src"),
.headerSearchPath("mgclient/src/apple", .when(platforms: [.macOS, .iOS])),
.define("MGCLIENT_ON_APPLE", to: "1", .when(platforms: [.macOS, .iOS])),
.headerSearchPath("mgclient/src/linux", .when(platforms: [.linux])),
.define("MGCLIENT_ON_LINUX", to: "1", .when(platforms: [.linux])),
.headerSearchPath("mgclient/src/windows", .when(platforms: [.windows])),
.define("MGCLIENT_ON_WINDOWS", to: "1", .when(platforms: [.windows]))
]
),
.target(
name: "SwiftMemgraphClient",
dependencies: [
"Cmgclient",
.product(name: "OpenSSL", package: "OpenSSL-Package")
]
),
.testTarget(
name: "SwiftMemgraphClientTests",
dependencies: ["SwiftMemgraphClient", "Cmgclient"]),
]
)
// Use the platformName variable in your code
print("Running on platform: \(platformName)")
// Example usage of the preprocessor definitions
#if MGCLIENT_ON_APPLE
print("MGCLIENT_ON_APPLE is defined")
#endif
#if MGCLIENT_ON_LINUX
print("MGCLIENT_ON_LINUX is defined")
#endif