optimize build scripts

This commit is contained in:
Neucrack
2025-06-27 19:11:07 +08:00
parent 60c095232a
commit c418da4b50
4 changed files with 7 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ def select_multi_toolchain(board_name, toolchain_info, select_id):
if not "id" in info:
print("Error: id not found in toolchain info of board %s.yaml" % board_name)
sys.exit(1)
if select_id and info['id'] == select_id:
if select_id and (info['id'] == select_id or (select_id == "default" and info.get("default", False))):
return info
print("This platform has multiple toolchains, please select one\n")
default_idx = None

View File

@@ -218,7 +218,7 @@ def parse_args(sdk_path, project_path, extra_tools):
parser_.add_argument('--debug', action="store_true", default=False, help="debug mode, default is release mode")
parser_.add_argument('--build-type', default=None, help="build type, [Debug, Release, MinRelSize, RelWithDebInfo], you can also set build type by CMAKE_BUILD_TYPE environment variable")
parser_.add_argument('-p', "--platform", default="", help="device name, e.g. linux, maixcam, m2dock", choices=get_platforms(sdk_path))
parser_.add_argument('--toolchain-id', default="", help="toolchain id, if platform has multiple toolchains, use this option to select one")
parser_.add_argument('--toolchain-id', default="", help="toolchain id, if platform has multiple toolchains, use this option to select one. Empty will let you select one interactively, 'default' means use the default toolchain defined in platform yaml file.")
add_build_args(parser_build)
add_build_args(parser_build2)

View File

@@ -14,6 +14,7 @@ parser = argparse.ArgumentParser(prog="release", description="release program as
############################### Add option here #############################
parser.add_argument("-p", "--platform", help="Select platforms, use maixcdk build --help to see supported platforms", default="")
parser.add_argument('--toolchain-id', default="", help="toolchain id, if platform has multiple toolchains, use this option to select one. Empty will let you select one interactively, 'default' means use the default toolchain defined in platform yaml file.")
#############################################################################
@@ -46,6 +47,9 @@ def main(vars):
if vars["project_args"].platform:
cmd.append("--platform")
cmd.append(vars["project_args"].platform)
if vars["project_args"].toolchain_id:
cmd.append("--toolchain-id")
cmd.append(vars["project_args"].toolchain_id)
exit_code = subprocess.Popen(cmd).wait()
print("--------- rebuild complete ------------\n")
if exit_code != 0: