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

Function _CDKProject

tools/targets/cdk.py:54–135  ·  view source on GitHub ↗
(tree, target, script)

Source from the content-addressed store, hash-verified

52 return group
53
54def _CDKProject(tree, target, script):
55
56 project_path = os.path.dirname(os.path.abspath(target))
57
58 root = tree.getroot()
59 out = open(target, 'w')
60 out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
61
62 CPPPATH = []
63 CPPDEFINES = []
64 LINKFLAGS = ''
65 CCFLAGS = ''
66 LIBS = []
67 ProjectFiles = []
68
69 for child in root:
70 if child.tag == 'VirtualDirectory':
71 root.remove(child)
72
73 for group in script:
74 group_tree = SDKAddGroup(ProjectFiles, root, group['name'], group['src'], project_path)
75
76 # get each include path
77 if 'CPPPATH' in group and group['CPPPATH']:
78 if CPPPATH:
79 CPPPATH += group['CPPPATH']
80 else:
81 CPPPATH += group['CPPPATH']
82
83 # get each group's definitions
84 if 'CPPDEFINES' in group and group['CPPDEFINES']:
85 if CPPDEFINES:
86 CPPDEFINES += group['CPPDEFINES']
87 else:
88 CPPDEFINES += group['CPPDEFINES']
89
90 # get each group's cc flags
91 if 'CCFLAGS' in group and group['CCFLAGS']:
92 if CCFLAGS:
93 CCFLAGS += ' ' + group['CCFLAGS']
94 else:
95 CCFLAGS += group['CCFLAGS']
96
97 # get each group's link flags
98 if 'LINKFLAGS' in group and group['LINKFLAGS']:
99 if LINKFLAGS:
100 LINKFLAGS += ' ' + group['LINKFLAGS']
101 else:
102 LINKFLAGS += group['LINKFLAGS']
103
104 # todo: cdk add lib
105 if 'LIBS' in group and group['LIBS']:
106 LIBS += group['LIBS']
107
108 # write include path, definitions and link flags
109 text = ';'.join([_make_path_relative(project_path, os.path.normpath(i)) for i in CPPPATH])
110 IncludePath = tree.find('BuildConfigs/BuildConfig/Compiler/IncludePath')
111 IncludePath.text = text

Callers 1

CDKProjectFunction · 0.85

Calls 7

_make_path_relativeFunction · 0.90
xml_indentFunction · 0.90
SDKAddGroupFunction · 0.70
openFunction · 0.50
setFunction · 0.50
writeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected