aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-07-11 00:43:27 +0800
committer杨宇千 <crupest@outlook.com>2019-07-11 00:43:27 +0800
commitcafcbde7529f7c1e4219344df9a404ecdb411aa5 (patch)
treea4b515131bb026d12db92eaa1d3f9f32a7a65505 /tools
parentd163bafa461779a3795818aa8c8b5238880ede24 (diff)
downloadcru-cafcbde7529f7c1e4219344df9a404ecdb411aa5.tar.gz
cru-cafcbde7529f7c1e4219344df9a404ecdb411aa5.tar.bz2
cru-cafcbde7529f7c1e4219344df9a404ecdb411aa5.zip
...
Diffstat (limited to 'tools')
-rw-r--r--tools/generate_clang_complete.py18
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()