Ejemplo n.º 1
0
def invoke_ninja(args, dirs, stage):
    """
    Invoke ninja to run the actual build
    :param args: The args variable generated by parse_parameters
    :param dirs: An instance of the Directories class with the paths to use
    :return:
    """
    utils.print_header("Building LLVM stage %d" % stage)

    if stage == 1:
        build_folder = dirs.stage1_folder
        install_folder = None
    else:
        build_folder = dirs.build_folder
        install_folder = dirs.install_folder

    time_started = time.time()

    subprocess.run('ninja', check=True, cwd=build_folder.as_posix())

    print()
    print("LLVM build duration: " +
          str(datetime.timedelta(seconds=int(time.time() - time_started))))

    if install_folder is not None:
        subprocess.run(['ninja', 'install'],
                       check=True,
                       cwd=build_folder.as_posix(),
                       stdout=subprocess.DEVNULL,
                       stderr=subprocess.DEVNULL)

        utils.create_gitignore(install_folder)
Ejemplo n.º 2
0
def invoke_ninja(args, dirs, stage):
    """
    Invoke ninja to run the actual build
    :param args: The args variable generated by parse_parameters
    :param dirs: An instance of the Directories class with the paths to use
    :param stage: The current stage we're building
    :return:
    """
    utils.print_header("Building LLVM stage %d" % stage)

    build_folder = dirs.build_folder.joinpath("stage%d" % stage)

    install_folder = None
    if should_install_toolchain(args, stage):
        install_folder = dirs.install_folder
    elif stage == 1 and args.build_stage1_only and not args.install_stage1_only:
        install_folder = build_folder

    build_folder = build_folder.as_posix()

    time_started = time.time()

    subprocess.run('ninja', check=True, cwd=build_folder)

    if args.check_targets and stage == get_final_stage(args):
        subprocess.run(['ninja'] +
                       ['check-%s' % s for s in args.check_targets],
                       check=True,
                       cwd=build_folder)

    print()
    print("LLVM build duration: " +
          str(datetime.timedelta(seconds=int(time.time() - time_started))))

    if should_install_toolchain(args, stage):
        subprocess.run(['ninja', 'install'],
                       check=True,
                       cwd=build_folder,
                       stdout=subprocess.DEVNULL,
                       stderr=subprocess.DEVNULL)

        utils.create_gitignore(install_folder)

    if install_folder is not None:
        print_install_info(install_folder)