Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
b077e91c
R
rt-thread
项目概览
2345VOR
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b077e91c
编写于
5月 04, 2022
作者:
L
liukangcc
提交者:
guo
5月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[update] support command: scons --target=xmake
上级
6495df71
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
141 addition
and
1 deletion
+141
-1
tools/building.py
tools/building.py
+4
-1
tools/xmake.lua
tools/xmake.lua
+46
-0
tools/xmake.py
tools/xmake.py
+91
-0
未找到文件。
tools/building.py
浏览文件 @
b077e91c
...
...
@@ -185,6 +185,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
'ses'
:
(
'gcc'
,
'gcc'
),
'cmake'
:(
'gcc'
,
'gcc'
),
'cmake-armclang'
:(
'keil'
,
'armclang'
),
'xmake'
:(
'gcc'
,
'gcc'
),
'codelite'
:
(
'gcc'
,
'gcc'
)}
tgt_name
=
GetOption
(
'target'
)
...
...
@@ -847,7 +848,9 @@ def GenTargetProject(program = None):
if
GetOption
(
'target'
)
==
'cmake'
or
GetOption
(
'target'
)
==
'cmake-armclang'
:
from
cmake
import
CMakeProject
CMakeProject
(
Env
,
Projects
)
if
GetOption
(
'target'
)
==
'xmake'
:
from
xmake
import
XMakeProject
XMakeProject
(
Env
,
Projects
)
def
EndBuilding
(
target
,
program
=
None
):
...
...
tools/xmake.lua
0 → 100644
浏览文件 @
b077e91c
add_rules
(
"mode.debug"
,
"mode.release"
)
toolchain
(
"${toolchain}"
)
set_kind
(
"standalone"
)
set_sdkdir
(
"${sdkdir}"
)
toolchain_end
()
target
(
"${target}"
)
set_kind
(
"binary"
)
set_toolchains
(
"${toolchain}"
)
add_files
(
$
{
src_path
}
)
add_includedirs
(
$
{
inc_path
}
)
add_defines
(
$
{
define
}
)
add_cflags
(
"${cflags}"
,{
force
=
true
}
)
add_cxxflags
(
"${cxxflags}"
,{
force
=
true
}
)
add_asflags
(
"${asflags}"
,{
force
=
true
}
)
add_ldflags
(
"${ldflags}"
,{
force
=
true
}
)
set_targetdir
(
"./"
)
set_filename
(
"rtthread.elf"
)
after_build
(
function
(
target
)
os
.
exec
(
"${toolchain}-objcopy -O ihex rtthread.elf rtthread.hex"
)
os
.
exec
(
"${toolchain}-objcopy -O binary rtthread.elf rtthread.bin"
)
os
.
exec
(
"${toolchain}-size rtthread.elf"
)
end
)
\ No newline at end of file
tools/xmake.py
0 → 100644
浏览文件 @
b077e91c
"""
Utils for CMake
Author: https://github.com/klivelinux
"""
import
os
import
utils
from
string
import
Template
import
rtconfig
from
utils
import
_make_path_relative
class
XmakeProject
:
def
__init__
(
self
,
env
,
project
):
self
.
env
=
env
self
.
project
=
project
self
.
sdkdir
=
""
self
.
toolchain
=
""
self
.
src_path
=
""
self
.
inc_path
=
""
self
.
cflags
=
""
self
.
cxxflags
=
""
self
.
ldflags
=
""
self
.
asflags
=
""
self
.
define
=
""
def
set_toolchain_path
(
self
):
self
.
sdkdir
=
os
.
path
.
abspath
(
rtconfig
.
EXEC_PATH
).
replace
(
'
\\
'
,
"/"
)
# delete -
self
.
toolchain
=
rtconfig
.
PREFIX
[:
-
1
]
def
set_target_config
(
self
):
info
=
utils
.
ProjectInfo
(
self
.
env
)
# 1. config src path
for
group
in
self
.
project
:
for
f
in
group
[
'src'
]:
# use relative path
path
=
_make_path_relative
(
os
.
getcwd
(),
os
.
path
.
normpath
(
f
.
rfile
().
abspath
))
self
.
src_path
+=
"
\t\"
{0}
\"
,
\n
"
.
format
(
path
.
replace
(
"
\\
"
,
"/"
))
self
.
src_path
=
self
.
src_path
[:
-
2
]
# 2. config dir path
for
i
in
info
[
'CPPPATH'
]:
# use relative path
path
=
_make_path_relative
(
os
.
getcwd
(),
i
)
self
.
inc_path
+=
"
\t\"
{0}
\"
,
\n
"
.
format
(
path
.
replace
(
"
\\
"
,
"/"
))
self
.
inc_path
=
self
.
inc_path
[:
-
2
]
# 3. config cflags
self
.
cflags
=
rtconfig
.
CFLAGS
.
replace
(
'
\\
'
,
"/"
).
replace
(
'
\"
'
,
"
\\\"
"
)
# 4. config cxxflags
if
'CXXFLAGS'
in
dir
(
rtconfig
):
self
.
cxxflags
=
rtconfig
.
CXXFLAGS
.
replace
(
'
\\
'
,
"/"
).
replace
(
'
\"
'
,
"
\\\"
"
)
else
:
self
.
cxxflags
=
self
.
cflags
# 5. config asflags
self
.
asflags
=
rtconfig
.
AFLAGS
.
replace
(
'
\\
'
,
"/"
).
replace
(
'
\"
'
,
"
\\\"
"
)
# 6. config lflags
self
.
ldflags
=
rtconfig
.
LFLAGS
.
replace
(
'
\\
'
,
"/"
).
replace
(
'
\"
'
,
"
\\\"
"
)
# 7. config define
for
i
in
info
[
'CPPDEFINES'
]:
self
.
define
+=
"
\t\"
{0}
\"
,
\n
"
.
format
(
i
)
self
.
define
=
self
.
define
[:
-
2
]
def
generate_xmake_file
(
self
):
if
os
.
getenv
(
'RTT_ROOT'
):
RTT_ROOT
=
os
.
getenv
(
'RTT_ROOT'
)
else
:
RTT_ROOT
=
os
.
path
.
normpath
(
os
.
getcwd
()
+
'/../../..'
)
template_path
=
os
.
path
.
join
(
RTT_ROOT
,
"tools"
,
"xmake.lua"
)
with
open
(
template_path
,
"r"
)
as
f
:
data
=
f
.
read
()
data
=
Template
(
data
)
data
=
data
.
safe_substitute
(
toolchain
=
self
.
toolchain
,
sdkdir
=
self
.
sdkdir
,
src_path
=
self
.
src_path
,
inc_path
=
self
.
inc_path
,
define
=
self
.
define
,
cflags
=
self
.
cflags
,
cxxflags
=
self
.
cxxflags
,
asflags
=
self
.
asflags
,
ldflags
=
self
.
ldflags
,
target
=
"rt-thread"
)
with
open
(
"xmake.lua"
,
"w"
)
as
f
:
f
.
write
(
data
)
def
XMakeProject
(
env
,
project
):
print
(
'Update setting files for xmake.lua...'
)
xmake_project
=
XmakeProject
(
env
,
project
)
xmake_project
.
set_toolchain_path
()
xmake_project
.
set_target_config
()
xmake_project
.
generate_xmake_file
()
print
(
'Done!'
)
return
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录