Skip to content

Commit

Permalink
Add ICU linker flags to all build invocation (#270)
Browse files Browse the repository at this point in the history
Resolves #268.
  • Loading branch information
MaxDesiatov authored Dec 1, 2021
1 parent 04de1c2 commit 367f0bc
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Sources/SwiftToolchain/Toolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ public final class Toolchain {
builderArguments.append("--enable-test-discovery")
}

// SwiftWasm 5.5 requires explicit linking arguments in certain configurations,
// see https://github.com/swiftwasm/swift/issues/3891
if version.starts(with: "wasm-5.5") {
builderArguments.append(contentsOf: ["-Xlinker", "-licuuc", "-Xlinker", "-licui18n"])
}

try Builder(
arguments: builderArguments,
mainWasmPath: mainWasmPath,
Expand Down Expand Up @@ -302,9 +308,7 @@ public final class Toolchain {
var builderArguments = [
swiftPath.pathString, "build", "-c", flavor.isRelease ? "release" : "debug",
"--product", testProductName, "--triple", "wasm32-unknown-wasi",
"-Xswiftc", "-color-diagnostics",
// workaround for 5.5 linking issues, see https://github.com/swiftwasm/swift/issues/3891
"-Xlinker", "-licuuc", "-Xlinker", "-licui18n"
"-Xswiftc", "-color-diagnostics"
]

// Versions later than 5.3.x have test discovery enabled by default and the explicit flag
Expand All @@ -313,6 +317,12 @@ public final class Toolchain {
builderArguments.append("--enable-test-discovery")
}

// SwiftWasm 5.5 requires explicit linking arguments in certain configurations,
// see https://github.com/swiftwasm/swift/issues/3891
if version.starts(with: "wasm-5.5") {
builderArguments.append(contentsOf: ["-Xlinker", "-licuuc", "-Xlinker", "-licui18n"])
}

try Builder(
arguments: builderArguments,
mainWasmPath: testBundlePath,
Expand Down

0 comments on commit 367f0bc

Please sign in to comment.