SConscript 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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('assets')
  23. myremove('docker')
  24. myremove('bsp')
  25. myremove('document')
  26. myremove('examples')
  27. myremove('package')
  28. myremove('port')
  29. myremove('src')
  30. myremove('test')
  31. myremove('tools')
  32. myremove('.github')
  33. myremove('.git')
  34. myremove('.vscode')
  35. myremove('.gitattributes')
  36. myremove('.gitignore')
  37. myremove('logo.txt')
  38. myremove('packages.toml')
  39. os.system(cwd + '/' + 'pikaPackage.exe')
  40. os.system(cwd + '/' + 'rust-msc-latest-win10.exe')
  41. # init pikascript
  42. pikascript_init()
  43. # init argument
  44. cwd = GetCurrentDir()
  45. group = []
  46. src = []
  47. inc = []
  48. # add file and path
  49. for root, dirs, files in os.walk(cwd):
  50. for dir in dirs:
  51. print(dir)
  52. src = Glob(os.path.join(root,dir,'*.c'))
  53. inc = [os.path.join(root,dir)]
  54. group += DefineGroup(dir, src, depend = ['PKG_USING_PIKASCRIPT'], CPPPATH = inc)
  55. Return('group')