pikapython/SConscript

73 lines
1.8 KiB
Python
Raw Normal View History

2021-10-03 21:10:19 -04:00
# RT-Thread building script for bridge
2021-12-06 10:49:05 +08:00
import os, shutil
2021-10-03 21:10:19 -04:00
from building import *
2021-12-06 10:49:05 +08:00
def pikascript_init():
cwd = os.getcwd()
def mycopyfile(srcfile,dstfile):
if not os.path.isfile(srcfile):
pass
else:
fpath,fname=os.path.split(dstfile)
if not os.path.exists(fpath):
os.makedirs(fpath)
shutil.copyfile(srcfile,dstfile)
mycopyfile(cwd + '/port/rt-thread/main.py', cwd + '/main.py')
mycopyfile(cwd + '/port/rt-thread/pikaPackage.exe', cwd + '/pikaPackage.exe')
mycopyfile(cwd + '/port/rt-thread/requestment.txt', cwd + '/requestment.txt')
def myremove(path):
try:
shutil.rmtree(cwd + '/' + path)
except OSError:
pass
try:
os.remove(cwd + '/' + path)
except OSError:
pass
myremove('bsp')
myremove('document')
2021-12-06 22:06:43 +08:00
myremove('examples')
2021-12-06 10:49:05 +08:00
myremove('package')
myremove('port')
myremove('src')
myremove('tools')
myremove('.github')
2021-12-06 22:06:43 +08:00
myremove('.git')
2021-12-06 10:49:05 +08:00
myremove('.vscode')
myremove('.gitattributes')
myremove('.gitignore')
myremove('logo.txt')
myremove('packages.toml')
2021-12-06 22:06:43 +08:00
myremove('README.md')
myremove('README_zh.md')
2021-12-06 10:49:05 +08:00
os.system(cwd + '/' + 'pikaPackage.exe')
os.system(cwd + '/' + 'rust-msc-latest-win10.exe')
# init pikascript
pikascript_init()
# init argument
cwd = GetCurrentDir()
group = []
list = os.listdir(cwd)
src = []
inc = []
LOCAL_CCFLAGS = ''
# add file and path
for root, dirs, files in os.walk(cwd):
for dir in dirs:
src = src + Glob(os.path.join(root,dir,'*.c'))
inc = inc + [os.path.join(root,dir)]
group = DefineGroup('pikascript', src, depend = ['PKG_USING_PIKASCRIPT'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
Return('group')
2021-10-03 21:10:19 -04:00