Skip to content

Commit c7ed2ab

Browse files
authored
build: repair the build on Windows (#20)
Replicate the behaviour from upstream ICU: ``` #if defined(U_TIMEZONE) || defined(U_HAVE_TIMEZONE) /* Use the predefined value. */ #elif U_PLATFORM == U_PF_ANDROID # define U_TIMEZONE timezone #elif defined(__UCLIBC__) // uClibc does not have __timezone or _timezone. #elif defined(_NEWLIB_VERSION) # define U_TIMEZONE _timezone #elif defined(__GLIBC__) // glibc # define U_TIMEZONE __timezone #elif U_PLATFORM_IS_LINUX_BASED // not defined #elif U_PLATFORM_USES_ONLY_WIN32_API # define U_TIMEZONE _timezone #elif U_PLATFORM == U_PF_BSD && !defined(__NetBSD__) /* not defined */ #elif U_PLATFORM == U_PF_OS400 /* not defined */ #elif U_PLATFORM == U_PF_IPHONE /* not defined */ #else # define U_TIMEZONE timezone #endif ``` With this change, ICU at least builds, but it is unclear if it functions properly on Windows.
1 parent 40b9706 commit c7ed2ab

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Package.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ var buildSettings: [CXXSetting] = [
99
.define("U_SHOW_CPLUSPLUS_API", to: "1"),
1010
.define("U_SHOW_INTERNAL_API", to: "1"),
1111
.define("U_STATIC_IMPLEMENTATION"),
12-
.define("U_TIMEZONE", to: "timezone"),
12+
.define("U_TIMEZONE", to: "_timezone", .when(platforms: [.windows])),
13+
.define("U_TIMEZONE", to: "timezone",
14+
.when(platforms: [
15+
.iOS,
16+
.macOS,
17+
.tvOS,
18+
.watchOS,
19+
.macCatalyst,
20+
.driverKit,
21+
.android,
22+
.linux,
23+
.wasi
24+
])),
1325
.define("U_TIMEZONE_PACKAGE", to: "\"icutz44l\""),
1426
.define("FORTIFY_SOURCE", to: "2"),
1527
.define("STD_INSPIRED"),

0 commit comments

Comments
 (0)