creating symlink for compile_commands.json
This commit is contained in:
parent
06730d16f7
commit
4492534331
1 changed files with 14 additions and 0 deletions
|
@ -125,6 +125,7 @@ def run_cmake(projects: str, repo_path: str, config_file_path: str = None):
|
|||
|
||||
env = _create_env(config)
|
||||
llvm_enable_projects = _select_projects(config, projects, repo_path)
|
||||
print('Enabled projects: {}'.format(llvm_enable_projects))
|
||||
arguments = _create_args(config, llvm_enable_projects)
|
||||
cmd = 'cmake ' + ' '.join(arguments)
|
||||
|
||||
|
@ -135,6 +136,19 @@ def run_cmake(projects: str, repo_path: str, config_file_path: str = None):
|
|||
|
||||
subprocess.check_call(cmd, env=env, shell=True, cwd=build_dir)
|
||||
|
||||
_link_compile_commands(config, repo_path, build_dir)
|
||||
|
||||
|
||||
def _link_compile_commands(config: Configuration, repo_path: str, build_dir: str):
|
||||
"""Link compile_commands.json from build to root dir"""
|
||||
if config.operating_system != OperatingSystem.Linux:
|
||||
return
|
||||
source_path = os.path.join(build_dir, 'compile_commands.json')
|
||||
target_path = os.path.join(repo_path, 'compile_commands.json')
|
||||
if os.path.exists(target_path):
|
||||
os.remove(target_path)
|
||||
os.symlink(source_path, target_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Run CMake for LLVM.')
|
||||
|
|
Loading…
Reference in a new issue