-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·48 lines (39 loc) · 1.46 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- mode: python -*-
import os
import sys
import platform
import shutil
import subprocess
from distutils.spawn import find_executable
if platform.system() != 'Linux':
print("We only support Linux for now")
sys.exit(-1)
buck_path = find_executable('buck')
if buck_path:
print("Found system buck installation")
elif os.path.exists('./buck.pex'):
print("Found local buck.pex")
else:
print("Getting Buck...")
os.system('curl -o buck.pex -L http://fs.csl.utoronto.ca/~mike/buck.pex') # Java11 Compatible build
os.system('chmod +x buck.pex')
with open('.buckconfig.local', 'w') as f:
f.write('[cxx]\n')
f.write(' cc = {clang}\n cxx = {clangxx}\n as = {clang}\n ld = {clangxx}\n'.format(clang=shutil.which('clang'), clangxx=shutil.which('clang++')))
p = subprocess.run(['clang++', '-E', '-v', '-stdlib=libc++', '-xc++', '-'], stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
s = p.stderr.decode('utf-8').split('\n')
ccls_inc_path = []
started = False
for l in s:
if l.endswith('> search starts here:'):
started = True
continue
if not started:
continue
if l.startswith(' '):
ccls_inc_path.append('-isystem' + l[1:])
else:
started = False
with open('.ccls', 'w') as f:
f.write('\n'.join('clang++ -std=c++17 -I. -Ispdlog/include -DCACHE_LINE_SIZE=64'.split(' ') + ccls_inc_path))