SConstruct 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. try:
  10. from building import *
  11. except:
  12. print('Cannot found RT-Thread root directory, please check RTT_ROOT')
  13. print(RTT_ROOT)
  14. exit(-1)
  15. TARGET = 'rtthread.' + rtconfig.TARGET_EXT
  16. DefaultEnvironment(tools=[])
  17. if rtconfig.PLATFORM == 'armcc':
  18. env = Environment(tools = ['mingw'],
  19. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  20. CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
  21. CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
  22. AR = rtconfig.AR, ARFLAGS = '-rc',
  23. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
  24. # overwrite cflags, because cflags has '--C99'
  25. CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES')
  26. else:
  27. env = Environment(tools = ['mingw'],
  28. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  29. CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
  30. CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
  31. AR = rtconfig.AR, ARFLAGS = '-rc',
  32. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
  33. CXXCOM = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES')
  34. env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
  35. if rtconfig.PLATFORM == 'iar':
  36. env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
  37. env.Replace(ARFLAGS = [''])
  38. env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map')
  39. Export('RTT_ROOT')
  40. Export('rtconfig')
  41. # prepare building environment
  42. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  43. objs = objs + SConscript('../libraries/drivers/SConscript')
  44. objs = objs + SConscript('../libraries/MIMXRT1064/SConscript')
  45. # make a building
  46. DoBuilding(TARGET, objs)