diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/generate_clang_complete.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/generate_clang_complete.py b/tools/generate_clang_complete.py index 44da60f3..9b650b9c 100644 --- a/tools/generate_clang_complete.py +++ b/tools/generate_clang_complete.py @@ -1,6 +1,12 @@ +import argparse import os import os.path +parser = argparse.ArgumentParser() +parser.add_argument('-d', '--debug', action='store_true', + default='Debug', help='specify build configuration') +args = parser.parse_args() + clang_complete_file_name = '.clang_complete' # project root dir @@ -8,7 +14,7 @@ project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) os.chdir(project_root) global_std_standard = 'c++17' # change this to change standard -global_std_standard_arg = '-std={}'.format(global_std_standard) +global_std_standard_arg = '--std={}'.format(global_std_standard) global_include_paths = [ os.path.abspath('include') @@ -16,6 +22,9 @@ global_include_paths = [ global_definitions = [] +if args.debug: + global_definitions.append('_DEBUG') + def generate_clang_complete_content(additional_include_paths=[], additional_definitions=[]): include_args = [ @@ -27,7 +36,7 @@ def generate_clang_complete_content(additional_include_paths=[], additional_defi def generate_root_clang_complete(): - with open(os.path.join('src/', clang_complete_file_name), 'w') as f: + with open(clang_complete_file_name, 'w') as f: print(generate_clang_complete_content(), file=f) @@ -36,8 +45,9 @@ def generate_win_clang_complete_content(): def generate_win_clang_complete(): - with open(os.path.join('src/win/', clang_complete_file_name), 'w') as f: - print(generate_win_clang_complete_content(), file=f) + for path in ['src/win/', 'include/cru/win/']: + with open(os.path.join(path, clang_complete_file_name), 'w') as f: + print(generate_win_clang_complete_content(), file=f) generate_root_clang_complete() generate_win_clang_complete() |