SConstruct 2.1 KB

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