|
| 1 | +# Copyright 2013 Google, Inc. |
| 2 | +# Copyright 2013 Dean Michael Berris <dberris@google.com> |
| 3 | +# Distributed under the Boost Software License, Version 1.0. |
| 4 | +# (See accompanying file LICENSE_1_0.txt or copy at |
| 5 | +# http://www.boost.org/LICENSE_1_0.txt) |
| 6 | +# |
| 7 | +# Project-wide configuration for YouCompleteMe Vim plugin. |
| 8 | +# |
| 9 | +# Based off of Valloric's .ycm_conf_extra.py for YouCompleteMe: |
| 10 | +# https://github.com/Valloric/YouCompleteMe/blob/master/cpp/ycm/.ycm_extra_conf.py |
| 11 | +# |
| 12 | + |
| 13 | +importos |
| 14 | +importycm_core |
| 15 | + |
| 16 | +flags= [ |
| 17 | +'-Wall', |
| 18 | +'-Wextra', |
| 19 | +'-Werror', |
| 20 | +'-std=c++03', |
| 21 | +'-isystem', |
| 22 | +'.', |
| 23 | +'-isystem', |
| 24 | +'/usr/include', |
| 25 | +'-isystem', |
| 26 | +'/usr/include/c++/4.6', |
| 27 | +'-isystem', |
| 28 | +'/usr/include/clang/3.0/include', |
| 29 | +'-I', |
| 30 | +os.environ['BOOST_ROOT'], |
| 31 | +# Always enable debugging for the project when building for semantic |
| 32 | +# completion. |
| 33 | +'-DBOOST_NETWORK_DEBUG', |
| 34 | + ] |
| 35 | + |
| 36 | +defDirectoryOfThisScript(): |
| 37 | +returnos.path.dirname(os.path.abspath(__file__)) |
| 38 | + |
| 39 | + |
| 40 | +defMakeRelativePathsInFlagsAbsolute(flags,working_directory): |
| 41 | +ifnotworking_directory: |
| 42 | +returnlist(flags) |
| 43 | +new_flags= [] |
| 44 | +make_next_absolute=False |
| 45 | +path_flags= ['-isystem','-I','-iquote','--sysroot='] |
| 46 | +forflaginflags: |
| 47 | +new_flag=flag |
| 48 | +ifmake_next_absolute: |
| 49 | +make_next_absolute=False |
| 50 | +ifnotflag.startswith('/'): |
| 51 | +new_flag=os.path.join(working_directory,flag) |
| 52 | + |
| 53 | +forpath_flaginpath_flags: |
| 54 | +ifflag==path_flag: |
| 55 | +make_next_absolute=True |
| 56 | +break |
| 57 | +ifflag.startswith(path_flag): |
| 58 | +path=flag[len(path_flag):] |
| 59 | +new_flag=path_flag+os.path.join(working_directory,path) |
| 60 | +break |
| 61 | + |
| 62 | +ifnew_flag: |
| 63 | +new_flags.append(new_flag) |
| 64 | +returnnew_flags |
| 65 | + |
| 66 | + |
| 67 | +defFlagsForFile(filename): |
| 68 | +relative_to=DirectoryOfThisScript() |
| 69 | +final_flags=MakeRelativePathsInFlagsAbsolute(flags,relative_to) |
| 70 | +return {'flags':final_flags,'do_cache':True } |