Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarex committed Mar 17, 2015
1 parent aa6777c commit aab400f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 72 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@
[submodule ".vim/bundle/vim-glsl"]
path = .vim/bundle/vim-glsl
url = https://github.com/tikhomirov/vim-glsl
[submodule ".vim/bundle/vim-llvm"]
path = .vim/bundle/vim-llvm
url = git@github.com:Superbil/llvm.vim.git
2 changes: 1 addition & 1 deletion .oh-my-zsh
Submodule .oh-my-zsh updated from c78277 to e55c71
2 changes: 1 addition & 1 deletion .vim/bundle/YouCompleteMe
1 change: 1 addition & 0 deletions .vim/bundle/vim-llvm
Submodule vim-llvm added at 10ce42
4 changes: 4 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ set laststatus=2
set listchars=tab\ ,trail:·
set list

augroup filetype
au! BufRead,BufNewFile *.ll set filetype=llvm
augroup END

" Defaults
autocmd BufEnter *.c set ai sw=4 ts=4
autocmd BufEnter *.py set ai et ts=4 sw=4 sts=4
Expand Down
88 changes: 19 additions & 69 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,68 +42,16 @@
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
# You 100% do NOT need -DUSE_CLANG_COMPLETER in your flags; only the YCM
# source code needs it.
'-DUSE_CLANG_COMPLETER',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++11',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-isystem',
'../BoostParts',
'-isystem',
# This path will only work on OS X, but extra paths that don't exist are not
# harmful
'/System/Library/Frameworks/Python.framework/Headers',
'-isystem',
'../llvm/include',
'-isystem',
'../llvm/tools/clang/include',
'-I',
'.',
'-I',
'./src',
'-I',
'./include',
'-I',
'../include',
'-I',
'../../cglib/include',
'-I',
'/usr/include/eigen3',
'-I',
'./ClangCompleter',
'-isystem',
'/home/patrick/Code/simox',
'-isystem',
'/home/patrick/Code/osrm/Include',
'-isystem',
'/home/patrick/Code/osrm/third_party',
'-isystem',
'./tests/gmock/gtest',
'-isystem',
'./tests/gmock/gtest/include',
'-isystem',
'./tests/gmock',
'-isystem',
'./tests/gmock/include',
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1',
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
'-x', 'c++',
'-I', '.',
'-I', './src',
'-I', './include',
'-I', './third_party',
'-I', '/usr/include',
'-I', '/usr/local/include',
'-I', '../../cglib/include',
'-I', '/usr/include/eigen3',
]


Expand All @@ -122,10 +70,6 @@

SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]

def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )


def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
Expand Down Expand Up @@ -154,12 +98,10 @@ def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
new_flags.append( new_flag )
return new_flags


def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]


def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
Expand All @@ -177,6 +119,15 @@ def GetCompilationInfoForFile( filename ):
return None
return database.GetCompilationInfoForFile( filename )

def FindProjectRoot ( filename ):
current_dir = os.path.dirname(filename)
found = False
while current_dir is not '/':
if '.git' in os.listdir(current_dir):
found = True
break
current_dir = os.path.dirname(current_dir)
return found and current_dir or None

def FlagsForFile( filename, **kwargs ):
if database:
Expand All @@ -190,8 +141,7 @@ def FlagsForFile( filename, **kwargs ):
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
else:
#relative_to = DirectoryOfThisScript()
relative_to = os.path.dirname(filename)
relative_to = FindProjectRoot(filename) or os.path.dirname(filename)
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )

return {
Expand Down
2 changes: 1 addition & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
source $ZSH/oh-my-zsh.sh

# Customize to your needs...
export PATH=/home/patrick/.gem/ruby/2.1.0/bin:/home/patrick/.local/bin:/home/patrick/.cabal/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
export PATH=/home/patrick/.gem/ruby/2.2.0/bin:/home/patrick/.local/bin:/home/patrick/.cabal/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin

# powerline theme
if [[ -r ~/.local/lib/python/site-packages/powerline/bindings/zsh/powerline.zsh ]]; then
Expand Down

0 comments on commit aab400f

Please sign in to comment.