Skip to content

Commit 4523603

Browse files
kateinoigakukunAnka
authored andcommitted
[wasm][build] HACK: Add SwiftWasm compiler vendor support
This patch should not be upstreamed. Maybe we can use `--compiler-vendor=none` to avoid hardcoding specific downstream names.
1 parent 69adf52 commit 4523603

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def create_argument_parser():
459459
help='if set, provide a fixed path for the Swift backtracer')
460460

461461
option('--compiler-vendor', store,
462-
choices=['none', 'apple'],
462+
choices=['none', 'apple', 'swiftwasm'],
463463
default=defaults.COMPILER_VENDOR,
464464
help='Compiler vendor name')
465465
option('--clang-compiler-version', store,

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ def _compiler_vendor_flags(self):
6464
if self.args.compiler_vendor == "none":
6565
return []
6666

67+
if self.args.compiler_vendor == "swiftwasm":
68+
return [
69+
('CLANG_VENDOR', 'SwiftWasm'),
70+
('CLANG_VENDOR_UTI', 'org.swiftwasm.compilers.llvm.clang'),
71+
('PACKAGE_VERSION', str(self.args.clang_user_visible_version))
72+
]
73+
6774
if self.args.compiler_vendor != "apple":
6875
raise RuntimeError("Unknown compiler vendor?!")
6976

utils/swift_build_support/swift_build_support/products/swift.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,22 @@ def _compiler_vendor_flags(self):
104104
if self.args.compiler_vendor == "none":
105105
return []
106106

107-
if self.args.compiler_vendor != "apple":
108-
raise RuntimeError("Unknown compiler vendor?! Was build-script \
109-
updated without updating swift.py?")
110-
111107
swift_compiler_version = ""
112108
if self.args.swift_compiler_version is not None:
113109
swift_compiler_version = self.args.swift_compiler_version
114110

111+
if self.args.compiler_vendor == "swiftwasm":
112+
return [
113+
('SWIFT_VENDOR', 'SwiftWasm'),
114+
('SWIFT_VENDOR_UTI', 'org.swiftwasm.compilers.llvm.swift'),
115+
('SWIFT_VERSION', str(self.args.swift_user_visible_version)),
116+
('SWIFT_COMPILER_VERSION', str(swift_compiler_version)),
117+
]
118+
119+
if self.args.compiler_vendor != "apple":
120+
raise RuntimeError("Unknown compiler vendor?! Was build-script \
121+
updated without updating swift.py?")
122+
115123
return [
116124
('SWIFT_VENDOR', 'Apple'),
117125
('SWIFT_VENDOR_UTI', 'com.apple.compilers.llvm.swift'),

0 commit comments

Comments
 (0)