From 0efb08ad7462c09b7002e5571b058cb5f757d580 Mon Sep 17 00:00:00 2001 From: DrChat Date: Tue, 19 Dec 2017 19:25:25 -0600 Subject: [PATCH] Support -j flag in xenia-build --- xenia-build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xenia-build b/xenia-build index b3847a5d5..f438dbb2f 100755 --- a/xenia-build +++ b/xenia-build @@ -576,6 +576,8 @@ class BaseBuildCommand(Command): self.parser.add_argument( '--no_premake', action='store_true', 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): if not args['no_premake']: @@ -583,6 +585,10 @@ class BaseBuildCommand(Command): run_platform_premake() print('') + threads = args['j'] + if threads < 0: + threads = 0 + print('- building (%s):%s...' % ( 'all' if not len(args['target']) else ', '.join(args['target']), args['config'])) @@ -615,10 +621,10 @@ class BaseBuildCommand(Command): result = subprocess.call([ 'make', - '-j', + '-j' if threads is 0 else '-j%d' % threads, '-Cbuild/', 'config=%s_linux' % (args['config']), - ] + pass_args + args['target'], shell=False) + ] + pass_args + args['target'], shell=False, env=dict(os.environ)) print('') if result != 0: print('ERROR: build failed with one or more errors.')