Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2989_MovingPeaksBenchmark/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/.ycm_extra_conf.py @ 17514

Last change on this file since 17514 was 16269, checked in by bburlacu, 6 years ago

#2958: Add C++ source code

File size: 4.8 KB
Line 
1# Generated by YCM Generator at 2018-11-01 01:38:35.867002
2
3# This file is NOT licensed under the GPLv3, which is the license for the rest
4# of YouCompleteMe.
5#
6# Here's the license text for this file:
7#
8# This is free and unencumbered software released into the public domain.
9#
10# Anyone is free to copy, modify, publish, use, compile, sell, or
11# distribute this software, either in source code form or as a compiled
12# binary, for any purpose, commercial or non-commercial, and by any
13# means.
14#
15# In jurisdictions that recognize copyright laws, the author or authors
16# of this software dedicate any and all copyright interest in the
17# software to the public domain. We make this dedication for the benefit
18# of the public at large and to the detriment of our heirs and
19# successors. We intend this dedication to be an overt act of
20# relinquishment in perpetuity of all present and future rights to this
21# software under copyright law.
22#
23# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29# OTHER DEALINGS IN THE SOFTWARE.
30#
31# For more information, please refer to <http://unlicense.org/>
32
33import os
34import ycm_core
35
36flags = [
37    '-x',
38    'c++',
39    '-Dhl_native_interpreter_EXPORTS',
40    '-I/mnt/c/Projects/hl-native-interpreter/src',
41    '-I/mnt/c/Projects/hl-native-interpreter/lib',
42    '-Wall',
43    '-Werror',
44    '-Wextra',
45    '-fdeclspec',
46    '-std=c++14',
47]
48
49
50# Set this to the absolute path to the folder (NOT the file!) containing the
51# compile_commands.json file to use that instead of 'flags'. See here for
52# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
53#
54# You can get CMake to generate this file for you by adding:
55#   set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
56# to your CMakeLists.txt file.
57#
58# Most projects will NOT need to set this to anything; you can just change the
59# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
60compilation_database_folder = ''
61
62if os.path.exists( compilation_database_folder ):
63  database = ycm_core.CompilationDatabase( compilation_database_folder )
64else:
65  database = None
66
67SOURCE_EXTENSIONS = [ '.C', '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
68
69def DirectoryOfThisScript():
70  return os.path.dirname( os.path.abspath( __file__ ) )
71
72
73def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
74  if not working_directory:
75    return list( flags )
76  new_flags = []
77  make_next_absolute = False
78  path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
79  for flag in flags:
80    new_flag = flag
81
82    if make_next_absolute:
83      make_next_absolute = False
84      if not flag.startswith( '/' ):
85        new_flag = os.path.join( working_directory, flag )
86
87    for path_flag in path_flags:
88      if flag == path_flag:
89        make_next_absolute = True
90        break
91
92      if flag.startswith( path_flag ):
93        path = flag[ len( path_flag ): ]
94        new_flag = path_flag + os.path.join( working_directory, path )
95        break
96
97    if new_flag:
98      new_flags.append( new_flag )
99  return new_flags
100
101
102def IsHeaderFile( filename ):
103  extension = os.path.splitext( filename )[ 1 ]
104  return extension in [ '.H', '.h', '.hxx', '.hpp', '.hh' ]
105
106
107def GetCompilationInfoForFile( filename ):
108  # The compilation_commands.json file generated by CMake does not have entries
109  # for header files. So we do our best by asking the db for flags for a
110  # corresponding source file, if any. If one exists, the flags for that file
111  # should be good enough.
112  if IsHeaderFile( filename ):
113    basename = os.path.splitext( filename )[ 0 ]
114    for extension in SOURCE_EXTENSIONS:
115      replacement_file = basename + extension
116      if os.path.exists( replacement_file ):
117        compilation_info = database.GetCompilationInfoForFile(
118          replacement_file )
119        if compilation_info.compiler_flags_:
120          return compilation_info
121    return None
122  return database.GetCompilationInfoForFile( filename )
123
124
125def FlagsForFile( filename, **kwargs ):
126  if database:
127    # Bear in mind that compilation_info.compiler_flags_ does NOT return a
128    # python list, but a "list-like" StringVec object
129    compilation_info = GetCompilationInfoForFile( filename )
130    if not compilation_info:
131      return None
132
133    final_flags = MakeRelativePathsInFlagsAbsolute(
134      compilation_info.compiler_flags_,
135      compilation_info.compiler_working_dir_ )
136
137  else:
138    relative_to = DirectoryOfThisScript()
139    final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
140
141  return {
142    'flags': final_flags,
143    'do_cache': True
144  }
145
Note: See TracBrowser for help on using the repository browser.