Support -j flag in xenia-build

This commit is contained in:
DrChat 2017-12-19 19:25:25 -06:00
parent db34128b95
commit 0efb08ad74
1 changed files with 8 additions and 2 deletions

View File

@ -576,6 +576,8 @@ class BaseBuildCommand(Command):
self.parser.add_argument( self.parser.add_argument(
'--no_premake', action='store_true', '--no_premake', action='store_true',
help='Skips running premake before building.') help='Skips running premake before building.')
self.parser.add_argument(
'-j', default=0, type=int, help='Number of parallel threads')
def execute(self, args, pass_args, cwd): def execute(self, args, pass_args, cwd):
if not args['no_premake']: if not args['no_premake']:
@ -583,6 +585,10 @@ class BaseBuildCommand(Command):
run_platform_premake() run_platform_premake()
print('') print('')
threads = args['j']
if threads < 0:
threads = 0
print('- building (%s):%s...' % ( print('- building (%s):%s...' % (
'all' if not len(args['target']) else ', '.join(args['target']), 'all' if not len(args['target']) else ', '.join(args['target']),
args['config'])) args['config']))
@ -615,10 +621,10 @@ class BaseBuildCommand(Command):
result = subprocess.call([ result = subprocess.call([
'make', 'make',
'-j', '-j' if threads is 0 else '-j%d' % threads,
'-Cbuild/', '-Cbuild/',
'config=%s_linux' % (args['config']), 'config=%s_linux' % (args['config']),
] + pass_args + args['target'], shell=False) ] + pass_args + args['target'], shell=False, env=dict(os.environ))
print('') print('')
if result != 0: if result != 0:
print('ERROR: build failed with one or more errors.') print('ERROR: build failed with one or more errors.')