@@ -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,16 @@ 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
+ prefixes = ';' .join (str (p ) for p in prefixes )
67
+ run (["cmake" , f"-DCMAKE_PREFIX_PATH={ prefixes } " , "-DBUILD_SHARED_LIBS=OFF" , ".." ], cwd = tgt )
69
68
return tgt
70
69
71
70
@@ -108,6 +107,7 @@ def create_static_lib(tgt, libs):
108
107
run (libtool_args , cwd = tgt .parent )
109
108
return tgt
110
109
110
+
111
111
def copy_includes (src , tgt ):
112
112
print (f"copying includes from { src } " )
113
113
for dir , exts in (("include" , ("h" , "def" , "inc" )), ("stdlib" , ("h" ,))):
@@ -191,10 +191,11 @@ def main(opts):
191
191
if os .path .exists (tmp ):
192
192
shutil .rmtree (tmp )
193
193
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" ])
198
199
libs = get_libs (configured )
199
200
200
201
exported = tmp / "exported"
0 commit comments