SConstruct 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import os
  2. import sys
  3. import SCons.cpp
  4. import rtconfig
  5. if os.getenv('RTT_ROOT'):
  6. RTT_ROOT = os.getenv('RTT_ROOT')
  7. else:
  8. RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
  9. if os.getenv('RTT_RTGUI'):
  10. RTT_RTGUI = os.getenv('RTT_RTGUI')
  11. else:
  12. # set the rtgui root directory by hand
  13. # empty string means use the RTGUI in svn
  14. RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui')
  15. # RTT_RTGUI =''
  16. sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
  17. from building import *
  18. Export('RTT_ROOT')
  19. # add target option
  20. AddOption('--app',
  21. dest='app',
  22. nargs=1, type='string',
  23. action='store',
  24. metavar='DIR',
  25. help='installation prefix')
  26. # add target option
  27. AddOption('--type',
  28. dest='type',
  29. nargs=1, type='string',
  30. action='store',
  31. metavar='DIR',
  32. help='installation prefix')
  33. app = GetOption('app')
  34. env = Environment(TARGET_ARCH='x86')
  35. CPPPATH = [
  36. RTT_ROOT + '/include',
  37. RTT_ROOT + '/bsp/' + rtconfig.BSP,
  38. RTT_ROOT + '/components/finsh',
  39. RTT_ROOT + '/components/libdl',
  40. RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread',
  41. RTT_ROOT + '/components/external/ftk/ftk/src/demos',
  42. RTT_ROOT + '/components/external/ftk/ftk/apps/common',
  43. RTT_ROOT + '/components/external/ftk/ftk/src',
  44. RTT_ROOT + '/components/dfs',
  45. RTT_ROOT + '/components/dfs/include',
  46. RTT_ROOT + '/components/libc/newlib',
  47. RTT_ROOT + '/components/external/cairo/cairo-1.10.2/src',
  48. RTT_ROOT + '/components/external/cairo/'
  49. ]
  50. if RTT_RTGUI:
  51. RTGUI_ROOT = RTT_RTGUI
  52. else:
  53. RTGUI_ROOT = RTT_ROOT + '/components/rtgui'
  54. RTGUI_PATH = [
  55. RTGUI_ROOT + '/include',
  56. RTGUI_ROOT + '/common',
  57. RTGUI_ROOT + '/server',
  58. RTGUI_ROOT + '/widgets',
  59. ]
  60. CPPPATH += RTGUI_PATH
  61. env.Append(CCFLAGS=rtconfig.CFLAGS)
  62. env.Append(LINKFLAGS=rtconfig.LFLAGS)
  63. env.Append(CPPPATH=CPPPATH)
  64. env.Append(LIBS='rtthread', LIBPATH='../')
  65. env.Append(CPPDEFINES=['RTT_IN_MODULE'])
  66. env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
  67. PrepareModuleBuilding(env, RTT_ROOT)
  68. #dir = app + '/build/' + rtconfig.BSP
  69. dir = app + '/build/'
  70. objs = SConscript(app + '/Sconscript', variant_dir=dir, duplicate=0)
  71. TARGET = dir + '/' + app + '.' + rtconfig.TARGET_EXT
  72. # build program
  73. #env.Program(TARGET, objs)
  74. env.SharedLibrary(TARGET, objs)