SConstruct 2.0 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 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. TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT
  18. env = Environment()
  19. Export('RTT_ROOT')
  20. Export('rtconfig')
  21. libs = Split('''
  22. winmm
  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. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False, remove_components=['rtgui'])
  47. if GetDepend('RT_USING_RTGUI'):
  48. sdl_lib = ['SDL', 'SDLmain']
  49. sdl_lib_path = [os.path.abspath('SDL/lib/x86')]
  50. sdl_include_path = [os.path.abspath('SDL/include')]
  51. env.Append(LIBS=sdl_lib)
  52. env.Append(LIBPATH=sdl_lib_path)
  53. env.Append(CPPPATH=sdl_include_path)
  54. if RTT_RTGUI:
  55. objs += SConscript(os.path.join(RTT_RTGUI, 'SConscript'),
  56. variant_dir='build/components/rtgui',
  57. duplicate=0)
  58. objs = objs + SConscript(RTT_RTGUI+'/../../demo/examples/SConscript',
  59. variant_dir='build/examples/gui', duplicate=0)
  60. else:
  61. objs += SConscript(os.path.join(RTT_ROOT + '/components/rtgui', 'SConscript'),
  62. variant_dir='build/components/rtgui',
  63. duplicate=0)
  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)