打開工程目錄下 SConstruct 文件:
在 objs = PrepareBuilding(env, RTT_ROOT) 這一行后面添加如下代碼
prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
set spawn
def ourspawn(sh, escape, cmd, args, e):
filename = str(uuid.uuid4())
newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs
if (len(cmdline) > 16 * 1024):
f = open(filename, 'w')
f.write(' '.join(args[1:]).replace('', '/'))
f.close()
exec
cmdline = cmd + " @" + filename
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell = False, env = e)
data, err = proc.communicate()
rv = proc.wait()
def res_output(_output, _s):
if len(_s):
if isinstance(_s, str):
_output(_s)
elif isinstance(_s, bytes):
_output(str(_s, 'UTF-8'))
else:
_output(str(_s))
res_output(sys.stderr.write, err)
res_output(sys.stdout.write, data)
if os.path.isfile(filename):
os.remove(filename)
return rv
if platform.system() == 'Windows':
env['SPAWN'] = ourspawn
在文件頭部導(dǎo)入相應(yīng)的模塊
import subprocess
import platform
import uuid
將命令行參數(shù)寫入文件中,讓 gcc 工具鏈讀取文件編譯或鏈接。
-
WINDOWS
+關(guān)注
關(guān)注
3文章
3521瀏覽量
88318 -
CMD命令
+關(guān)注
關(guān)注
0文章
28瀏覽量
8288 -
gcc編譯器
+關(guān)注
關(guān)注
0文章
78瀏覽量
3346 -
RTThread
+關(guān)注
關(guān)注
7文章
132瀏覽量
40776
發(fā)布評論請先 登錄
相關(guān)推薦
評論