Skip to content

Commit 40d4376

Browse files
author
AlexDenisov
authoredJun 22, 2023
Merge pull request #13 from dsp-testing/alexdenisov/add-more-swift-libs
Add more swift libs
2 parents 3b04f69 + 3137a44 commit 40d4376

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed
 

‎pkg_swift_llvm.py

+19-16
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,27 @@ def export_sdk(tgt, swift_source_tree, swift_build_tree):
135135
ignore=shutil.ignore_patterns('CMakeLists.txt'))
136136

137137

138+
def export_toolchain(tgt, toolchain_dir):
139+
print("assembling toolchain")
140+
shutil.copytree(toolchain_dir, tgt)
141+
142+
138143
def export_stdlibs(exported_dir, swift_build_tree):
139144
ext = 'dylib'
140-
platform = 'macosx'
141-
if get_platform() == "linux":
142-
platform = 'linux'
143-
ext = 'so'
145+
platform = 'linux' if get_platform() == 'linux' else 'macosx'
144146
lib_dir = swift_build_tree / 'lib/swift' / platform
145-
stdlibs = [
146-
f'libswiftCore.{ext}',
147-
'libswiftCompatibility50.a',
148-
'libswiftCompatibility51.a',
149-
'libswiftCompatibilityConcurrency.a',
150-
'libswiftCompatibilityDynamicReplacements.a']
151-
for stdlib in stdlibs:
152-
lib_path = lib_dir / stdlib
153-
if lib_path.exists():
147+
patterns = [f'lib{dep}.*' for dep in (
148+
"dispatch",
149+
"BlocksRuntime",
150+
"swiftCore",
151+
"swift_*",
152+
"swiftGlibc",
153+
"swiftCompatibility*",
154+
)]
155+
for pattern in patterns:
156+
for stdlib in lib_dir.glob(pattern):
154157
print(f'Copying {stdlib}')
155-
shutil.copy(lib_path, exported_dir)
156-
else:
157-
print(f'Skipping {stdlib}')
158+
shutil.copy(stdlib, exported_dir)
158159

159160

160161
def export_libs(exported_dir, libs, swift_build_tree):
@@ -193,6 +194,7 @@ def main(opts):
193194
os.mkdir(tmp)
194195
llvm_build_tree = next(opts.build_tree.glob("llvm-*"))
195196
swift_build_tree = next(opts.build_tree.glob("swift-*"))
197+
toolchain_dir = next(opts.build_tree.glob("toolchain-*/codeql-toolchain"))
196198
earlyswiftsyntax_build_tree = next(opts.build_tree.glob("earlyswiftsyntax-*"))
197199
configured = configure_dummy_project(tmp, prefixes=[llvm_build_tree, swift_build_tree,
198200
earlyswiftsyntax_build_tree / "cmake" / "modules"])
@@ -203,6 +205,7 @@ def main(opts):
203205
export_libs(exported, libs, swift_build_tree)
204206
export_headers(exported, opts.swift_source_tree, llvm_build_tree, swift_build_tree)
205207
export_sdk(exported / "sdk", opts.swift_source_tree, swift_build_tree)
208+
export_toolchain(exported / "toolchain", toolchain_dir)
206209

207210
zip_dir(exported, opts.output)
208211

‎swift-build-presets

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
[preset: codeql-baseline]
22
llvm-cmake-options=-DLLVM_ENABLE_TERMINFO=OFF -DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64
33

4-
skip-ios
5-
skip-tvos
6-
skip-watchos
7-
84
skip-test-osx
95
skip-test-linux
106
skip-test-swiftpm
@@ -27,9 +23,11 @@ enable-experimental-string-processing
2723
swift-enable-experimental-string-processing=1
2824

2925
no-assertions
30-
3126
reconfigure
3227

28+
install-swift
29+
install-prefix=/codeql-toolchain
30+
3331
[preset: codeql-release]
3432
mixin-preset=codeql-baseline
3533
release
@@ -41,6 +39,9 @@ bootstrapping=hosttools
4139

4240
[preset: codeql-macOS]
4341
mixin-preset=codeql-release
42+
ios
43+
tvos
44+
watchos
4445
bootstrapping=bootstrapping
4546

4647
[preset: codeql-debug]

0 commit comments

Comments
 (0)
Please sign in to comment.