forked from swiftlang/swift-foundation-icu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
121 lines (112 loc) · 3.6 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
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
var buildSettings: [CXXSetting] = [
.define("DEBUG", to: "1", .when(configuration: .debug)),
.define("U_ATTRIBUTE_DEPRECATED", to: ""),
.define("U_SHOW_CPLUSPLUS_API", to: "1"),
.define("U_SHOW_INTERNAL_API", to: "1"),
.define("U_STATIC_IMPLEMENTATION"),
.define("U_TIMEZONE", to: "_timezone", .when(platforms: [.windows])),
.define("U_TIMEZONE", to: "timezone",
.when(platforms: [
.iOS,
.macOS,
.tvOS,
.watchOS,
.macCatalyst,
.driverKit,
.android,
.linux,
.wasi
])),
.define("U_TIMEZONE_PACKAGE", to: "\"icutz44l\""),
.define("FORTIFY_SOURCE", to: "2"),
.define("STD_INSPIRED"),
.define("MAC_OS_X_VERSION_MIN_REQUIRED", to: "101500"),
.define("U_HAVE_STRTOD_L", to: "1"),
.define("U_HAVE_XLOCALE_H", to: "1"),
.define("U_HAVE_STRING_VIEW", to: "1"),
.define("U_DISABLE_RENAMING", to: "1"),
.define("U_COMMON_IMPLEMENTATION"),
// Where data are stored
.define("ICU_DATA_DIR", to: "\"/usr/share/icu/\""),
.define("USE_PACKAGE_DATA", to: "1"),
.define("APPLE_ICU_CHANGES", to: "1")
]
#if os(Windows)
buildSettings.append(contentsOf: [
.define("_CRT_SECURE_NO_DEPRECATE"),
.define("U_PLATFORM_USES_ONLY_WIN32_API"),
])
#endif
let commonBuildSettings: [CXXSetting] = buildSettings.appending([
.headerSearchPath("."),
])
let i18nBuildSettings: [CXXSetting] = buildSettings.appending([
.define("U_I18N_IMPLEMENTATION"),
.define("SWIFT_PACKAGE", to: "1", .when(platforms: [.linux])),
.headerSearchPath("../common"),
.headerSearchPath("."),
])
let ioBuildSettings: [CXXSetting] = buildSettings.appending([
.define("U_IO_IMPLEMENTATION"),
.headerSearchPath("../common"),
.headerSearchPath("../i18n"),
.headerSearchPath("."),
])
let stubDataBuildSettings: [CXXSetting] = buildSettings.appending([
.headerSearchPath("../common"),
.headerSearchPath("../i18n"),
.headerSearchPath("."),
])
let package = Package(
name: "FoundationICU",
products: [
.library(
name: "FoundationICU",
targets: ["FoundationICU"]),
],
targets: [
.target(
name: "FoundationICU",
dependencies: [
"ICUCommon",
"ICUI18N",
"ICUIO",
"ICUStubData"
],
path: "swift/FoundationICU"),
.target(
name: "ICUCommon",
path: "icuSources/common",
publicHeadersPath: "include",
cxxSettings: commonBuildSettings),
.target(
name: "ICUI18N",
dependencies: ["ICUCommon"],
path: "icuSources/i18n",
publicHeadersPath: "include",
cxxSettings: i18nBuildSettings),
.target(
name: "ICUIO",
dependencies: ["ICUCommon", "ICUI18N"],
path: "icuSources/io",
publicHeadersPath: "include",
cxxSettings: ioBuildSettings),
.target(
name: "ICUStubData",
dependencies: ["ICUCommon"],
path: "icuSources/stubdata",
publicHeadersPath: ".",
cxxSettings: stubDataBuildSettings),
],
cxxLanguageStandard: .cxx14
)
fileprivate extension Array {
func appending(_ other: Self) -> Self {
var me = self
me.append(contentsOf: other)
return me
}
}