forked from ycm-core/ycmd
-
Notifications
You must be signed in to change notification settings - Fork 3
/
benchmark.py
executable file
·47 lines (32 loc) · 1.08 KB
/
benchmark.py
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
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
import argparse
import platform
import os
import os.path as p
import subprocess
import sys
DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) )
def ParseArguments():
parser = argparse.ArgumentParser()
parser.add_argument( '--msvc', type = int, choices = [ 15, 16, 17 ],
default = 16, help = 'Choose the Microsoft Visual '
'Studio version (default: %(default)s).' )
return parser.parse_known_args()
def BuildYcmdLibsAndRunBenchmark( args, extra_args ):
build_cmd = [
sys.executable,
p.join( DIR_OF_THIS_SCRIPT, 'build.py' ),
] + extra_args
os.environ[ 'YCM_BENCHMARK' ] = '1'
if args.msvc and platform.system() == 'Windows':
build_cmd.extend( [ '--msvc', str( args.msvc ) ] )
subprocess.check_call( build_cmd )
def Main():
args, extra_args = ParseArguments()
BuildYcmdLibsAndRunBenchmark( args, extra_args )
if __name__ == "__main__":
Main()