-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ycm_extra_conf.py
73 lines (60 loc) · 1.69 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
"""This module provides compilation flags used by ycm to enable
semantic code completion."""
import os
import sys
DIR_OF_THIS_SCRIPT = os.path.abspath(os.path.dirname( __file__ ))
CPP_EXT = {
'.cpp', '.cc', '.c++', '.cp', '.cxx',
'.hpp', '.hh', '.h++', '.hp', '.hxx'}
C_EXT = {'.c', '.h'}
INCLUDE = [
'./src',
'./src/draw',
'./include',
'./lib/gl3w',
'./lib/imgui',
'./lib/nlohmann']
CPP_FLAGS = ['-std=c++14']
C_FLAGS = ['-std=c11']
COMMON_FLAGS = [
'-fopenmp',
'`pkg-config --cflags glfw3`',
'-Wall',
'-Wextra',
'-DDEBUG',
'-g',
'-Og']
LIBS = [
'-lGL',
'`pkg-config --static --libs glfw3`',
'-fopenmp',
'-lboost_program_options',
'-lboost_iostreams',
'-lfreeimage',
'-lprecice']
# log output for debugging
log = None
if log is not None and os.path.isfile(log):
os.remove(log)
def FlagsForFile(filename, **kwargs):
includes = ['-I' + os.path.join(DIR_OF_THIS_SCRIPT, item) for \
item in INCLUDE]
flags = COMMON_FLAGS
if os.path.splitext(filename)[1].lower() in CPP_EXT:
flags.extend(CPP_FLAGS)
else:
flags.extend(C_FLAGS)
if log is not None:
orig_stdout = sys.stdout
with open(log, 'a') as f:
sys.stdout = f
print(filename)
print(kwargs)
print(kwargs['client_data'])
for item in kwargs['client_data']:
print(item, kwargs['client_data'][item])
print(flags)
print(includes)
print()
sys.stdout = orig_stdout
return {'flags': flags + includes + LIBS }