SConscript 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # RT-Thread building script for component
  2. import os
  3. Import('RTT_ROOT')
  4. from building import *
  5. cwd = GetCurrentDir()
  6. objs = []
  7. list = os.listdir(cwd)
  8. src = Glob('*.c') + Glob('*.cpp')
  9. CPPPATH = [cwd]
  10. group = []
  11. # USB driver constrain
  12. if GetDepend('BOARD_USING_HSUSBD') and ( GetDepend('BSP_USING_USBD') or GetDepend('BSP_USING_HSUSBH') or GetDepend('BSP_USING_HSOTG') ):
  13. print ('Sorry, wrong selection.')
  14. print ('[Hint] You already select BOARD_USING_HSUSBD. Please de-select BSP_USING_USBD, BSP_USING_HSUSBH and BSP_USING_HSOTG options.')
  15. sys.exit(1)
  16. elif GetDepend('BOARD_USING_HSUSBD_USBH') and ( GetDepend('BSP_USING_USBD') or GetDepend('BSP_USING_HSUSBH') or GetDepend('BSP_USING_HSOTG') ):
  17. print ('Sorry, wrong selection.')
  18. print ('[Hint] You already select BOARD_USING_HSUSBD_USBH. Please de-select BSP_USING_USBD, BSP_USING_HSUSBH and BSP_USING_HSOTG options.')
  19. sys.exit(1)
  20. elif GetDepend('BOARD_USING_HSUSBH') and ( GetDepend('BSP_USING_USBH') or GetDepend('BSP_USING_HSUSBD') or GetDepend('BSP_USING_HSOTG') ):
  21. print ('Sorry, wrong selection.')
  22. print ('[Hint] You already select BOARD_USING_HSUSBH. Please de-select BSP_USING_USBH, BSP_USING_HSUSBD and BSP_USING_HSOTG options.')
  23. sys.exit(1)
  24. elif GetDepend('BOARD_USING_HSUSBH_USBD') and ( GetDepend('BSP_USING_USBH') or GetDepend('BSP_USING_HSUSBD') or GetDepend('BSP_USING_HSOTG') ):
  25. print ('Sorry, wrong selection.')
  26. print ('[Hint] You already select BOARD_USING_HSUSBH_USBD. Please de-select BSP_USING_USBH, BSP_USING_HSUSBD and BSP_USING_HSOTG options.')
  27. sys.exit(1)
  28. elif GetDepend('BOARD_USING_HSOTG') and ( GetDepend('BSP_USING_USBD') or GetDepend('BSP_USING_USBH') ):
  29. print ('Sorry, wrong selection.')
  30. print ('[Hint] You already select BOARD_USING_HSOTG. Please de-select BSP_USING_USBD and BSP_USING_USBH options.')
  31. sys.exit(1)
  32. else:
  33. group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
  34. for d in list:
  35. path = os.path.join(cwd, d)
  36. if os.path.isfile(os.path.join(path, 'SConscript')):
  37. objs = objs + SConscript(os.path.join(d, 'SConscript'))
  38. objs += group
  39. Return('objs')