| BOOTSTRAP_PHASES = [ | BOOTSTRAP_PHASES = [ | ||||
| 'bootstrap-p1', | 'bootstrap-p1', | ||||
| 'bootstrap-p2', | |||||
| ] | ] | ||||
| HERE = Path(__file__).parent.absolute() | HERE = Path(__file__).parent.absolute() | ||||
| ) | ) | ||||
| def _pull_executable() -> None: | |||||
| def _pull_executable() -> Path: | |||||
| prebuild_dir = (PROJECT_ROOT / '_prebuilt') | prebuild_dir = (PROJECT_ROOT / '_prebuilt') | ||||
| prebuild_dir.mkdir(exist_ok=True) | prebuild_dir.mkdir(exist_ok=True) | ||||
| exe, = list(BOOTSTRAP_DIR.glob('_build/dds*')) | exe, = list(BOOTSTRAP_DIR.glob('_build/dds*')) | ||||
| exe.rename(prebuild_dir / exe.name) | |||||
| dest = prebuild_dir / exe.name | |||||
| exe.rename(dest) | |||||
| return dest | |||||
| def _run_boot_phase(phase: str, args: argparse.Namespace) -> None: | |||||
| def _run_boot_phase(phase: str, args: argparse.Namespace) -> Path: | |||||
| _clone_bootstrap_phase(phase) | _clone_bootstrap_phase(phase) | ||||
| _build_bootstrap_phase(phase, args) | _build_bootstrap_phase(phase, args) | ||||
| _pull_executable() | |||||
| return _pull_executable() | |||||
| def main(argv: Sequence[str]) -> int: | def main(argv: Sequence[str]) -> int: | ||||
| '--cxx', help='The C++ compiler to use for the build', required=True) | '--cxx', help='The C++ compiler to use for the build', required=True) | ||||
| args = parser.parse_args(argv) | args = parser.parse_args(argv) | ||||
| for phase in BOOTSTRAP_PHASES: | for phase in BOOTSTRAP_PHASES: | ||||
| _run_boot_phase(phase, args) | |||||
| exe = _run_boot_phase(phase, args) | |||||
| print(f'A bootstrapped DDS executable has been generated: {exe}') | |||||
| return 0 | return 0 | ||||