(env)
| 30 | return group |
| 31 | |
| 32 | def SESProject(env) : |
| 33 | target = 'project.emProject' |
| 34 | tree = etree.parse('template.emProject') |
| 35 | # print(etree.dump(tree.getroot())) |
| 36 | # etree.dump(tree.getroot()) |
| 37 | |
| 38 | project = ProjectInfo(env) |
| 39 | # print(project) |
| 40 | # return |
| 41 | |
| 42 | project_path = os.path.abspath(env['BSP_ROOT']) |
| 43 | script = env['project'] |
| 44 | |
| 45 | root = tree.getroot() |
| 46 | out = file(target, 'w') |
| 47 | out.write('<!DOCTYPE CrossStudio_Project_File>\n') |
| 48 | |
| 49 | CPPPATH = [] |
| 50 | CPPDEFINES = [] |
| 51 | LINKFLAGS = '' |
| 52 | CFLAGS = '' |
| 53 | |
| 54 | project_node = tree.find('project') |
| 55 | |
| 56 | for group in script: |
| 57 | # print(group) |
| 58 | |
| 59 | group_tree = SDKAddGroup(project_node, group['name'], group['src'], project_path) |
| 60 | |
| 61 | # get each group's cc flags |
| 62 | if 'CFLAGS' in group and group['CFLAGS']: |
| 63 | if CFLAGS: |
| 64 | CFLAGS += ' ' + group['CFLAGS'] |
| 65 | else: |
| 66 | CFLAGS += group['CFLAGS'] |
| 67 | |
| 68 | # get each group's link flags |
| 69 | if 'LINKFLAGS' in group and group['LINKFLAGS']: |
| 70 | if LINKFLAGS: |
| 71 | LINKFLAGS += ' ' + group['LINKFLAGS'] |
| 72 | else: |
| 73 | LINKFLAGS += group['LINKFLAGS'] |
| 74 | |
| 75 | # write include path, definitions and link flags |
| 76 | path = ';'.join([_make_path_relative(project_path, os.path.normpath(i)) for i in project['CPPPATH']]) |
| 77 | path = path.replace('\\', '/') |
| 78 | defines = ';'.join(set(project['CPPDEFINES'])) |
| 79 | |
| 80 | node = tree.findall('project/configuration') |
| 81 | for item in node: |
| 82 | if item.get('c_preprocessor_definitions'): |
| 83 | item.set('c_preprocessor_definitions', defines) |
| 84 | |
| 85 | if item.get('c_user_include_directories'): |
| 86 | item.set('c_user_include_directories', path) |
| 87 | |
| 88 | xml_indent(root) |
| 89 | out.write(etree.tostring(root, encoding='utf-8')) |
no test coverage detected