選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

build.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env python3
  2. import argparse
  3. import os
  4. from pathlib import Path
  5. from typing import Sequence
  6. import sys
  7. import shutil
  8. from dds_ci import paths
  9. from self_build import self_build
  10. ROOT = Path(__file__).parent.parent.absolute()
  11. BUILD_DIR = ROOT / '_build'
  12. def main(argv: Sequence[str]) -> int:
  13. # Prior versions of this script took a --cxx argument, but we don't care anymore
  14. parser = argparse.ArgumentParser()
  15. parser.add_argument('--cxx', help=argparse.SUPPRESS)
  16. parser.parse_args(argv)
  17. dds_bootstrap_env_key = 'DDS_BOOTSTRAP_PREV_EXE'
  18. if dds_bootstrap_env_key not in os.environ:
  19. raise RuntimeError('A previous-phase bootstrapped executable '
  20. 'must be available via $DDS_BOOTSTRAP_PREV_EXE')
  21. dds_exe = Path(os.environ[dds_bootstrap_env_key])
  22. if BUILD_DIR.exists():
  23. shutil.rmtree(BUILD_DIR)
  24. print(f'Using previously built DDS executable: {dds_exe}')
  25. if os.name == 'nt':
  26. tc_fpath = ROOT / 'tools/msvc.jsonc'
  27. elif sys.platform.startswith('freebsd'):
  28. tc_fpath = ROOT / 'tools/freebsd-gcc-9.jsonc'
  29. else:
  30. tc_fpath = ROOT / 'tools/gcc-9.jsonc'
  31. self_build(dds_exe, toolchain=str(tc_fpath))
  32. return 0
  33. if __name__ == "__main__":
  34. sys.exit(main(sys.argv[1:]))