SConstruct 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import os
  2. import sys
  3. import rtconfig
  4. if os.getenv('RTT_ROOT'):
  5. RTT_ROOT = os.getenv('RTT_ROOT')
  6. else:
  7. RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
  8. sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
  9. from building import *
  10. TARGET = 'rtthread-lpc176x.' + rtconfig.TARGET_EXT
  11. env = Environment(tools = ['mingw'],
  12. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  13. CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
  14. AR = rtconfig.AR, ARFLAGS = '-rc',
  15. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
  16. Export('RTT_ROOT')
  17. Export('rtconfig')
  18. # prepare building environment
  19. objs = PrepareBuilding(env, RTT_ROOT)
  20. if GetDepend('RT_USING_WEBSERVER'):
  21. objs = objs + SConscript(RTT_ROOT + '/components/net/webserver/SConscript', variant_dir='build/net/webserver', duplicate=0)
  22. if GetDepend('RT_USING_RTGUI'):
  23. objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
  24. cwd = str(Dir('#'))
  25. list = os.listdir(cwd)
  26. for d in list:
  27. path = os.path.join(cwd, d)
  28. if os.path.isfile(os.path.join(path, 'SConscript')):
  29. objs = objs + SConscript(os.path.join(d, 'SConscript'))
  30. # libc testsuite
  31. # objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
  32. # build program
  33. env.Program(TARGET, objs)
  34. # end building
  35. EndBuilding(TARGET)