Exemple #1
0
    '-I',
    '/Users/zjshao/Documents/repos/KMCLibX/c++/src/',
    '-I',
    '/Users/zjshao/Documents/repos/KMCLibX/c++/externals/include',
    '-I',
    '/Users/zjshao/Documents/repos/KMCLibX/c++/unittest',
    '-I',
    '/usr/lib/gcc/x86_64-linux-gnu/5/include/',
    '-I',
    '/Users/zjshao/Documents/repos/gasol/src'
]

compilation_database_folder = ''

if os.path.exists(compilation_database_folder):
    database = ycm_core.CompilationDatabase(compilation_database_folder)
else:
    database = None

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)
    new_flags = []
    make_next_absolute = False
def GetDatabase(compilation_database_folder):
    if os.path.exists(compilation_database_folder):
        return ycm_core.CompilationDatabase(compilation_database_folder)
    return None
    regex = re.compile(r"(?:\#include \<...\> search starts here\:)(?P<list>.*?)(?:End of search list)", re.DOTALL);
    process = subprocess.Popen(['clang', '-v', '-E', '-x', 'c++', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE);
    process_out, process_err = process.communicate('');
    output = process_out + process_err;
    includes = [];
    for p in re.search(regex, output.decode('utf-8')).group('list').split('\n'):
        p = p.strip();
        if len(p) > 0 and p.find('(framework directory)') < 0:
            includes.append('-isystem');
            includes.append(p);
    return includes;

SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
scriptPath = os.path.dirname(os.path.abspath(__file__));
compilation_database_folder = os.path.join(scriptPath, 'build')
database = None if not os.path.exists(compilation_database_folder) else ycm_core.CompilationDatabase(compilation_database_folder)

# Your custom flags
flags = [
    '-Wall',
    '-Wextra',
    '-std=c++14',
    '-x',
    'c++',
    '-I',
    '.',
]

# Add system includes
systemIncludes = LoadSystemIncludes();
flags = flags + systemIncludes;
Exemple #4
0
    '-isystem',
    '/usr/include/c++/8',
    '-isystem',
    '/usr/local/include',
]

# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
COMPILATION_DB_FOLDER = os.path.join(ROOT, 'build')

if os.path.exists(COMPILATION_DB_FOLDER):
    DB = ycm_core.CompilationDatabase(COMPILATION_DB_FOLDER)
else:
    DB = None

# Extensions that will be looked for.
SOURCE_EXTENSIONS = ['.c', '.cpp', '.cxx', '.cc', '.m', '.mm']
HEADER_EXTENSIONS = ['.h', '.hpp', '.hxx', '.hh']


def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
    """ Processes paths in FLAGS var and makes them absolute. """
    if not working_directory:
        return list(flags)
    new_flags = []
    make_next_absolute = False
    path_flags = ['-isystem', '-I', '-iquote', '--sysroot=']