Skip to content

Commit 0dd4521

Browse files
committed
small cleanup
1 parent 416fcfe commit 0dd4521

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

pkg_swift_llvm.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ def getoptions():
3232
return opts
3333

3434

35-
REQUIRED_CMAKE_PACKAGES = ["LLVM", "Clang", "Swift", "SwiftSyntax"]
36-
3735
EXPORTED_LIB = "CodeQLSwiftFrontendTool"
3836

3937
Libs = namedtuple("Libs", ("static", "shared", "linker_flags"))
@@ -57,15 +55,16 @@ def get_platform():
5755
return "linux" if platform.system() == "Linux" else "macos"
5856

5957

60-
def configure_dummy_project(tmp, llvm, swift, swift_syntax):
58+
def configure_dummy_project(tmp, prefixes):
6159
print("configuring dummy cmake project")
6260
script_dir = pathlib.Path(os.path.realpath(__file__)).parent
6361
print(script_dir)
6462
shutil.copy(script_dir / "CMakeLists.txt", tmp / "CMakeLists.txt")
6563
shutil.copy(script_dir / "empty.cpp", tmp / "empty.cpp")
6664
tgt = tmp / "build"
6765
tgt.mkdir()
68-
run(["cmake", f"-DCMAKE_PREFIX_PATH={llvm};{swift};{swift_syntax}/cmake/modules", "-DBUILD_SHARED_LIBS=OFF", ".."], cwd=tgt)
66+
prefixes = ';'.join(str(p) for p in prefixes)
67+
run(["cmake", f"-DCMAKE_PREFIX_PATH={prefixes}", "-DBUILD_SHARED_LIBS=OFF", ".."], cwd=tgt)
6968
return tgt
7069

7170

@@ -108,6 +107,7 @@ def create_static_lib(tgt, libs):
108107
run(libtool_args, cwd=tgt.parent)
109108
return tgt
110109

110+
111111
def copy_includes(src, tgt):
112112
print(f"copying includes from {src}")
113113
for dir, exts in (("include", ("h", "def", "inc")), ("stdlib", ("h",))):
@@ -191,10 +191,11 @@ def main(opts):
191191
if os.path.exists(tmp):
192192
shutil.rmtree(tmp)
193193
os.mkdir(tmp)
194-
llvm_build_tree = next(pathlib.Path(opts.build_tree).glob("llvm-*"))
195-
swift_build_tree = next(pathlib.Path(opts.build_tree).glob("swift-*"))
196-
earlyswiftsyntax_build_tree = next(pathlib.Path(opts.build_tree).glob("earlyswiftsyntax-*"))
197-
configured = configure_dummy_project(tmp, llvm_build_tree, swift_build_tree, earlyswiftsyntax_build_tree)
194+
llvm_build_tree = next(opts.build_tree.glob("llvm-*"))
195+
swift_build_tree = next(opts.build_tree.glob("swift-*"))
196+
earlyswiftsyntax_build_tree = next(opts.build_tree.glob("earlyswiftsyntax-*"))
197+
configured = configure_dummy_project(tmp, prefixes=[llvm_build_tree, swift_build_tree,
198+
earlyswiftsyntax_build_tree / "cmake" / "modules"])
198199
libs = get_libs(configured)
199200

200201
exported = tmp / "exported"

0 commit comments

Comments
 (0)