SConscript 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # RT-Thread building script for bridge
  2. import os, shutil
  3. import subprocess
  4. from building import *
  5. def pikascript_init():
  6. cwd = GetCurrentDir()
  7. def mycopyfile(srcfile,dstfile):
  8. if not os.path.isfile(srcfile):
  9. pass
  10. else:
  11. fpath,fname=os.path.split(dstfile)
  12. if not os.path.exists(fpath):
  13. os.makedirs(fpath)
  14. shutil.copyfile(srcfile,dstfile)
  15. mycopyfile(cwd + '/port/rt-thread/main.py', cwd + '/main.py')
  16. mycopyfile(cwd + '/port/rt-thread/pikaPackage.exe', cwd + '/pikaPackage.exe')
  17. mycopyfile(cwd + '/port/rt-thread/requestment.txt', cwd + '/requestment.txt')
  18. def myremove(path):
  19. all_path = cwd + '\\' + path
  20. os.popen('del ' + all_path + ' /F /Q /S')
  21. os.popen('rd ' + all_path + ' /Q /S')
  22. myremove('bsp')
  23. myremove('document')
  24. myremove('examples')
  25. myremove('package')
  26. myremove('port')
  27. myremove('src')
  28. myremove('tools')
  29. myremove('.github')
  30. myremove('.git')
  31. myremove('.vscode')
  32. myremove('.gitattributes')
  33. myremove('.gitignore')
  34. myremove('logo.txt')
  35. myremove('packages.toml')
  36. os.system(cwd + '/' + 'pikaPackage.exe')
  37. os.system(cwd + '/' + 'rust-msc-latest-win10.exe')
  38. # init pikascript
  39. pikascript_init()
  40. # init argument
  41. cwd = GetCurrentDir()
  42. group = []
  43. src = []
  44. inc = []
  45. # add file and path
  46. for root, dirs, files in os.walk(cwd):
  47. for dir in dirs:
  48. src = src + Glob(os.path.join(root,dir,'*.c'))
  49. inc = inc + [os.path.join(root,dir)]
  50. group = DefineGroup('pikascript', src, depend = ['PKG_USING_PIKASCRIPT'], CPPPATH = inc)
  51. Return('group')