SConscript 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import sys
  2. import os
  3. from building import *
  4. Import('rtconfig')
  5. cwd = GetCurrentDir()
  6. src = Glob('*.c')
  7. LIBS = []
  8. LIBPATH = []
  9. CPPPATH = [cwd]
  10. CPPDEFINES = []
  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') == False:
  31. SrcRemove(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') == False or GetDepend('RT_USING_DFS_ELMFAT') == False:
  38. SrcRemove(src, 'sd_sim.c')
  39. if GetDepend('RT_USING_DFS') == False or GetDepend('RT_USING_MTD_NAND') == False:
  40. SrcRemove(src, 'nanddrv_file.c')
  41. if GetDepend('RT_USING_DFS') == False or GetDepend('RT_USING_MTD_NOR') == False:
  42. SrcRemove(src, 'sst25vfxx_mtd_sim.c')
  43. if GetDepend('RT_USING_DFS') == False or GetDepend('RT_USING_DFS_WINSHAREDIR') == False:
  44. SrcRemove(src, 'dfs_win32.c')
  45. if GetDepend('RT_USING_DFS') == False or GetDepend('RT_USING_MODULE') == False:
  46. SrcRemove(src, ['module_win32.c'])
  47. if sys.platform[0:5]=="linux": #check whether under linux
  48. SrcRemove(src, ['module_win32.c', 'dfs_win32.c'])
  49. group = DefineGroup('Drivers', src, depend = [''],
  50. CPPPATH = CPPPATH, LIBS=LIBS, LIBPATH=LIBPATH, CPPDEFINES=CPPDEFINES)
  51. list = os.listdir(cwd)
  52. for item in list:
  53. if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
  54. group = group + SConscript(os.path.join(item, 'SConscript'))
  55. Return('group')