SConscript 607 B

12345678910111213141516171819202122232425262728
  1. # for module compiling
  2. import os
  3. from building import *
  4. objs = []
  5. def _has(sym: str) -> bool:
  6. try:
  7. return bool(GetDepend([sym]))
  8. except Exception:
  9. return bool(GetDepend(sym))
  10. if not _has('RT_USING_RUST'):
  11. Return('objs')
  12. cwd = GetCurrentDir()
  13. entries = os.listdir(cwd)
  14. for d in entries:
  15. path = os.path.join(cwd, d)
  16. if os.path.isfile(os.path.join(path, 'SConscript')):
  17. result = SConscript(os.path.join(d, 'SConscript'))
  18. if isinstance(result, (list, tuple)):
  19. objs.extend(result)
  20. else:
  21. objs.append(result)
  22. Return('objs')