-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ycm_extra_conf.py
99 lines (69 loc) · 2.12 KB
/
.ycm_extra_conf.py
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import subprocess
import os
def get_cpp_flags():
flags = []
flags += get_root_flags()
flags += get_coast_flags()
flags += get_python_flags()
flags += get_default_flags()
return [i for i in flags if i]
def get_python_sys_path():
sys_path = [
os.path.join(os.environ["COAST_USER_LIB"], "python", "packages"),
]
return [i for i in sys_path if i]
def Settings(**kwargs):
language = kwargs["language"]
if language == "cfamily":
return {
"flags": get_cpp_flags(),
}
if language == "python":
return {
"interpreter_path": "python3",
"sys_path": get_python_sys_path(),
}
return {}
def get_root_flags():
flags = []
retval = subprocess.check_output(["root-config", "--cflags"])[:-1]
flags += retval.decode("utf8").split(" ")
retval = subprocess.check_output(["root-config", "--ldflags"])[:-1]
flags += retval.decode("utf8").split(" ")
retval = subprocess.check_output(["root-config", "--libs"])[:-1]
flags += retval.decode("utf8").split(" ")
return flags
def get_coast_flags():
flags = []
coast_dir = os.environ["COAST_DIR"]
flags += [
"-I" + coast_dir + "/include",
]
flags += [
"-L" + coast_dir + "/lib",
"-lCorsikaIntern",
"-lCorsikaFileIO",
"-lCorsikaROOT",
"-lCorsikaToROOT",
]
return flags
def get_python_flags():
flags = ["-D USE_PYTHON_INTERFACE"]
retval = subprocess.check_output(["python3-config", "--cflags"])[:-1]
flags += retval.decode("utf8").split(" ")
retval = subprocess.check_output(["python3-config", "--ldflags"])[:-1]
flags += retval.decode("utf8").split(" ")
retval = subprocess.check_output(["python3-config", "--libs"])[:-1]
flags += retval.decode("utf8").split(" ")
return flags
def get_default_flags():
flags = [
"-x",
"c++",
"-std=c++17",
"-stdlib=libc++",
"-Wall",
"-Wextra",
"-D EXPERIMENTAL_FILESYSTEM",
]
return flags