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