Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providing global .clang_complete file? #245

Closed
agauniyal opened this issue Oct 24, 2015 · 3 comments
Closed

providing global .clang_complete file? #245

agauniyal opened this issue Oct 24, 2015 · 3 comments

Comments

@agauniyal
Copy link

For general completion when not using cmake as build system, or small 1-2 files autocompletion. YCM does this by providing a flag accepting location for global ycm_config file.

@agauniyal
Copy link
Author

YCM has these for global conf which makes it a bit easier.

flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
'-std=c++14',
'-x',
'c++',
'-isystem',
'../BoostParts',
'-isystem',
'/System/Library/Frameworks/Python.framework/Headers',
'-isystem',
'../llvm/include',
'-isystem',
'../llvm/tools/clang/include',
'-I',
'.',
'-I',
'./ClangCompleter',
'-isystem',
'./tests/gmock/gtest',
'-isystem',
'./tests/gmock/gtest/include',
'-isystem',
'./tests/gmock',
'-isystem',
'./tests/gmock/include',
'/usr/lib/libXbgi.a',
'-lX11',
'-lm'
]

@Sarcasm
Copy link
Owner

Sarcasm commented Oct 25, 2015

You have 2 options:

Either create a .clang_complete file in your home directory for example, it will end up being used as a fallback. This may be a little hacky.

Another good solution is to write a custom compilation database for this, it should be fairly straightforward, see documentation at

irony-mode/irony-cdb.el

Lines 50 to 78 in 3e9d37c

(defcustom irony-cdb-compilation-databases '(irony-cdb-clang-complete
irony-cdb-libclang
irony-cdb-json)
"List of active compilation databases.
The compilation database should respond for the following commands:
`get-compile-options': Takes no argument. This function finds the
compile options used for the current buffer. It must return a
list of cons where the first element is a set of compile options
and the second element the working directory expected for these
commands. The compilation database should return an empty list
for files that it cannot handle."
:type '(repeat function)
:group 'irony-cdb)
(defcustom irony-cdb-search-directory-list '("." "build")
"List of relative subdirectory paths to be searched for cdb files
Irony looks for cdb files in any of the supported format by checking
each directory from the currently loaded file and recursively through
parent directories until it hits the root directory or a cdb is
found. At each level of the search irony looks at the subdirectories
listed in `'irony-cdb-search-directory-list` for the files. Customize this
list if your cdb is held in a custom directory within you project,
such as a custom named build directory.
"
:type '(repeat string)
:group 'irony-cdb)

It's on my todo list to have something nice to do it but I haven't get to do it yet.

@agauniyal
Copy link
Author

Can you add a function for specifying global .clang_complete file? I'm fairly new to emacs and don't know a thing about lisp so I guess I would have to do it with home-directory method :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants