Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunqingabc
rt-thread
提交
1ffb99e6
R
rt-thread
项目概览
yunqingabc
/
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,发现更多精彩内容 >>
提交
1ffb99e6
编写于
10月 10, 2013
作者:
B
bernard
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/RT-Thread/rt-thread
上级
f1107f67
83bb0541
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
288 addition
and
36 deletion
+288
-36
bsp/simulator/template_vs2005.vcproj
bsp/simulator/template_vs2005.vcproj
+0
-0
bsp/simulator/template_vs2012.vcxproj
bsp/simulator/template_vs2012.vcxproj
+61
-0
components/dfs/filesystems/jffs2/dfs_jffs2.c
components/dfs/filesystems/jffs2/dfs_jffs2.c
+1
-0
components/dfs/filesystems/jffs2/src/fs-ecos.c
components/dfs/filesystems/jffs2/src/fs-ecos.c
+2
-1
components/finsh/msh_cmd.c
components/finsh/msh_cmd.c
+2
-0
components/finsh/shell.c
components/finsh/shell.c
+1
-0
components/utilities/logtrace/log_file.c
components/utilities/logtrace/log_file.c
+3
-0
components/utilities/logtrace/log_trace.c
components/utilities/logtrace/log_trace.c
+2
-2
components/utilities/logtrace/log_trace.h
components/utilities/logtrace/log_trace.h
+10
-8
include/rtthread.h
include/rtthread.h
+1
-0
libcpu/arm/am335x/SConscript
libcpu/arm/am335x/SConscript
+0
-17
src/kservice.c
src/kservice.c
+8
-7
tools/building.py
tools/building.py
+6
-0
tools/vs.py
tools/vs.py
+1
-1
tools/vs2012.py
tools/vs2012.py
+190
-0
未找到文件。
bsp/simulator/template.vcproj
→
bsp/simulator/template
_vs2005
.vcproj
浏览文件 @
1ffb99e6
文件已移动
bsp/simulator/template_vs2012.vcxproj
0 → 100644
浏览文件 @
1ffb99e6
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets=
"Build"
ToolsVersion=
"4.0"
>
<ItemGroup
Label=
"ProjectConfigurations"
>
<ProjectConfiguration
Include=
"Debug|Win32"
>
<Configuration>
Debug
</Configuration>
<Platform>
Win32
</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup
Label=
"Globals"
>
<ProjectName>
vs
</ProjectName>
<ProjectGuid>
{4A6BF1B1-C645-4BAD-A9B7-7B6E3DB67B2C}
</ProjectGuid>
<RootNamespace>
vs2008
</RootNamespace>
<Keyword>
Win32Proj
</Keyword>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.Default.props"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<PlatformToolset>
v110
</PlatformToolset>
<CharacterSet>
NotSet
</CharacterSet>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.props"
/>
<ImportGroup
Label=
"ExtensionSettings"
>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
</ImportGroup>
<PropertyGroup
Label=
"UserMacros"
/>
<PropertyGroup>
<_ProjectFileVersion>
11.0.50727.1
</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<OutDir>
$(SolutionDir)$(Configuration)\
</OutDir>
<IntDir>
$(Configuration)\
</IntDir>
<LinkIncremental>
true
</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<ClCompile>
<Optimization>
Disabled
</Optimization>
<AdditionalIncludeDirectories>
.\;..\..\include;..\..\bsp\vs2008;..\..\components\finsh;..\..\components\dfs\include;..\..\components\dfs\filesystems\uffs\src\inc\;..\..\components\dfs\filesystems\uffs;..\..\components\drivers\include;..\..\components\dfs\filesystems\jffs2\src;..\..\components\dfs\filesystems\jffs2\kernel;..\..\components\dfs\filesystems\jffs2\include;..\..\components\dfs\filesystems\jffs2\;..\..\components\dfs\filesystems\jffs2\cyg\compress;..\..\components\init;.\drivers;..\..\components\net\lwip\src\include\;..\..\components\net\lwip\src;..\..\components\net\lwip\src\arch\include;..\..\components\net\lwip\src\include\ipv4;.\pcap\Include;%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
WIN32;_DEBUG;_CONSOLE;MSVC;_TIME_T_DEFINED;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<MinimalRebuild>
true
</MinimalRebuild>
<BasicRuntimeChecks>
EnableFastChecks
</BasicRuntimeChecks>
<RuntimeLibrary>
MultiThreadedDebugDLL
</RuntimeLibrary>
<PrecompiledHeader
/>
<WarningLevel>
Level3
</WarningLevel>
<DebugInformationFormat>
EditAndContinue
</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>
winmm.lib;Packet.lib;wpcap.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalLibraryDirectories>
.\pcap\Lib;%(AdditionalLibraryDirectories)
</AdditionalLibraryDirectories>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<SubSystem>
Console
</SubSystem>
<TargetMachine>
MachineX86
</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
</ImportGroup>
</Project>
\ No newline at end of file
components/dfs/filesystems/jffs2/dfs_jffs2.c
浏览文件 @
1ffb99e6
...
...
@@ -178,6 +178,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs,
result
=
jffs2_mount
(
NULL
,
mte
);
if
(
result
!=
0
)
{
device_partition
[
index
].
dev
=
NULL
;
return
jffs2_result_to_dfs
(
result
);
}
/* save this pointer */
...
...
components/dfs/filesystems/jffs2/src/fs-ecos.c
浏览文件 @
1ffb99e6
...
...
@@ -747,7 +747,7 @@ int jffs2_open(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
}
// Initialise the file object
file
->
f_flag
|
=
mode
&
CYG_FILE_MODE_MASK
;
file
->
f_flag
=
mode
&
CYG_FILE_MODE_MASK
;
file
->
f_type
=
CYG_FILE_TYPE_FILE
;
file
->
f_ops
=
&
jffs2_fileops
;
file
->
f_offset
=
(
mode
&
O_APPEND
)
?
node
->
i_size
:
0
;
...
...
@@ -1065,6 +1065,7 @@ static int jffs2_opendir(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
// Initialize the file object, setting the f_ops field to a
// special set of file ops.
file
->
f_flag
=
0
;
file
->
f_type
=
CYG_FILE_TYPE_FILE
;
file
->
f_ops
=
&
jffs2_dirops
;
file
->
f_offset
=
0
;
...
...
components/finsh/msh_cmd.c
浏览文件 @
1ffb99e6
...
...
@@ -136,6 +136,7 @@ int cmd_rm(int argc, char** argv)
}
FINSH_FUNCTION_EXPORT_ALIAS
(
cmd_rm
,
__cmd_rm
,
"Remove (unlink) the FILE(s)."
);
#ifdef DFS_USING_WORKDIR
int
cmd_cd
(
int
argc
,
char
**
argv
)
{
if
(
argc
==
1
)
...
...
@@ -157,6 +158,7 @@ int cmd_pwd(int argc, char** argv)
return
0
;
}
FINSH_FUNCTION_EXPORT_ALIAS
(
cmd_pwd
,
__cmd_pwd
,
Print
the
name
of
the
current
working
directory
.);
#endif
int
cmd_mkdir
(
int
argc
,
char
**
argv
)
{
...
...
components/finsh/shell.c
浏览文件 @
1ffb99e6
...
...
@@ -131,6 +131,7 @@ void finsh_set_device(const char* device_name)
{
/* close old finsh device */
rt_device_close
(
shell
->
device
);
rt_device_set_rx_indicate
(
dev
,
RT_NULL
);
}
shell
->
device
=
dev
;
...
...
components/utilities/logtrace/log_file.c
浏览文件 @
1ffb99e6
...
...
@@ -121,6 +121,9 @@ void log_trace_set_file(const char *filename)
log_trace_file_init
(
filename
);
log_trace_set_device
(
"logfile"
);
}
#ifdef RT_USING_FINSH
#include <finsh.h>
FINSH_FUNCTION_EXPORT_ALIAS
(
log_trace_set_file
,
log_file
,
set
output
filename
of
log
trace
);
#endif
#endif
/* RT_USING_DFS */
components/utilities/logtrace/log_trace.c
浏览文件 @
1ffb99e6
...
...
@@ -41,7 +41,7 @@ static struct rt_device _log_device;
static
rt_device_t
_traceout_device
=
RT_NULL
;
/* define a default lg session. The name is empty. */
static
struct
log_trace_session
_def_session
=
{{
0
},
LOG_TRACE_LEVEL_INFO
};
static
struct
log_trace_session
_def_session
=
{{
"
\0
"
},
LOG_TRACE_LEVEL_INFO
};
static
struct
log_trace_session
*
_the_sessions
[
LOG_TRACE_MAX_SESSION
]
=
{
&
_def_session
};
/* there is a default session at least */
static
rt_uint16_t
_the_sess_nr
=
1
;
...
...
@@ -272,7 +272,7 @@ static void _lg_fmtout(
_trace_buf
[
0
]
=
']'
;
ptr
=
&
_trace_buf
[
1
];
length
=
vsnprintf
(
ptr
,
LOG_TRACE_BUFSZ
,
fmt
,
argptr
);
length
=
rt_
vsnprintf
(
ptr
,
LOG_TRACE_BUFSZ
,
fmt
,
argptr
);
if
(
length
>=
LOG_TRACE_BUFSZ
)
length
=
LOG_TRACE_BUFSZ
-
1
;
...
...
components/utilities/logtrace/log_trace.h
浏览文件 @
1ffb99e6
...
...
@@ -31,9 +31,10 @@
#define LOG_TRACE_LEVEL_MASK 0x0f
#define LOG_TRACE_LEVEL_NOTRACE 0x00
#define LOG_TRACE_LEVEL_ERROR 0x01
#define LOG_TRACE_LEVEL_WARNING 0x02
#define LOG_TRACE_LEVEL_INFO 0x03
#define LOG_TRACE_LEVEL_DEBUG 0x04
#define LOG_TRACE_LEVEL_WARNING 0x03
#define LOG_TRACE_LEVEL_INFO 0x05
#define LOG_TRACE_LEVEL_VERBOSE 0x07
#define LOG_TRACE_LEVEL_DEBUG 0x09
#define LOG_TRACE_LEVEL_ALL 0x0f
#ifndef LOG_TRACE_LEVEL_DEFAULT
...
...
@@ -41,9 +42,10 @@
#endif
#define LOG_TRACE_ERROR "<1>"
#define LOG_TRACE_WARNING "<2>"
#define LOG_TRACE_INFO "<3>"
#define LOG_TRACE_DEBUG "<4>"
#define LOG_TRACE_WARNING "<3>"
#define LOG_TRACE_INFO "<5>"
#define LOG_TRACE_VERBOSE "<7>"
#define LOG_TRACE_DEBUG "<9>"
#define LOG_TRACE_OPT_NOTS 0x10
/* no timestamp */
#define LOG_TRACE_OPT_LN 0x20
/* terminate the current line */
...
...
@@ -140,12 +142,12 @@ rt_err_t log_trace_set_device(const char *device_name);
void
log_trace_flush
(
void
);
#ifdef RT_USING_DFS
/** set the backend to file */
void
log_trace_set_file
(
const
char
*
filename
);
/* log trace for NAND Flash */
void
log_trace_nand_init
(
const
char
*
nand_device
);
void
log_trace_file_init
(
const
char
*
filename
);
#endif
/* RT_USING_DFS */
#endif
include/rtthread.h
浏览文件 @
1ffb99e6
...
...
@@ -469,6 +469,7 @@ int rt_system_module_init(void);
void
rt_kprintf
(
const
char
*
fmt
,
...);
#endif
rt_int32_t
rt_vsprintf
(
char
*
dest
,
const
char
*
format
,
va_list
arg_ptr
);
rt_int32_t
rt_vsnprintf
(
char
*
buf
,
rt_size_t
size
,
const
char
*
fmt
,
va_list
args
);
rt_int32_t
rt_sprintf
(
char
*
buf
,
const
char
*
format
,
...);
rt_int32_t
rt_snprintf
(
char
*
buf
,
rt_size_t
size
,
const
char
*
format
,
...);
...
...
libcpu/arm/am335x/SConscript
已删除
100644 → 0
浏览文件 @
f1107f67
Import
(
'rtconfig'
)
from
building
import
*
cwd
=
GetCurrentDir
()
src
=
Glob
(
'*.c'
)
CPPPATH
=
[
cwd
]
if
rtconfig
.
PLATFORM
==
'iar'
:
src
+=
Glob
(
'*_iar.S'
)
elif
rtconfig
.
PLATFORM
==
'gcc'
:
src
+=
Glob
(
'*_gcc.S'
)
elif
rtconfig
.
PLATFORM
==
'armcc'
:
src
+=
Glob
(
'*_rvds.S'
)
group
=
DefineGroup
(
'AM1808'
,
src
,
depend
=
[
''
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
src/kservice.c
浏览文件 @
1ffb99e6
...
...
@@ -718,10 +718,10 @@ static char *print_number(char *buf,
return
buf
;
}
static
rt_int32_t
vsnprintf
(
char
*
buf
,
rt_size_t
size
,
const
char
*
fmt
,
va_list
args
)
rt_int32_t
rt_
vsnprintf
(
char
*
buf
,
rt_size_t
size
,
const
char
*
fmt
,
va_list
args
)
{
#ifdef RT_PRINTF_LONGLONG
unsigned
long
long
num
;
...
...
@@ -976,6 +976,7 @@ static rt_int32_t vsnprintf(char *buf,
*/
return
str
-
buf
;
}
RTM_EXPORT
(
rt_vsnprintf
);
/**
* This function will fill a formatted string to buffer
...
...
@@ -990,7 +991,7 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...)
va_list
args
;
va_start
(
args
,
fmt
);
n
=
vsnprintf
(
buf
,
size
,
fmt
,
args
);
n
=
rt_
vsnprintf
(
buf
,
size
,
fmt
,
args
);
va_end
(
args
);
return
n
;
...
...
@@ -1006,7 +1007,7 @@ RTM_EXPORT(rt_snprintf);
*/
rt_int32_t
rt_vsprintf
(
char
*
buf
,
const
char
*
format
,
va_list
arg_ptr
)
{
return
vsnprintf
(
buf
,
(
rt_size_t
)
-
1
,
format
,
arg_ptr
);
return
rt_
vsnprintf
(
buf
,
(
rt_size_t
)
-
1
,
format
,
arg_ptr
);
}
RTM_EXPORT
(
rt_vsprintf
);
...
...
@@ -1114,7 +1115,7 @@ void rt_kprintf(const char *fmt, ...)
* large excluding the terminating null byte. If the output string
* would be larger than the rt_log_buf, we have to adjust the output
* length. */
length
=
vsnprintf
(
rt_log_buf
,
sizeof
(
rt_log_buf
)
-
1
,
fmt
,
args
);
length
=
rt_
vsnprintf
(
rt_log_buf
,
sizeof
(
rt_log_buf
)
-
1
,
fmt
,
args
);
if
(
length
>
RT_CONSOLEBUF_SIZE
-
1
)
length
=
RT_CONSOLEBUF_SIZE
-
1
;
#ifdef RT_USING_DEVICE
...
...
tools/building.py
浏览文件 @
1ffb99e6
...
...
@@ -139,6 +139,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
'mdk4'
:(
'keil'
,
'armcc'
),
'iar'
:(
'iar'
,
'iar'
),
'vs'
:(
'msvc'
,
'cl'
),
'vs2012'
:(
'msvc'
,
'cl'
),
'cb'
:(
'keil'
,
'armcc'
)}
tgt_name
=
GetOption
(
'target'
)
if
tgt_name
:
...
...
@@ -347,12 +348,14 @@ def DoBuilding(target, objects):
EndBuilding
(
target
,
program
)
def
EndBuilding
(
target
,
program
=
None
):
import
rtconfig
from
keil
import
MDKProject
from
keil
import
MDK4Project
from
iar
import
IARProject
from
vs
import
VSProject
from
vs2012
import
VS2012Project
from
codeblocks
import
CBProject
Env
.
AddPostAction
(
target
,
rtconfig
.
POST_ACTION
)
...
...
@@ -377,6 +380,9 @@ def EndBuilding(target, program = None):
if
GetOption
(
'target'
)
==
'vs'
:
VSProject
(
'project.vcproj'
,
Projects
,
program
)
if
GetOption
(
'target'
)
==
'vs2012'
:
VS2012Project
(
'project.vcxproj'
,
Projects
,
program
)
if
GetOption
(
'target'
)
==
'cb'
:
CBProject
(
'project.cbp'
,
Projects
,
program
)
...
...
tools/vs.py
浏览文件 @
1ffb99e6
...
...
@@ -40,7 +40,7 @@ def VS_AddHeadFilesGroup(program, elem, project_path):
def
VSProject
(
target
,
script
,
program
):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
tree
=
etree
.
parse
(
'template.vcproj'
)
tree
=
etree
.
parse
(
'template
_vs2005
.vcproj'
)
root
=
tree
.
getroot
()
out
=
file
(
target
,
'wb'
)
...
...
tools/vs2012.py
0 → 100644
浏览文件 @
1ffb99e6
import
os
import
sys
import
string
import
building
import
uuid
import
xml.etree.ElementTree
as
etree
from
xml.etree.ElementTree
import
SubElement
from
utils
import
_make_path_relative
from
utils
import
xml_indent
fs_encoding
=
sys
.
getfilesystemencoding
()
#reference
# http://woodpecker.org.cn/diveintopython3/xml.html
# https://pycoders-weekly-chinese.readthedocs.org/en/latest/issue6/processing-xml-in-python-with-element-tree.html
# http://www.cnblogs.com/ifantastic/archive/2013/04/12/3017110.html
filter_project
=
etree
.
Element
(
'Project'
,
attrib
=
{
'ToolsVersion'
:
'4.0'
})
def
get_uuid
():
id
=
uuid
.
uuid1
()
# UUID('3e5526c0-2841-11e3-a376-20cf3048bcb3')
idstr
=
id
.
get_urn
()[
9
:]
#'urn:uuid:3e5526c0-2841-11e3-a376-20cf3048bcb3'[9:]
return
'{'
+
idstr
+
'}'
def
VS2012_AddGroup
(
parent
,
group_name
,
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
)
ClCompile
=
SubElement
(
parent
,
'ClCompile'
)
ClCompile
.
set
(
'Include'
,
path
.
decode
(
fs_encoding
))
Filter
=
SubElement
(
ClCompile
,
'Filter'
)
Filter
.
text
=
'Source Files
\\
'
+
group_name
def
VS2012_CreateFilter
(
script
,
project_path
):
c_ItemGroup
=
SubElement
(
filter_project
,
'ItemGroup'
)
filter_ItemGroup
=
SubElement
(
filter_project
,
'ItemGroup'
)
Filter
=
SubElement
(
filter_ItemGroup
,
'Filter'
)
Filter
.
set
(
'Include'
,
'Source Files'
)
UniqueIdentifier
=
SubElement
(
Filter
,
'UniqueIdentifier'
)
UniqueIdentifier
.
text
=
get_uuid
()
Extensions
=
SubElement
(
Filter
,
'Extensions'
)
Extensions
.
text
=
'cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx'
Filter
=
SubElement
(
filter_ItemGroup
,
'Filter'
)
Filter
.
set
(
'Include'
,
'Header Files'
)
UniqueIdentifier
=
SubElement
(
Filter
,
'UniqueIdentifier'
)
UniqueIdentifier
.
text
=
get_uuid
()
Extensions
=
SubElement
(
Filter
,
'Extensions'
)
Extensions
.
text
=
'h;hpp;hxx;hm;inl;inc;xsd'
for
group
in
script
:
VS2012_AddGroup
(
c_ItemGroup
,
group
[
'name'
],
group
[
'src'
],
project_path
)
Filter
=
SubElement
(
filter_ItemGroup
,
'Filter'
)
Filter
.
set
(
'Include'
,
'Source Files
\\
'
+
group
[
'name'
])
UniqueIdentifier
=
SubElement
(
Filter
,
'UniqueIdentifier'
)
UniqueIdentifier
.
text
=
get_uuid
()
#program: object from scons
# parent: xml node
# file_type: C or H
# files: c/h list
# project_path
def
VS_add_ItemGroup
(
parent
,
file_type
,
files
,
project_path
):
file_dict
=
{
'C'
:
"ClCompile"
,
'H'
:
'ClInclude'
}
item_tag
=
file_dict
[
file_type
]
ItemGroup
=
SubElement
(
parent
,
'ItemGroup'
)
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
)
File
=
SubElement
(
ItemGroup
,
item_tag
)
File
.
set
(
'Include'
,
path
.
decode
(
fs_encoding
))
def
VS_add_HeadFiles
(
program
,
elem
,
project_path
):
building
.
source_ext
=
[]
building
.
source_ext
=
[
"h"
]
for
item
in
program
:
building
.
walk_children
(
item
)
building
.
source_list
.
sort
()
# print building.source_list
ItemGroup
=
SubElement
(
elem
,
'ItemGroup'
)
filter_h_ItemGroup
=
SubElement
(
filter_project
,
'ItemGroup'
)
for
f
in
building
.
source_list
:
path
=
_make_path_relative
(
project_path
,
f
)
File
=
SubElement
(
ItemGroup
,
'ClInclude'
)
File
.
set
(
'Include'
,
path
.
decode
(
fs_encoding
))
# add project.vcxproj.filter
ClInclude
=
SubElement
(
filter_h_ItemGroup
,
'ClInclude'
)
ClInclude
.
set
(
'Include'
,
path
.
decode
(
fs_encoding
))
Filter
=
SubElement
(
ClInclude
,
'Filter'
)
Filter
.
text
=
'Header Files'
def
VS2012Project
(
target
,
script
,
program
):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
tree
=
etree
.
parse
(
'template_vs2012.vcxproj'
)
root
=
tree
.
getroot
()
elem
=
root
out
=
file
(
target
,
'wb'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\r\n
'
)
ProjectFiles
=
[]
# add "*.c or *.h" files
VS2012_CreateFilter
(
script
,
project_path
)
# add "*.c" files
for
group
in
script
:
VS_add_ItemGroup
(
elem
,
'C'
,
group
[
'src'
],
project_path
)
# add "*.h" files
VS_add_HeadFiles
(
program
,
elem
,
project_path
)
# write head include path
if
building
.
Env
.
has_key
(
'CPPPATH'
):
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
()
cpp_path
=
';'
.
join
(
paths
)
+
';%(AdditionalIncludeDirectories)'
# write include path
for
elem
in
tree
.
iter
(
tag
=
'AdditionalIncludeDirectories'
):
elem
.
text
=
cpp_path
break
# write cppdefinitons flags
if
building
.
Env
.
has_key
(
'CPPDEFINES'
):
for
elem
in
tree
.
iter
(
tag
=
'PreprocessorDefinitions'
):
definitions
=
';'
.
join
(
building
.
Env
[
'CPPDEFINES'
])
+
';%(PreprocessorDefinitions)'
elem
.
text
=
definitions
break
# write link flags
# write lib dependence (Link)
if
building
.
Env
.
has_key
(
'LIBS'
):
for
elem
in
tree
.
iter
(
tag
=
'AdditionalDependencies'
):
libs_with_extention
=
[
i
+
'.lib'
for
i
in
building
.
Env
[
'LIBS'
]]
libs
=
';'
.
join
(
libs_with_extention
)
+
';%(AdditionalDependencies)'
elem
.
text
=
libs
break
# write lib include path
if
building
.
Env
.
has_key
(
'LIBPATH'
):
lib_path
=
building
.
Env
[
'LIBPATH'
]
paths
=
set
()
for
path
in
lib_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
lib_paths
=
';'
.
join
(
paths
)
+
';%(AdditionalLibraryDirectories)'
for
elem
in
tree
.
iter
(
tag
=
'AdditionalLibraryDirectories'
):
elem
.
text
=
lib_paths
break
xml_indent
(
root
)
vcxproj_string
=
etree
.
tostring
(
root
,
encoding
=
'utf-8'
)
root_node
=
r
'<Project DefaultTargets="Build" ToolsVersion="4.0">'
out
.
write
(
r
'<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">'
)
out
.
write
(
vcxproj_string
[
len
(
root_node
):])
out
.
close
()
xml_indent
(
filter_project
)
filter_string
=
etree
.
tostring
(
filter_project
,
encoding
=
'utf-8'
)
out
=
file
(
'project.vcxproj.filters'
,
'wb'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\r\n
'
)
root_node
=
r
'<Project ToolsVersion="4.0">'
out
.
write
(
r
'<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">'
)
out
.
write
(
filter_string
[
len
(
root_node
):])
out
.
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录