[buildcore] Update buildcore

This commit is contained in:
2023-08-25 00:12:40 -05:00
parent 257389129f
commit 84e82b224b
3 changed files with 97 additions and 101 deletions

View File

@ -15,9 +15,7 @@ import shutil
import subprocess
import sys
from pybb import mkdir, rm
os_name = os.uname().sysname.lower()
import util
def main() -> int:
@ -25,7 +23,7 @@ def main() -> int:
parser.add_argument(
'--target',
help='Platform target',
default=f'{os_name}-{platform.machine()}')
default=f'{util.get_os()}-{util.get_arch()}')
parser.add_argument(
'--build_type',
help='Build type (asan,debug,release)',
@ -84,7 +82,7 @@ def main() -> int:
project_dir = os.getcwd()
build_dir = f'{project_dir}/{args.build_root}/{build_config}'
rm(build_dir)
util.rm(build_dir)
cmake_cmd = [
'cmake', '-S', project_dir, '-B', build_dir, build_tool,
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
@ -101,13 +99,13 @@ def main() -> int:
subprocess.run(cmake_cmd)
mkdir('dist')
util.mkdir_p('dist')
if int(args.current_build) != 0:
cb = open('.current_build', 'w')
cb.write(args.build_type)
cb.close()
rm('compile_commands.json')
util.rm('compile_commands.json')
if platform.system() != 'Windows':
os.symlink(f'{build_dir}/compile_commands.json',
'compile_commands.json')