]>
git.rmz.io Git - dotfiles.git/blob - vim/ycm_extra_conf.py
6 # These are the compilation flags that will be used in case there's no
7 # compilation database set (by default, one is not set).
8 # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
16 # '-Wno-variadic-macros',
24 '-isystem', '/usr/include/c++/4.9.0',
25 '-isystem', '/usr/include/c++/4.9.0/x86_64-unknown-linux-gnu',
26 '-isystem', '/usr/include/c++/4.9.0/backward',
27 '-isystem', '/usr/lib/clang/3.4.1/include'
30 # This function makes it easy to pull in additional flags from rospack
32 cmd
= ['rospack', 'cflags-only-I']
34 out
= subprocess
.Popen(cmd
, shell
=False, stdout
=subprocess
.PIPE
).stdout
37 line
= out
.readline()[:-1].split(" ")
40 if include
.startswith(os
.path
.expanduser('~')):
41 includes
+= ['-I', include
]
43 includes
+= ['-isystem', include
]
44 return filter(lambda a
: a
!= ' ', includes
)
48 def DirectoryOfThisScript():
49 return os
.path
.dirname( os
.path
.abspath( __file__
) )
51 def MakeRelativePathsInFlagsAbsolute( flags
, working_directory
):
52 if not working_directory
:
55 make_next_absolute
= False
56 path_flags
= [ '-isystem', '-I', '-iquote', '--sysroot=' ]
60 if make_next_absolute
:
61 make_next_absolute
= False
62 if not flag
.startswith( '/' ):
63 new_flag
= os
.path
.join( working_directory
, flag
)
65 for path_flag
in path_flags
:
67 make_next_absolute
= True
70 if flag
.startswith( path_flag
):
71 path
= flag
[ len( path_flag
): ]
72 new_flag
= path_flag
+ os
.path
.join( working_directory
, path
)
76 new_flags
.append( new_flag
)
79 def FlagsForFile( filename
, **kwargs
):
80 relative_to
= DirectoryOfThisScript()
81 final_flags
= MakeRelativePathsInFlagsAbsolute( flags
, relative_to
)