SConstruct 2.1 KB
Newer Older
1 2 3 4 5 6 7 8 9
import os
import sys
import rtconfig

if os.getenv('RTT_ROOT'):
    RTT_ROOT = os.getenv('RTT_ROOT')
else:
    RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')

10 11
# if you want use the rtgui in the svn (in google code), you should
# comment the following line
G
goprife@gmail.com 已提交
12 13 14 15 16 17 18
if os.getenv('RTT_RTGUI'):
    RTT_RTGUI = os.getenv('RTT_RTGUI')
else:
    # set the rtgui root directory by hand
    # empty string means use the RTGUI in svn
    #RTT_RTGUI = os.path.normpath('F:/Project/git/rt-gui')
    RTT_RTGUI =''
19

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
from building import *

TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT

env = Environment()

Export('RTT_ROOT')
Export('rtconfig')

libs = Split('''
kernel32
msvcrt
winmm
user32
gdi32
winspool
comdlg32
advapi32
shell32
ole32
oleaut32
uuid
odbc32
odbccp32
''')
46 47 48 49 50 51 52
definitions = Split('''
WIN32
_DEBUG
_CONSOLE
MSVC
_TIME_T_DEFINED
''')
53 54 55 56

env.Append(CCFLAGS=rtconfig.CFLAGS)
env.Append(LINKFLAGS=rtconfig.LFLAGS)
env['LIBS']=libs
57
env['CPPDEFINES']=definitions
58

59
# prepare building environment
60

G
goprife@gmail.com 已提交
61
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False, remove_components=['rtgui'])
62
if GetDepend('RT_USING_RTGUI'):
63 64 65 66 67 68 69 70
    sdl_lib = ['SDL', 'SDLmain']
    sdl_lib_path = os.path.normpath('SDL/lib/x86')
    sdl_include_path = os.path.normpath('SDL/include')
    env.Append(LIBS=sdl_lib)
    env.Append(LIBPATH=sdl_lib_path)
    env.Append(CPPPATH=sdl_include_path)

    if RTT_RTGUI:
G
goprife@gmail.com 已提交
71 72 73
        objs += SConscript(os.path.join(RTT_RTGUI + '/components/rtgui', 'SConscript'),
						   variant_dir='build/components/rtgui',
						   duplicate=0)
74 75 76
        objs = objs + SConscript(RTT_RTGUI+'/demo/examples/SConscript', 
				variant_dir='build/examples/gui', duplicate=0)
    else:
G
goprife@gmail.com 已提交
77 78 79
        objs += SConscript(os.path.join(RTT_ROOT + '/components/rtgui', 'SConscript'),
						   variant_dir='build/components/rtgui',
						   duplicate=0)
80 81
        objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', 
				variant_dir='build/examples/gui', duplicate=0)
82 83 84 85 86 87

# build program 
env.Program(TARGET, objs)

# end building 
EndBuilding(TARGET)