2013-06-24 11:36:38 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2016-05-10 06:44:56 +03:00
|
|
|
from lib.config import get_target_arch
|
2016-05-25 19:10:46 +03:00
|
|
|
from lib.util import electron_gyp, import_vs_env
|
2015-04-12 16:52:56 +03:00
|
|
|
|
2013-06-24 11:36:38 +04:00
|
|
|
|
|
|
|
CONFIGURATIONS = ['Release', 'Debug']
|
2014-05-14 03:07:26 +04:00
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
2013-06-24 11:36:38 +04:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2013-07-07 12:25:50 +04:00
|
|
|
os.chdir(SOURCE_ROOT)
|
|
|
|
|
2016-05-10 06:44:56 +03:00
|
|
|
# Update the VS build env.
|
|
|
|
import_vs_env(get_target_arch())
|
|
|
|
|
2013-07-07 12:25:50 +04:00
|
|
|
ninja = os.path.join('vendor', 'depot_tools', 'ninja')
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
ninja += '.exe'
|
|
|
|
|
2013-06-24 11:36:38 +04:00
|
|
|
args = parse_args()
|
|
|
|
for config in args.configuration:
|
2015-04-03 06:59:14 +03:00
|
|
|
build_path = os.path.join('out', config[0])
|
2014-08-08 19:23:56 +04:00
|
|
|
ret = subprocess.call([ninja, '-C', build_path, args.target])
|
|
|
|
if ret != 0:
|
|
|
|
sys.exit(ret)
|
2013-06-24 11:36:38 +04:00
|
|
|
|
|
|
|
|
|
|
|
def parse_args():
|
2015-04-12 16:52:56 +03:00
|
|
|
parser = argparse.ArgumentParser(description='Build project')
|
2013-06-24 11:36:38 +04:00
|
|
|
parser.add_argument('-c', '--configuration',
|
|
|
|
help='Build with Release or Debug configuration',
|
|
|
|
nargs='+',
|
|
|
|
default=CONFIGURATIONS,
|
|
|
|
required=False)
|
2013-08-31 13:00:13 +04:00
|
|
|
parser.add_argument('-t', '--target',
|
|
|
|
help='Build specified target',
|
2016-05-25 19:10:46 +03:00
|
|
|
default=electron_gyp()['project_name%'],
|
2013-08-31 13:00:13 +04:00
|
|
|
required=False)
|
2013-06-24 11:36:38 +04:00
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|