SConscript 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import sys
  2. import os
  3. from building import *
  4. Import('rtconfig')
  5. cwd = GetCurrentDir()
  6. src = ['board.c', 'uart_console.c']
  7. LIBS = []
  8. LIBPATH = []
  9. CPPPATH = [cwd]
  10. CPPDEFINES = ['RT_USING_LIBC']
  11. if rtconfig.CROSS_TOOL == 'msvc':
  12. CPPDEFINES += \
  13. [
  14. # avoid to conflict with the inherent STDC in VS
  15. '_CRT_DECLARE_NONSTDC_NAMES=0',
  16. # errno macro redefinition
  17. '_CRT_ERRNO_DEFINED',
  18. # avoid time.h conflicts, such as struct timespec, ctime, difftime...
  19. '_CRT_NO_TIME_T',
  20. # disable deprecation of unsafe functions, such as strncpy
  21. '_CRT_SECURE_NO_WARNINGS',
  22. # RT_VESRION conflicts in winuser.h
  23. 'NORESOURCE',
  24. # lean and mean for Windows.h, exclude winsock.h when include Windows.h
  25. # avoid conlicts between sys/select.h, time.h, and winsock.h
  26. # such as fd_set related, struct timeval...
  27. 'WIN32_LEAN_AND_MEAN'
  28. ]
  29. # remove no need file.
  30. if GetDepend('PKG_USING_GUIENGINE') == True:
  31. src += ['sdl_fb.c']
  32. else:
  33. LIBS.append('SDL2')
  34. if sys.platform == 'win32':
  35. LIBPATH.append(os.path.abspath(os.path.join(cwd, '../SDL2/lib/x86')))
  36. CPPPATH.append(os.path.abspath(os.path.join(cwd, '../SDL2/include')))
  37. if GetDepend('RT_USING_DFS') == True:
  38. if GetDepend('RT_USING_DFS_ELMFAT') == True:
  39. src += ['sd_sim.c']
  40. if GetDepend('RT_USING_MTD_NAND') == True:
  41. src += ['nanddrv_file.c']
  42. if GetDepend('RT_USING_MTD_NOR') == True:
  43. src += ['sst25vfxx_mtd_sim.c']
  44. if sys.platform == "win32":
  45. if GetDepend('RT_USING_DFS_WINSHAREDIR') == True:
  46. src += ['dfs_win32.c']
  47. if GetDepend('RT_USING_MODULE') == True:
  48. src += ['module_win32.c']
  49. if GetDepend('BSP_USING_RTC') == True:
  50. src += ['drv_rtc.c']
  51. if GetDepend('BSP_USING_SOCKET') == True:
  52. src += [cwd + '/winsock/drv_win_eth.c']
  53. src += [cwd + '/winsock/sal_winsock.c']
  54. group = DefineGroup('Drivers', src, depend = [''],
  55. CPPPATH = CPPPATH, LIBS=LIBS, LIBPATH=LIBPATH, CPPDEFINES=CPPDEFINES)
  56. list = os.listdir(cwd)
  57. for item in list:
  58. if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
  59. group = group + SConscript(os.path.join(item, 'SConscript'))
  60. Return('group')