MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / VS_add_ItemGroup

Function VS_add_ItemGroup

tools/targets/vs2012.py:107–144  ·  view source on GitHub ↗
(parent, file_type, files, project_path)

Source from the content-addressed store, hash-verified

105# files: c/h list
106# project_path
107def VS_add_ItemGroup(parent, file_type, files, project_path):
108 from building import Rtt_Root
109 RTT_ROOT = os.path.normpath(Rtt_Root)
110
111 file_dict = {'C':"ClCompile", 'H':'ClInclude'}
112 item_tag = file_dict[file_type]
113
114 ItemGroup = SubElement(parent, 'ItemGroup')
115 for f in files:
116 fn = f.rfile()
117 name = fn.name
118 path = os.path.dirname(fn.abspath)
119
120 objpath = path.lower()
121 if len(project_path) >= len(RTT_ROOT) :
122 if objpath.startswith(project_path.lower()) :
123 objpath = ''.join('bsp'+objpath[len(project_path):])
124 else :
125 objpath = ''.join('kernel'+objpath[len(RTT_ROOT):])
126 else :
127 if objpath.startswith(RTT_ROOT.lower()) :
128 objpath = ''.join('kernel'+objpath[len(RTT_ROOT):])
129 else :
130 objpath = ''.join('bsp'+objpath[len(project_path):])
131 path = _make_path_relative(project_path, path)
132 path = os.path.join(path, name)
133
134 File = SubElement(ItemGroup, item_tag)
135
136 if sys.version > '3':
137 File.set('Include', path)
138 else:
139 # python3 is no decode function
140 File.set('Include', path.decode(fs_encoding))
141
142 if file_type == 'C' :
143 ObjName = SubElement(File, 'ObjectFileName')
144 ObjName.text = ''.join('$(IntDir)'+objpath+'\\')
145
146def VS_add_HeadFiles(program, elem, project_path):
147 utils.source_ext = []

Callers 1

VS2012ProjectFunction · 0.85

Calls 2

_make_path_relativeFunction · 0.90
joinMethod · 0.45

Tested by

no test coverage detected