-
Notifications
You must be signed in to change notification settings - Fork 18
/
Package.swift
134 lines (124 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
133
134
// swift-tools-version:5.9
import PackageDescription
let sdkVersion = Version("2.2.0")
let coreVersion = Version("14.11.0")
var cxxSettings: [CXXSetting] = [
.define("REALM_ENABLE_SYNC", to: "1"),
.define("REALM_DEBUG", .when(configuration: .debug)),
.define("REALM_NO_CONFIG"),
.define("REALM_INSTALL_LIBEXECDIR", to: ""),
.define("REALM_ENABLE_ASSERTIONS", to: "1"),
.define("REALM_ENABLE_ENCRYPTION", to: "1"),
.define("REALMCXX_VERSION_MAJOR", to: String(sdkVersion.major)),
.define("REALMCXX_VERSION_MINOR", to: String(sdkVersion.minor)),
.define("REALMCXX_VERSION_PATCH", to: String(sdkVersion.patch)),
.define("REALMCXX_VERSION_STRING", to: "\"\(sdkVersion)\""),
// Realm Core
.define("REALM_VERSION_MAJOR", to: String(coreVersion.major)),
.define("REALM_VERSION_MINOR", to: String(coreVersion.minor)),
.define("REALM_VERSION_PATCH", to: String(coreVersion.patch)),
.define("REALM_VERSION_EXTRA", to: "\"\(coreVersion.prereleaseIdentifiers.first ?? "")\""),
.define("REALM_VERSION_STRING", to: "\"\(coreVersion)\""),
.headerSearchPath("."),
.headerSearchPath("include"),
.headerSearchPath("include/cpprealm")
]
let applePlatforms: [Platform] = [.macOS, .macCatalyst, .iOS, .tvOS]
let cppSdkTarget: Target = .target(
name: "realm-cpp-sdk",
dependencies: [
.product(name: "RealmCore", package: "realm-core"),
.product(name: "RealmQueryParser", package: "realm-core"),
],
path: ".",
exclude: [
"src/cpprealm/util/config.in.h",
"realm-core"
],
sources: ["src"],
publicHeadersPath: "include",
cxxSettings: cxxSettings,
linkerSettings: [
.linkedFramework("Foundation", .when(platforms: applePlatforms)),
.linkedFramework("Security", .when(platforms: applePlatforms)),
])
let package = Package(
name: "realm-cpp-sdk",
platforms: [
.macOS(.v10_15),
.macCatalyst(.v13),
.iOS(.v13),
.tvOS(.v13),
],
products: [
.library(
name: "realm-cpp-sdk",
targets: ["realm-cpp-sdk"]),
],
dependencies: [
.package(url: "https://github.com/realm/realm-core.git", exact: coreVersion)
],
targets: [
cppSdkTarget,
.target(
name: "Catch2Generated",
path: "tests/external/generated",
// this file was manually generated with catch v3.0.1
// and should be regenerated when catch is upgraded
resources: [.copy("catch2/catch_user_config.hpp")],
publicHeadersPath: "."),
.target(
name: "Catch2",
dependencies: ["Catch2Generated"],
path: "Catch2/src",
exclude: [
"CMakeLists.txt",
"catch2/catch_user_config.hpp.in",
"catch2/internal/catch_main.cpp"
],
publicHeadersPath: ".",
cxxSettings: ([
.headerSearchPath("catch2"),
.define("CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS"),
.define("CATCH_CONFIG_NO_POSIX_SIGNALS", .when(platforms: [.tvOS])),
] + cxxSettings) as [CXXSetting]),
.executableTarget(
name: "realm-tests",
dependencies: ["realm-cpp-sdk", "Catch2"],
path: "tests",
exclude: [
"sync",
],
sources: [
"main.hpp",
"main.cpp",
"db/binary_tests.cpp",
"db/date_tests.cpp",
"db/decimal_tests.cpp",
"db/embedded_object_tests.cpp",
"db/frozen_tests.cpp",
"db/list_tests.cpp",
"db/map_tests.cpp",
"db/mixed_tests.cpp",
"db/numeric_tests.cpp",
"db/object_id_tests.cpp",
"db/object_tests.cpp",
"db/optional_tests.cpp",
"db/performance_tests.cpp",
"db/query_tests.cpp",
"db/realm_tests.cpp",
"db/results_tests.cpp",
"db/run_loop_tests.cpp",
"db/set_tests.cpp",
"db/string_tests.cpp",
"db/bson_tests.cpp"
],
resources: [
.copy("setup_baas.rb"),
.copy("dependencies.list"),
.copy("config_overrides.json")],
cxxSettings: cxxSettings
)
],
cxxLanguageStandard: .cxx17
)