Skip to content

Commit e68be26

Browse files
committed
small cleanup
1 parent 416fcfe commit e68be26

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg_swift_llvm.py

Lines changed: 8 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,15 @@ 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+
run(["cmake", f"-DCMAKE_PREFIX_PATH={';'.join(map(str, prefixes))}", "-DBUILD_SHARED_LIBS=OFF", ".."], cwd=tgt)
6967
return tgt
7068

7169

@@ -108,6 +106,7 @@ def create_static_lib(tgt, libs):
108106
run(libtool_args, cwd=tgt.parent)
109107
return tgt
110108

109+
111110
def copy_includes(src, tgt):
112111
print(f"copying includes from {src}")
113112
for dir, exts in (("include", ("h", "def", "inc")), ("stdlib", ("h",))):
@@ -191,10 +190,11 @@ def main(opts):
191190
if os.path.exists(tmp):
192191
shutil.rmtree(tmp)
193192
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)
193+
llvm_build_tree = next(opts.build_tree.glob("llvm-*"))
194+
swift_build_tree = next(opts.build_tree.glob("swift-*"))
195+
earlyswiftsyntax_build_tree = next(opts.build_tree.glob("earlyswiftsyntax-*"))
196+
configured = configure_dummy_project(tmp, prefixes=[llvm_build_tree, swift_build_tree,
197+
earlyswiftsyntax_build_tree / "cmake" / "modules"])
198198
libs = get_libs(configured)
199199

200200
exported = tmp / "exported"

0 commit comments

Comments
 (0)