SConstruct 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. if os.getenv('RTT_RTGUI'):
  9. RTT_RTGUI = os.getenv('RTT_RTGUI')
  10. else:
  11. # set the rtgui root directory by hand
  12. # empty string means use the RTGUI in svn
  13. # RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui')
  14. RTT_RTGUI =''
  15. sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
  16. from building import *
  17. env = Environment()
  18. Export('RTT_ROOT')
  19. Export('rtconfig')
  20. if rtconfig.PLATFORM == 'cl':
  21. TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT
  22. libs = Split('''
  23. winmm
  24. gdi32
  25. winspool
  26. comdlg32
  27. advapi32
  28. shell32
  29. ole32
  30. oleaut32
  31. uuid
  32. odbc32
  33. odbccp32
  34. ''')
  35. definitions = Split('''
  36. WIN32
  37. _DEBUG
  38. _CONSOLE
  39. MSVC
  40. _TIME_T_DEFINED
  41. ''')
  42. env.Append(CCFLAGS=rtconfig.CFLAGS)
  43. env.Append(LINKFLAGS=rtconfig.LFLAGS)
  44. env['LIBS']=libs
  45. env['CPPDEFINES']=definitions
  46. else:
  47. TARGET = 'rtthread'
  48. env.Append(CCFLAGS=rtconfig.CFLAGS)
  49. env.Append(LINKFLAGS=rtconfig.LFLAGS)
  50. env.Append(LIBS=['m'])
  51. # prepare building environment
  52. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False, remove_components=['rtgui'])
  53. if GetDepend('RT_USING_RTGUI'):
  54. sdl_lib = ['SDL', 'SDLmain']
  55. sdl_lib_path = [os.path.abspath('SDL/lib/x86')]
  56. sdl_include_path = [os.path.abspath('SDL/include')]
  57. env.Append(LIBS=sdl_lib)
  58. env.Append(LIBPATH=sdl_lib_path)
  59. env.Append(CPPPATH=sdl_include_path)
  60. if RTT_RTGUI:
  61. objs += SConscript(os.path.join(RTT_RTGUI, 'SConscript'),
  62. variant_dir='build/components/rtgui',
  63. duplicate=0)
  64. objs = objs + SConscript(RTT_RTGUI+'/../../demo/examples/SConscript',
  65. variant_dir='build/examples/gui', duplicate=0)
  66. else:
  67. objs += SConscript(os.path.join(RTT_ROOT + '/components/rtgui', 'SConscript'),
  68. variant_dir='build/components/rtgui',
  69. duplicate=0)
  70. objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript',
  71. variant_dir='build/examples/gui', duplicate=0)
  72. if GetDepend('RT_USING_TC'):
  73. objs = objs + SConscript(RTT_ROOT + '/examples/kernel/SConscript', variant_dir = 'build/tc/kernel', duplicate=0)
  74. # build program
  75. program = env.Program(TARGET, objs)
  76. # end building
  77. EndBuilding(TARGET, program)