Skip to content
This repository was archived by the owner on Aug 30, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions template.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,32 @@
# INSERT FLAGS HERE
]

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


# 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
# compile_commands.json file to use that instead of 'flags'. By default it is
# set to the directory of this script. See here for more details:
# http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# 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_database_folder = ''
compilation_database_folder = DirectoryOfThisScript()

if os.path.exists( compilation_database_folder ):
if os.path.exists( compilation_database_folder ) and \
os.path.exists( os.path.join( compilation_database_folder, 'CMakeLists.txt' ) ) and \
os.path.exists( os.path.join( compilation_database_folder, 'compile_commands.json' ) ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None

SOURCE_EXTENSIONS = [ '.C', '.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