|
22 | 22 | import sys
|
23 | 23 | import shutil
|
24 | 24 |
|
| 25 | +def find_generated_bindings(build_dir, language): |
| 26 | + # First, see if we're in a standalone build of LLDB. |
| 27 | + bindings_build_dir = os.path.join(build_dir, 'bindings', language) |
| 28 | + if os.path.exists(bindings_build_dir): |
| 29 | + return bindings_build_dir |
25 | 30 |
|
26 |
| -def copy_bindings(build_dir, source_dir, language, extensions=['.cpp']): |
27 |
| - binding_build_dir = os.path.join(build_dir, 'bindings', language) |
| 31 | + # Failing that, check if it's a unified build (i.e. build with LLVM+Clang) |
| 32 | + bindings_build_dir = os.path.join(build_dir, 'tools', 'lldb', 'bindings', |
| 33 | + language) |
| 34 | + if os.path.exists(bindings_build_dir): |
| 35 | + return bindings_build_dir |
| 36 | + |
| 37 | + return None |
| 38 | + |
| 39 | + |
| 40 | +def copy_bindings(generated_bindings_dir, source_dir, language, extensions=['.cpp']): |
28 | 41 | binding_source_dir = os.path.join(source_dir, 'bindings', language,
|
29 | 42 | 'static-binding')
|
30 | 43 |
|
31 |
| - for root, _, files in os.walk(binding_build_dir): |
| 44 | + for root, _, files in os.walk(generated_bindings_dir): |
32 | 45 | for file in files:
|
33 | 46 | _, extension = os.path.splitext(file)
|
34 | 47 | filepath = os.path.join(root, file)
|
@@ -56,8 +69,17 @@ def main():
|
56 | 69 | source_dir))
|
57 | 70 | sys.exit(1)
|
58 | 71 |
|
59 |
| - copy_bindings(build_dir, source_dir, 'python', ['.py', '.cpp']) |
60 |
| - copy_bindings(build_dir, source_dir, 'lua', ['.cpp']) |
| 72 | + generated_bindings_python_dir = find_generated_bindings(build_dir, 'python') |
| 73 | + if generated_bindings_python_dir is None: |
| 74 | + print("error: unable to locate the python bindings in the build directory") |
| 75 | + else: |
| 76 | + copy_bindings(generated_bindings_python_dir, source_dir, 'python', ['.py', '.cpp']) |
| 77 | + |
| 78 | + generated_bindings_lua_dir = find_generated_bindings(build_dir, 'lua') |
| 79 | + if generated_bindings_lua_dir is None: |
| 80 | + print("error: unable to locate the lua bindings in the build directory") |
| 81 | + else: |
| 82 | + copy_bindings(generated_bindings_lua_dir, source_dir, 'lua', ['.cpp']) |
61 | 83 |
|
62 | 84 |
|
63 | 85 | if __name__ == "__main__":
|
|
0 commit comments