Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
人间散章
rt-thread
提交
36834efc
R
rt-thread
项目概览
人间散章
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
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,发现更多精彩内容 >>
提交
36834efc
编写于
10月 16, 2020
作者:
M
mx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
scons: Add CodeLite target
上级
3ff0c07b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
286 addition
and
2 deletion
+286
-2
tools/building.py
tools/building.py
+7
-2
tools/codelite.py
tools/codelite.py
+208
-0
tools/template.project
tools/template.project
+61
-0
tools/template.workspace
tools/template.workspace
+10
-0
未找到文件。
tools/building.py
浏览文件 @
36834efc
...
@@ -208,7 +208,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
...
@@ -208,7 +208,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
AddOption
(
'--target'
,
AddOption
(
'--target'
,
dest
=
'target'
,
dest
=
'target'
,
type
=
'string'
,
type
=
'string'
,
help
=
'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse'
)
help
=
'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse
/codelite
'
)
AddOption
(
'--stackanalysis'
,
AddOption
(
'--stackanalysis'
,
dest
=
'stackanalysis'
,
dest
=
'stackanalysis'
,
action
=
'store_true'
,
action
=
'store_true'
,
...
@@ -256,7 +256,8 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
...
@@ -256,7 +256,8 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
'cdk'
:(
'gcc'
,
'gcc'
),
'cdk'
:(
'gcc'
,
'gcc'
),
'makefile'
:(
'gcc'
,
'gcc'
),
'makefile'
:(
'gcc'
,
'gcc'
),
'eclipse'
:(
'gcc'
,
'gcc'
),
'eclipse'
:(
'gcc'
,
'gcc'
),
'ses'
:
(
'gcc'
,
'gcc'
)}
'ses'
:
(
'gcc'
,
'gcc'
),
'codelite'
:
(
'gcc'
,
'gcc'
)}
tgt_name
=
GetOption
(
'target'
)
tgt_name
=
GetOption
(
'target'
)
if
tgt_name
:
if
tgt_name
:
...
@@ -872,6 +873,10 @@ def GenTargetProject(program = None):
...
@@ -872,6 +873,10 @@ def GenTargetProject(program = None):
if
GetOption
(
'target'
)
==
'eclipse'
:
if
GetOption
(
'target'
)
==
'eclipse'
:
from
eclipse
import
TargetEclipse
from
eclipse
import
TargetEclipse
TargetEclipse
(
Env
,
GetOption
(
'reset-project-config'
),
GetOption
(
'project-name'
))
TargetEclipse
(
Env
,
GetOption
(
'reset-project-config'
),
GetOption
(
'project-name'
))
if
GetOption
(
'target'
)
==
'codelite'
:
from
codelite
import
TargetCodelite
TargetCodelite
(
Projects
,
program
)
def
EndBuilding
(
target
,
program
=
None
):
def
EndBuilding
(
target
,
program
=
None
):
...
...
tools/codelite.py
0 → 100644
浏览文件 @
36834efc
#
# File : codelite.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2020, RT-Thread Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Change Logs:
# Date Author Notes
# 2020-10-14 LiuMin Add copyright information
#
import
os
import
sys
import
string
import
building
import
rtconfig
import
xml.etree.ElementTree
as
etree
from
xml.etree.ElementTree
import
SubElement
from
utils
import
_make_path_relative
from
utils
import
xml_indent
import
utils
fs_encoding
=
sys
.
getfilesystemencoding
()
def
CLSetCFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
.
attrib
[
'C_Options'
]
=
flags
def
CLSetCxxFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
.
attrib
[
'Options'
]
=
flags
def
CLSetAsFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
.
attrib
[
'Assembler'
]
=
flags
def
CLAddIncludePath
(
root
,
path
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
=
SubElement
(
node
,
'IncludePath'
)
node
.
attrib
[
'Value'
]
=
path
def
CLAddPreprocessor
(
root
,
value
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Compiler'
)
node
=
SubElement
(
node
,
'Preprocessor'
)
node
.
attrib
[
'Value'
]
=
value
def
CLSetLdFlags
(
root
,
flags
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Linker'
)
node
.
attrib
[
'Options'
]
=
flags
def
CLAddLibrary_path
(
root
,
path
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Linker'
)
node
=
SubElement
(
node
,
'LibraryPath'
)
node
.
attrib
[
'Value'
]
=
path
def
CLAddLibrary
(
root
,
lib
):
node
=
root
.
find
(
'Settings'
).
find
(
'Configuration'
).
find
(
'Linker'
)
node
=
SubElement
(
node
,
'Library'
)
node
.
attrib
[
'Value'
]
=
lib
def
CLAddFile
(
root
,
file_path
):
file_path
=
file_path
.
replace
(
'
\\
'
,
'/'
)
dir_list
=
file_path
.
split
(
'/'
)
dir_list
.
pop
()
if
not
len
(
dir_list
):
dir_list
.
append
(
os
.
path
.
abspath
(
'.'
).
replace
(
'
\\
'
,
'/'
).
split
(
'/'
)[
-
1
])
parent
=
root
for
dir_name
in
dir_list
:
if
dir_name
==
'..'
:
continue
node
=
None
nodes
=
parent
.
findall
(
'VirtualDirectory'
)
for
iter
in
nodes
:
if
iter
.
attrib
[
'Name'
]
==
dir_name
:
node
=
iter
break
if
node
is
None
:
node
=
SubElement
(
parent
,
'VirtualDirectory'
)
node
.
attrib
[
'Name'
]
=
dir_name
parent
=
node
if
parent
!=
root
:
node
=
SubElement
(
parent
,
'File'
)
node
.
attrib
[
'Name'
]
=
file_path
def
CLAddHeaderFiles
(
parent
,
program
,
project_path
):
utils
.
source_ext
=
[]
utils
.
source_ext
=
[
"h"
]
for
item
in
program
:
utils
.
walk_children
(
item
)
utils
.
source_list
.
sort
()
for
f
in
utils
.
source_list
:
path
=
_make_path_relative
(
project_path
,
f
)
CLAddFile
(
parent
,
path
)
def
CLAddCFiles
(
parent
,
files
,
project_path
):
for
f
in
files
:
fn
=
f
.
rfile
()
name
=
fn
.
name
path
=
os
.
path
.
dirname
(
fn
.
abspath
)
path
=
_make_path_relative
(
project_path
,
path
)
path
=
os
.
path
.
join
(
path
,
name
)
CLAddFile
(
parent
,
path
)
def
CLGenWorkspace
(
project_name
,
project_path
):
if
os
.
path
.
isfile
(
'template.workspace'
):
tree
=
etree
.
parse
(
'template.workspace'
)
else
:
tree
=
etree
.
parse
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'template.workspace'
))
root
=
tree
.
getroot
()
root
.
attrib
[
'Name'
]
=
project_name
node
=
root
.
find
(
'Project'
)
node
.
attrib
[
'Name'
]
=
project_name
node
.
attrib
[
'Path'
]
=
project_name
+
'.project'
node
=
root
.
find
(
'BuildMatrix'
).
find
(
'WorkspaceConfiguration'
).
find
(
'Project'
)
node
.
attrib
[
'Name'
]
=
project_name
out
=
open
(
project_name
+
'.workspace'
,
'w'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\n
'
)
xml_indent
(
root
)
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
))
out
.
close
()
def
TargetCodelite
(
script
,
program
):
project_name
=
os
.
path
.
abspath
(
'.'
).
replace
(
'
\\
'
,
'/'
).
split
(
'/'
)[
-
1
]
#project_name.replace('-', '_')
project_path
=
os
.
path
.
abspath
(
'.'
)
CLGenWorkspace
(
project_name
,
project_path
)
if
os
.
path
.
isfile
(
'template.project'
):
tree
=
etree
.
parse
(
'template.project'
)
else
:
tree
=
etree
.
parse
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'template.project'
))
root
=
tree
.
getroot
()
root
.
attrib
[
'Name'
]
=
project_name
out
=
open
(
project_name
+
'.project'
,
'w'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\n
'
)
# add files
for
group
in
script
:
CLAddCFiles
(
root
,
group
[
'src'
],
project_path
)
# add header file
CLAddHeaderFiles
(
root
,
program
,
project_path
)
# SECTION 2.
# write head include path
if
'CPPPATH'
in
building
.
Env
:
cpp_path
=
building
.
Env
[
'CPPPATH'
]
paths
=
set
()
for
path
in
cpp_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
#.replace('\\', '/')
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
# write include path, definitions
for
elem
in
tree
.
iter
(
tag
=
'Compiler'
):
break
for
path
in
paths
:
CLAddIncludePath
(
root
,
path
)
#print building.Env.get('LIBPATH', [])
#print building.Env.get('LIBS', [])
CLSetCFlags
(
root
,
building
.
Env
.
get
(
'CCFLAGS'
,
[]))
CLSetCxxFlags
(
root
,
building
.
Env
.
get
(
'CCFLAGS'
,
[]))
CLSetAsFlags
(
root
,
building
.
Env
.
get
(
'ASFLAGS'
,
[]))
CLSetLdFlags
(
root
,
building
.
Env
.
get
(
'LINKFLAGS'
,
[]))
for
macro
in
building
.
Env
.
get
(
'CPPDEFINES'
,
[]):
for
d
in
macro
:
CLAddPreprocessor
(
root
,
d
)
xml_indent
(
root
)
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
))
out
.
close
()
tools/template.project
0 → 100644
浏览文件 @
36834efc
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project
Name=
"project"
Version=
"11000"
InternalType=
""
>
<Description/>
<Dependencies/>
<Settings
Type=
"Executable"
>
<GlobalSettings>
<Compiler
Options=
""
C_Options=
""
Assembler=
""
>
<IncludePath
Value=
"."
/>
</Compiler>
<Linker
Options=
""
>
<LibraryPath
Value=
"."
/>
</Linker>
<ResourceCompiler
Options=
""
/>
</GlobalSettings>
<Configuration
Name=
"Debug"
CompilerType=
"Cross GCC ( arm-none-eabi )"
DebuggerType=
"GNU gdb debugger"
Type=
"Executable"
BuildCmpWithGlobalSettings=
"append"
BuildLnkWithGlobalSettings=
"append"
BuildResWithGlobalSettings=
"append"
>
<Compiler
Options=
""
C_Options=
""
Assembler=
""
Required=
"yes"
PreCompiledHeader=
""
PCHInCommandLine=
"no"
PCHFlags=
""
PCHFlagsPolicy=
"0"
>
</Compiler>
<Linker
Options=
""
Required=
"yes"
>
</Linker>
<ResourceCompiler
Options=
""
Required=
"no"
/>
<General
OutputFile=
"$(IntermediateDirectory)/$(ProjectName).elf"
IntermediateDirectory=
"$(ConfigurationName)"
Command=
"$(OutputFile)"
CommandArguments=
""
UseSeparateDebugArgs=
"no"
DebugArguments=
""
WorkingDirectory=
""
PauseExecWhenProcTerminates=
"yes"
IsGUIProgram=
"no"
IsEnabled=
"yes"
/>
<BuildSystem
Name=
"Default"
/>
<Environment
EnvVarSetName=
"<Use Defaults>"
DbgSetName=
"<Use Defaults>"
>
<![CDATA[]]>
</Environment>
<Debugger
IsRemote=
"yes"
RemoteHostName=
"127.0.0.1"
RemoteHostPort=
"2331"
DebuggerPath=
""
IsExtended=
"no"
>
<DebuggerSearchPaths/>
<PostConnectCommands>
monitor reset
monitor halt
load
</PostConnectCommands>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild>
<Command
Enabled=
"yes"
>
arm-none-eabi-objcopy -O ihex $(IntermediateDirectory)/$(ProjectName).elf $(IntermediateDirectory)/$(ProjectName).hex
</Command>
<Command
Enabled=
"yes"
>
arm-none-eabi-objcopy -I ihex -O binary $(IntermediateDirectory)/$(ProjectName).hex $(IntermediateDirectory)/$(ProjectName).bin
</Command>
<Command
Enabled=
"yes"
>
arm-none-eabi-size $(IntermediateDirectory)/$(ProjectName).elf
</Command>
</PostBuild>
<CustomBuild
Enabled=
"no"
>
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName/>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion
EnableCpp11=
"no"
EnableCpp14=
"no"
>
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
</Settings>
</CodeLite_Project>
tools/template.workspace
0 → 100644
浏览文件 @
36834efc
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Workspace
Name=
"project"
Database=
""
Version=
"10000"
>
<Project
Name=
"project"
Path=
"project.project"
Active=
"Yes"
/>
<BuildMatrix>
<WorkspaceConfiguration
Name=
"Debug"
Selected=
"yes"
>
<Environment/>
<Project
Name=
"project"
ConfigName=
"Debug"
/>
</WorkspaceConfiguration>
</BuildMatrix>
</CodeLite_Workspace>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录