SConstruct 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. if rtconfig.PLATFORM == 'armcc':
  17. env = Environment(tools = ['mingw'],
  18. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  19. CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
  20. CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
  21. AR = rtconfig.AR, ARFLAGS = '-rc',
  22. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
  23. # overwrite cflags, because cflags has '--C99'
  24. CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES')
  25. else:
  26. env = Environment(tools = ['mingw'],
  27. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  28. CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
  29. CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
  30. AR = rtconfig.AR, ARFLAGS = '-rc',
  31. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
  32. CXXCOM = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES')
  33. env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
  34. if rtconfig.PLATFORM == 'iar':
  35. env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
  36. env.Replace(ARFLAGS = [''])
  37. env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map')
  38. Export('RTT_ROOT')
  39. Export('rtconfig')
  40. SDK_ROOT = os.path.abspath('./')
  41. if os.path.exists(SDK_ROOT + '/Libraries'):
  42. libraries_path_prefix = SDK_ROOT + '/Libraries'
  43. else:
  44. libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/Libraries'
  45. SDK_LIB = libraries_path_prefix
  46. Export('SDK_LIB')
  47. # prepare building environment
  48. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  49. objs = objs + SConscript('../Libraries/drivers/SConscript')
  50. objs = objs + SConscript('../Libraries/LPC55S6X/SConscript')
  51. # make a building
  52. DoBuilding(TARGET, objs)