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