Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

build.py 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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.dds'
  27. else:
  28. tc_fpath = ROOT / 'tools/gcc-9.dds'
  29. self_build(dds_exe, toolchain=str(tc_fpath))
  30. return 0
  31. if __name__ == "__main__":
  32. sys.exit(main(sys.argv[1:]))