Index: tools/clang/scripts/generate_win_compdb.py |
diff --git a/tools/clang/scripts/generate_win_compdb.py b/tools/clang/scripts/generate_win_compdb.py |
index 32f5f753c5316b3489249ae57379a64b92855d29..cf9a569724b8402b4012839c40cca557a660987c 100755 |
--- a/tools/clang/scripts/generate_win_compdb.py |
+++ b/tools/clang/scripts/generate_win_compdb.py |
@@ -11,6 +11,7 @@ which also confuses clang. This script generates a compile DB that should mostly |
work until clang tooling can be improved upstream. |
""" |
+import argparse |
import os |
import re |
import json |
@@ -60,10 +61,18 @@ def _ProcessEntry(e): |
def main(argv): |
+ # Parse argument |
+ parser = argparse.ArgumentParser() |
+ parser.add_argument( |
+ 'build_path', |
+ nargs='?', |
+ help='Path to build directory', |
+ default='out/Debug') |
+ args = parser.parse_args() |
# First, generate the compile database. |
print 'Generating compile DB with ninja...' |
compile_db_as_json = subprocess.check_output(shlex.split( |
- 'ninja -C out/Debug -t compdb cc cxx objc objcxx')) |
+ 'ninja -C %s -t compdb cc cxx objc objcxx' % args.build_path)) |
compile_db = json.loads(compile_db_as_json) |
print 'Read in %d entries from the compile db' % len(compile_db) |