提交 5c78ab74 编写于 作者: S SummerGift

[add] scons --dist-ide function

上级 2acfc700
...@@ -161,6 +161,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ ...@@ -161,6 +161,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'make distribution and strip useless files') help = 'make distribution and strip useless files')
AddOption('--dist-ide',
dest = 'make-dist-ide',
type = 'string',
default = False,
help = 'make distribution for rt-thread eclipse ide')
AddOption('--cscope', AddOption('--cscope',
dest = 'cscope', dest = 'cscope',
action = 'store_true', action = 'store_true',
...@@ -865,6 +870,12 @@ def EndBuilding(target, program = None): ...@@ -865,6 +870,12 @@ def EndBuilding(target, program = None):
from mkdist import MkDist_Strip from mkdist import MkDist_Strip
MkDist_Strip(program, BSP_ROOT, Rtt_Root, Env) MkDist_Strip(program, BSP_ROOT, Rtt_Root, Env)
need_exit = True need_exit = True
if GetOption('make-dist-ide') and program != None:
from mkdist import MkDist
output_path = GetOption('make-dist-ide')[5:]
rtt_ide = {'output_path': output_path}
MkDist(program, BSP_ROOT, Rtt_Root, Env, rtt_ide)
need_exit = True
if GetOption('cscope'): if GetOption('cscope'):
from cscope import CscopeDatabase from cscope import CscopeDatabase
CscopeDatabase(Projects) CscopeDatabase(Projects)
......
...@@ -141,7 +141,7 @@ def bsp_update_kconfig_library(dist_dir): ...@@ -141,7 +141,7 @@ def bsp_update_kconfig_library(dist_dir):
found = 0 found = 0
f.write(line) f.write(line)
def bs_update_ide_project(bsp_root, rtt_root): def bs_update_ide_project(bsp_root, rtt_root, rttide = None):
import subprocess import subprocess
# default update the projects which have template file # default update the projects which have template file
tgt_dict = {'mdk4':('keil', 'armcc'), tgt_dict = {'mdk4':('keil', 'armcc'),
...@@ -151,6 +151,11 @@ def bs_update_ide_project(bsp_root, rtt_root): ...@@ -151,6 +151,11 @@ def bs_update_ide_project(bsp_root, rtt_root):
'vs2012':('msvc', 'cl'), 'vs2012':('msvc', 'cl'),
'cdk':('gcc', 'gcc')} 'cdk':('gcc', 'gcc')}
ide_dict = {'eclipse':('gcc', 'gcc')}
if rttide != None:
tgt_dict = ide_dict
scons_env = os.environ.copy() scons_env = os.environ.copy()
scons_env['RTT_ROOT'] = rtt_root scons_env['RTT_ROOT'] = rtt_root
...@@ -302,11 +307,15 @@ def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env): ...@@ -302,11 +307,15 @@ def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env):
print('done!') print('done!')
def MkDist(program, BSP_ROOT, RTT_ROOT, Env): def MkDist(program, BSP_ROOT, RTT_ROOT, Env, rttide = None):
print('make distribution....') print('make distribution....')
dist_name = os.path.basename(BSP_ROOT) dist_name = os.path.basename(BSP_ROOT)
dist_dir = os.path.join(BSP_ROOT, 'dist', dist_name)
if isinstance(rttide, dict):
dist_dir = rttide['output_path']
else:
dist_dir = os.path.join(BSP_ROOT, 'dist', dist_name)
target_path = os.path.join(dist_dir, 'rt-thread') target_path = os.path.join(dist_dir, 'rt-thread')
...@@ -366,11 +375,16 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env): ...@@ -366,11 +375,16 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env):
# change RTT_ROOT in Kconfig # change RTT_ROOT in Kconfig
bsp_update_kconfig(dist_dir) bsp_update_kconfig(dist_dir)
bsp_update_kconfig_library(dist_dir) bsp_update_kconfig_library(dist_dir)
# update all project files # update all project files
bs_update_ide_project(dist_dir, target_path) if rttide != None:
bs_update_ide_project(dist_dir, target_path, rttide)
else:
bs_update_ide_project(dist_dir, target_path)
# make zip package # make zip package
zip_dist(dist_dir, dist_name) if rttide != None:
zip_dist(dist_dir, dist_name)
print('done!') print('done!')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册