xenia-build improvements

Add -j to speed up getting submodules.
Add newer clang-format.
This commit is contained in:
Margen67
2025-01-05 16:08:38 -08:00
parent affb2fb7af
commit fff79eb41d

View File

@@ -423,6 +423,8 @@ def git_submodule_update():
'submodule', 'submodule',
'update', 'update',
'--init', '--init',
'-j', str(os.cpu_count()),
#'--depth 1', # This doesn't work for some reason
]) ])
@@ -433,14 +435,20 @@ def get_clang_format_binary():
A path to the clang-format executable. A path to the clang-format executable.
""" """
attempts = [ attempts = [
'C:\\Program Files\\LLVM\\bin\\clang-format.exe', 'clang-format-19',
'C:\\Program Files (x86)\\LLVM\\bin\\clang-format.exe', 'clang-format-18',
'clang-format-17',
'clang-format-16',
'clang-format-15',
'clang-format-14', 'clang-format-14',
'clang-format-13', 'clang-format-13',
'clang-format', 'clang-format',
] ]
if 'VCINSTALLDIR' in os.environ: if sys.platform == 'win32':
attempts.append(os.path.join(os.environ['VCINSTALLDIR'], 'Tools', 'Llvm', 'bin', 'clang-format.exe')) attempts.append(os.path.join(os.environ['ProgramFiles'], 'LLVM', 'bin', 'clang-format.exe'))
attempts.append(os.path.join(os.environ['ProgramFiles(x86)'], 'LLVM', 'bin', 'clang-format.exe'))
if 'VCINSTALLDIR' in os.environ:
attempts.append(os.path.join(os.environ['VCINSTALLDIR'], 'Tools', 'Llvm', 'bin', 'clang-format.exe'))
for binary in attempts: for binary in attempts:
if has_bin(binary): if has_bin(binary):
return binary return binary
@@ -698,7 +706,7 @@ class PullCommand(Command):
*args, **kwargs) *args, **kwargs)
self.parser.add_argument( self.parser.add_argument(
'--merge', action='store_true', '--merge', action='store_true',
help='Merges on master instead of rebasing.') help='Merges on canary-experimental instead of rebasing.')
self.parser.add_argument( self.parser.add_argument(
'--target_os', default=None, '--target_os', default=None,
help='Target OS passed to premake, for cross-compilation') help='Target OS passed to premake, for cross-compilation')
@@ -707,11 +715,11 @@ class PullCommand(Command):
print('Pulling...') print('Pulling...')
print('') print('')
print('- switching to master...') print('- switching to canary-experimental...')
shell_call([ shell_call([
'git', 'git',
'checkout', 'checkout',
'master', 'canary-experimental',
]) ])
print('') print('')
@@ -791,7 +799,7 @@ class BaseBuildCommand(Command):
'--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( self.parser.add_argument(
'-j', default=4, type=int, help='Number of parallel threads') '-j', default=os.cpu_count(), 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']:
@@ -1327,7 +1335,7 @@ class GpuTestCommand(BaseBuildCommand):
help='Create reference files for new traces.') help='Create reference files for new traces.')
def execute(self, args, pass_args, cwd): def execute(self, args, pass_args, cwd):
print('Testinging...') print('Testing...')
print('') print('')
# The test executables that will be built and run. # The test executables that will be built and run.
@@ -1431,12 +1439,12 @@ class NukeCommand(Command):
shutil.rmtree('build/') shutil.rmtree('build/')
print('') print('')
print('- git reset to master...') print('- git reset to canary-experimental...')
shell_call([ shell_call([
'git', 'git',
'reset', 'reset',
'--hard', '--hard',
'master', 'canary-experimental',
]) ])
print('') print('')