SConstruct 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 you want use the rtgui in the svn (in google code), you should
  9. # comment the following line
  10. RTT_RTGUI = os.path.normpath('F:/Project/git/rt-gui')
  11. #RTT_RTGUI =''
  12. sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
  13. from building import *
  14. TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT
  15. env = Environment()
  16. Export('RTT_ROOT')
  17. Export('rtconfig')
  18. libs = Split('''
  19. kernel32
  20. msvcrt
  21. winmm
  22. user32
  23. gdi32
  24. winspool
  25. comdlg32
  26. advapi32
  27. shell32
  28. ole32
  29. oleaut32
  30. uuid
  31. odbc32
  32. odbccp32
  33. ''')
  34. definitions = Split('''
  35. WIN32
  36. _DEBUG
  37. _CONSOLE
  38. MSVC
  39. _TIME_T_DEFINED
  40. ''')
  41. env.Append(CCFLAGS=rtconfig.CFLAGS)
  42. env.Append(LINKFLAGS=rtconfig.LFLAGS)
  43. env['LIBS']=libs
  44. env['CPPDEFINES']=definitions
  45. # prepare building environment
  46. if RTT_RTGUI:
  47. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False, remove_components=['rtgui'])
  48. objs += SConscript(os.path.join(RTT_RTGUI + '/components/rtgui', 'SConscript'),
  49. variant_dir='build/components/rtgui',
  50. duplicate=0)
  51. else:
  52. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  53. if GetDepend('RT_USING_RTGUI'):
  54. sdl_lib = ['SDL', 'SDLmain']
  55. sdl_lib_path = os.path.normpath('SDL/lib/x86')
  56. sdl_include_path = os.path.normpath('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 = objs + SConscript(RTT_RTGUI+'/demo/examples/SConscript',
  62. variant_dir='build/examples/gui', duplicate=0)
  63. else:
  64. objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript',
  65. variant_dir='build/examples/gui', duplicate=0)
  66. # build program
  67. env.Program(TARGET, objs)
  68. # end building
  69. EndBuilding(TARGET)