2013-01-08 22:40:58 +08:00
|
|
|
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() + '/../..')
|
|
|
|
|
|
|
|
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
|
2013-02-26 17:48:32 +08:00
|
|
|
RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui')
|
|
|
|
# RTT_RTGUI =''
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
|
|
|
from building import *
|
|
|
|
|
|
|
|
|
|
|
|
env = Environment()
|
|
|
|
|
|
|
|
Export('RTT_ROOT')
|
|
|
|
Export('rtconfig')
|
|
|
|
|
2013-01-22 16:57:47 +08:00
|
|
|
if rtconfig.PLATFORM == 'cl':
|
|
|
|
TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT
|
|
|
|
|
|
|
|
libs = Split('''
|
|
|
|
winmm
|
|
|
|
gdi32
|
|
|
|
winspool
|
|
|
|
comdlg32
|
|
|
|
advapi32
|
|
|
|
shell32
|
|
|
|
ole32
|
|
|
|
oleaut32
|
|
|
|
uuid
|
|
|
|
odbc32
|
|
|
|
odbccp32
|
|
|
|
''')
|
|
|
|
definitions = Split('''
|
|
|
|
WIN32
|
|
|
|
_DEBUG
|
|
|
|
_CONSOLE
|
|
|
|
MSVC
|
|
|
|
_TIME_T_DEFINED
|
|
|
|
''')
|
|
|
|
env.Append(CCFLAGS=rtconfig.CFLAGS)
|
|
|
|
env.Append(LINKFLAGS=rtconfig.LFLAGS)
|
|
|
|
env['LIBS']=libs
|
|
|
|
env['CPPDEFINES']=definitions
|
2013-02-26 16:03:08 +08:00
|
|
|
elif rtconfig.PLATFORM == 'mingw':
|
|
|
|
libs = Split('''
|
|
|
|
winmm
|
|
|
|
gdi32
|
|
|
|
winspool
|
|
|
|
comdlg32
|
|
|
|
advapi32
|
|
|
|
shell32
|
|
|
|
ole32
|
|
|
|
oleaut32
|
|
|
|
uuid
|
|
|
|
odbc32
|
|
|
|
odbccp32
|
|
|
|
''')
|
|
|
|
TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT
|
|
|
|
env = Environment(tools = ['mingw'],
|
|
|
|
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
|
|
|
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
|
|
|
AR = rtconfig.AR, ARFLAGS = '-rc',
|
|
|
|
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
|
|
|
env['LIBS']=libs
|
|
|
|
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
2013-01-22 16:57:47 +08:00
|
|
|
else:
|
|
|
|
TARGET = 'rtthread'
|
|
|
|
env.Append(CCFLAGS=rtconfig.CFLAGS)
|
|
|
|
env.Append(LINKFLAGS=rtconfig.LFLAGS)
|
2013-01-24 12:52:42 +08:00
|
|
|
env.Append(LIBS=['m'])
|
2013-01-22 16:57:47 +08:00
|
|
|
|
2013-01-08 22:40:58 +08:00
|
|
|
# prepare building environment
|
|
|
|
|
|
|
|
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False, remove_components=['rtgui'])
|
|
|
|
if GetDepend('RT_USING_RTGUI'):
|
|
|
|
sdl_lib = ['SDL', 'SDLmain']
|
|
|
|
sdl_lib_path = [os.path.abspath('SDL/lib/x86')]
|
|
|
|
sdl_include_path = [os.path.abspath('SDL/include')]
|
|
|
|
env.Append(LIBS=sdl_lib)
|
|
|
|
env.Append(LIBPATH=sdl_lib_path)
|
|
|
|
env.Append(CPPPATH=sdl_include_path)
|
|
|
|
|
|
|
|
if RTT_RTGUI:
|
|
|
|
objs += SConscript(os.path.join(RTT_RTGUI, 'SConscript'),
|
|
|
|
variant_dir='build/components/rtgui',
|
|
|
|
duplicate=0)
|
|
|
|
objs = objs + SConscript(RTT_RTGUI+'/../../demo/examples/SConscript',
|
|
|
|
variant_dir='build/examples/gui', duplicate=0)
|
|
|
|
else:
|
|
|
|
objs += SConscript(os.path.join(RTT_ROOT + '/components/rtgui', 'SConscript'),
|
|
|
|
variant_dir='build/components/rtgui',
|
|
|
|
duplicate=0)
|
|
|
|
objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript',
|
|
|
|
variant_dir='build/examples/gui', duplicate=0)
|
|
|
|
|
|
|
|
if GetDepend('RT_USING_TC'):
|
|
|
|
objs = objs + SConscript(RTT_ROOT + '/examples/kernel/SConscript', variant_dir = 'build/tc/kernel', duplicate=0)
|
|
|
|
|
2013-02-27 00:37:57 +08:00
|
|
|
def ObjRemove(objs, remove):
|
|
|
|
for item in objs:
|
|
|
|
# print type(item), os.path.basename(str(item))
|
|
|
|
if os.path.basename(str(item)) in remove:
|
|
|
|
objs.remove(item)
|
|
|
|
return
|
|
|
|
|
|
|
|
# build program -shared
|
|
|
|
if GetDepend('RT_USING_MODULE'):
|
|
|
|
# Remove module.c in $RTT_ROOT/src
|
|
|
|
ObjRemove(objs, ['module.obj', 'module.o'])
|
|
|
|
|
|
|
|
AddOption('--def',
|
|
|
|
dest='def',
|
|
|
|
nargs=1, type='string',
|
|
|
|
action='store',
|
|
|
|
metavar='DIR',
|
|
|
|
help='installation prefix')
|
|
|
|
res = GetOption('def')
|
|
|
|
if res is None:
|
|
|
|
program = env.Program(TARGET, objs)
|
|
|
|
elif res == 'update':
|
|
|
|
env['LINKFLAGS'] = rtconfig.DEFFILE_LFLAGS
|
|
|
|
env.SharedLibrary("rtthread.dll", objs)
|
|
|
|
program = ''
|
|
|
|
elif res == 'yes':
|
|
|
|
if rtconfig.PLATFORM == 'cl':
|
|
|
|
objs += ['rtthread.def']
|
|
|
|
env.SharedLibrary("rtthread.dll", objs)
|
|
|
|
program = env.Program(TARGET, 'dummy.c', LIBS='rtthread', LIBPATH='.')
|
|
|
|
else:
|
|
|
|
print "bad arguments, you can use the following command:"
|
|
|
|
print "\t --def=update to create .def"
|
|
|
|
print "\t --def=yes to create final exe"
|
|
|
|
exit()
|
|
|
|
|
|
|
|
else:
|
|
|
|
# env.SharedLibrary("rtthread.dll", objs)
|
|
|
|
program = env.Program(TARGET, objs)
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
# end building
|
|
|
|
EndBuilding(TARGET, program)
|