@@ -32,8 +32,6 @@ def getoptions():
32
32
return opts
33
33
34
34
35
- REQUIRED_CMAKE_PACKAGES = ["LLVM" , "Clang" , "Swift" , "SwiftSyntax" ]
36
-
37
35
EXPORTED_LIB = "CodeQLSwiftFrontendTool"
38
36
39
37
Libs = namedtuple ("Libs" , ("static" , "shared" , "linker_flags" ))
@@ -57,15 +55,15 @@ def get_platform():
57
55
return "linux" if platform .system () == "Linux" else "macos"
58
56
59
57
60
- def configure_dummy_project (tmp , llvm , swift , swift_syntax ):
58
+ def configure_dummy_project (tmp , prefixes ):
61
59
print ("configuring dummy cmake project" )
62
60
script_dir = pathlib .Path (os .path .realpath (__file__ )).parent
63
61
print (script_dir )
64
62
shutil .copy (script_dir / "CMakeLists.txt" , tmp / "CMakeLists.txt" )
65
63
shutil .copy (script_dir / "empty.cpp" , tmp / "empty.cpp" )
66
64
tgt = tmp / "build"
67
65
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 )
69
67
return tgt
70
68
71
69
@@ -108,6 +106,7 @@ def create_static_lib(tgt, libs):
108
106
run (libtool_args , cwd = tgt .parent )
109
107
return tgt
110
108
109
+
111
110
def copy_includes (src , tgt ):
112
111
print (f"copying includes from { src } " )
113
112
for dir , exts in (("include" , ("h" , "def" , "inc" )), ("stdlib" , ("h" ,))):
@@ -191,10 +190,11 @@ def main(opts):
191
190
if os .path .exists (tmp ):
192
191
shutil .rmtree (tmp )
193
192
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" ])
198
198
libs = get_libs (configured )
199
199
200
200
exported = tmp / "exported"
0 commit comments