forked from realm/realm-swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
132 lines (125 loc) · 4.45 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// swift-tools-version:5.0
import PackageDescription
import Foundation
let coreVersionStr = "5.23.5"
let cocoaVersionStr = "3.21.0"
let coreVersionPieces = coreVersionStr.split(separator: ".")
let cxxSettings: [CXXSetting] = [
.headerSearchPath("."),
.headerSearchPath("include"),
.headerSearchPath("Realm/ObjectStore/src"),
.define("REALM_SPM", to: "1"),
.define("REALM_COCOA_VERSION", to: "@\"\(cocoaVersionStr)\""),
.define("REALM_VERSION", to: "\"\(coreVersionStr)\""),
.define("REALM_NO_CONFIG"),
.define("REALM_INSTALL_LIBEXECDIR", to: ""),
.define("REALM_ENABLE_ASSERTIONS", to: "1"),
.define("REALM_ENABLE_ENCRYPTION", to: "1"),
.define("REALM_VERSION_MAJOR", to: String(coreVersionPieces[0])),
.define("REALM_VERSION_MINOR", to: String(coreVersionPieces[1])),
.define("REALM_VERSION_PATCH", to: String(coreVersionPieces[2])),
.define("REALM_VERSION_EXTRA", to: "\"\""),
.define("REALM_VERSION_STRING", to: "\"\(coreVersionStr)\""),
]
let package = Package(
name: "Realm",
products: [
.library(
name: "Realm",
targets: ["Realm"]),
.library(
name: "RealmSwift",
targets: ["Realm", "RealmSwift"]),
],
dependencies: [
.package(url: "https://github.com/realm/realm-core", .exact(Version(coreVersionStr)!)),
],
targets: [
.target(
name: "Realm",
dependencies: ["RealmCore"],
path: ".",
exclude: [
"Realm/NSError+RLMSync.m",
"Realm/RLMJSONModels.m",
"Realm/RLMNetworkClient.mm",
"Realm/RLMRealm+Sync.mm",
"Realm/RLMRealmConfiguration+Sync.mm",
"Realm/RLMSyncConfiguration.mm",
"Realm/RLMSyncCredentials.m",
"Realm/RLMSyncManager.mm",
"Realm/RLMSyncPermission.mm",
"Realm/RLMSyncPermissionResults.mm",
"Realm/RLMSyncSession.mm",
"Realm/RLMSyncSessionRefreshHandle.mm",
"Realm/RLMSyncSubscription.mm",
"Realm/RLMSyncUser.mm",
"Realm/RLMSyncUtil.mm",
"Realm/ObjectServerTests",
"Realm/Swift",
"Realm/Tests",
"Realm/TestUtils",
"Realm/ObjectStore/external",
"Realm/ObjectStore/tests",
"Realm/ObjectStore/src/server",
"Realm/ObjectStore/src/sync",
"Realm/ObjectStore/src/impl/generic",
"Realm/ObjectStore/src/impl/epoll",
"Realm/ObjectStore/src/impl/android",
"Realm/ObjectStore/src/impl/windows",
],
sources: ["Realm"],
publicHeadersPath: "include",
cxxSettings: cxxSettings
),
.target(
name: "RealmSwift",
dependencies: ["Realm"],
path: "RealmSwift",
exclude: [
"Sync.swift",
"ObjectiveCSupport+Sync.swift",
"Tests",
]
),
.target(
name: "RealmTestSupport",
dependencies: ["Realm"],
path: "Realm/TestUtils",
cxxSettings: cxxSettings + [
// Command-line `swift build` resolves header search paths
// relative to the package root, while Xcode resolves them
// relative to the target root, so we need both.
.headerSearchPath("Realm"),
.headerSearchPath(".."),
]
),
.testTarget(
name: "RealmTests",
dependencies: ["Realm", "RealmTestSupport"],
path: "Realm/Tests",
exclude: [
"Swift",
"TestHost",
"PrimitiveArrayPropertyTests.tpl.m",
],
cxxSettings: cxxSettings + [
.headerSearchPath("Realm"),
.headerSearchPath(".."),
.headerSearchPath("../ObjectStore/src"),
]
),
.testTarget(
name: "RealmObjcSwiftTests",
dependencies: ["Realm", "RealmTestSupport"],
path: "Realm/Tests/Swift"
),
.testTarget(
name: "RealmSwiftTests",
dependencies: ["RealmSwift", "RealmTestSupport"],
path: "RealmSwift/Tests",
exclude: ["TestUtils.mm"]
)
],
cxxLanguageStandard: .cxx14
)