-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkycmflags
executable file
·57 lines (46 loc) · 1.31 KB
/
mkycmflags
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
import os
import subprocess
import sys
clang_version = 4.0
clang_bin = "/usr/bin/clang-" + str(clang_version)
here = os.path.abspath(os.path.dirname(sys.argv[0]))
output = os.path.join(here, ".ycm_extra_conf.py")
flags = []
subprocess.call( \
clang_bin + " -E -x c++ -std=c++11 -v - < /dev/null >/dev/null 2>" + \
output,
shell = True)
fp = open(output, 'r')
inc = False
for l in fp.readlines():
l = l.strip()
if inc:
if l.startswith("End"):
break
else:
flags.extend(["-isystem", l])
elif l.startswith("#include <"):
inc = True
fp.close()
os.unlink(output)
subprocess.call("/usr/bin/pkg-config --cflags gtkmm-3.0 msgpack > " + output,
shell = True)
fp = open(output, 'r')
flags.extend(fp.read().strip().split())
fp.close()
#flags.append("-I" + os.path.join(here, "db"))
#flags.append("-I.")
flags.extend(["-I.", "-I..", "-Wall", "-Wextra", "-xc++", "-std=c++11"])
# The version values are irrelevant here as long as they're valid strings
flags.extend(['-DGNVIM_GIT_VERSION="0.0.1"', '-DPACKAGE_VERSION="0.0.1"'])
os.unlink(output)
fp = open(output, 'w')
fp.write( \
"""def FlagsForFile(filename, **Kwargs):
return {
"flags": """ + str(flags) + """,
"do_cache": True
}
""")
fp.close()