forked from numba/llvmlite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add YouCompleteMe configuration file and ignore vim swap files
YouCompleteMe (https://github.com/ycm-core/YouCompleteMe) is a code-completion engine for vim. This PR adds a configuration file for it that enables it to understand the C++ FFI code in llvmlite by pointing to the correct include dirs (as long as one is working within a Conda environment), setting the relevant C++ standard, and ensuring that all header files are treated as C++. Additionally, Vim swap files are added to the gitignore, so that they don't show up in `git status`.
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ coverage.xml | |
MANIFEST | ||
docs/_build/ | ||
docs/gh-pages/ | ||
|
||
.*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# YouCompleteMe (https://github.com/ycm-core/YouCompleteMe) configuration file | ||
# that enables it to find the LLVM and Python includes from a conda | ||
# environment, independent of the Conda environment location and Python and | ||
# LLVM versions. | ||
|
||
import os | ||
import sys | ||
|
||
from pathlib import Path | ||
|
||
CONDA_PREFIX = os.environ['CONDA_PREFIX'] | ||
LLVMLITE_DIR = Path(__file__).parent | ||
VER = sys.version_info | ||
PYTHON_INCLUDE_NAME = f'python{VER.major}.{VER.minor}' | ||
|
||
CONDA_INCLUDE_DIR = Path(CONDA_PREFIX, 'include') | ||
PYTHON_INCLUDE_DIR = Path(CONDA_INCLUDE_DIR, PYTHON_INCLUDE_NAME) | ||
FFI_DIR = Path(LLVMLITE_DIR, 'ffi') | ||
|
||
flags = [ | ||
# Include dirs | ||
f'-I{CONDA_INCLUDE_DIR}', | ||
f'-I{PYTHON_INCLUDE_DIR}', | ||
f'-I{FFI_DIR}', | ||
# C++ standard to which LLVM 14 is developed | ||
'-std=c++14', | ||
# Force language to C++ so that core.h is treated as C++ | ||
'-x', 'c++', | ||
] | ||
|
||
|
||
# This function is called by YCM to obtain the config from this file. | ||
def Settings(**kwargs): | ||
return {'flags': flags} | ||
|
||
|
||
# Executing this configuration file standalone outside of YCM prints the | ||
# settings to aid with debugging the configuration. | ||
if __name__ == '__main__': | ||
print(Settings()) |