[buildcore] Update buildcore

This commit is contained in:
2023-08-24 00:04:24 -05:00
parent 6bd7a84ddd
commit 257389129f
3 changed files with 147 additions and 109 deletions

View File

@ -19,15 +19,33 @@ from pybb import mkdir, rm
os_name = os.uname().sysname.lower()
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument('--target', help='Platform target',
default='{:s}-{:s}'.format(os_name, platform.machine()))
parser.add_argument('--build_type', help='Build type (asan,debug,release)', default='release')
parser.add_argument('--build_tool', help='Build tool (default,xcode)', default='')
parser.add_argument('--build_root', help='Path to the root of build directories (must be in project dir)', default='build')
parser.add_argument('--toolchain', help='Path to CMake toolchain file', default='')
parser.add_argument('--current_build', help='Indicates whether or not to make this the active build', default=1)
parser.add_argument(
'--target',
help='Platform target',
default=f'{os_name}-{platform.machine()}')
parser.add_argument(
'--build_type',
help='Build type (asan,debug,release)',
default='release')
parser.add_argument(
'--build_tool',
help='Build tool (default,xcode)',
default='')
parser.add_argument(
'--build_root',
help='Path to the root build directory (must be in project dir)',
default='build')
parser.add_argument(
'--toolchain',
help='Path to CMake toolchain file',
default='')
parser.add_argument(
'--current_build',
help='Indicates whether or not to make this the active build',
default=1)
args = parser.parse_args()
if args.build_type == 'asan':
@ -65,7 +83,7 @@ def main() -> int:
return 1
project_dir = os.getcwd()
build_dir = '{:s}/{:s}/{:s}'.format(project_dir, args.build_root, build_config)
build_dir = f'{project_dir}/{args.build_root}/{build_config}'
rm(build_dir)
cmake_cmd = [
'cmake', '-S', project_dir, '-B', build_dir, build_tool,
@ -91,7 +109,8 @@ def main() -> int:
rm('compile_commands.json')
if platform.system() != 'Windows':
os.symlink('{:s}/compile_commands.json'.format(build_dir), 'compile_commands.json')
os.symlink(f'{build_dir}/compile_commands.json',
'compile_commands.json')
return 0