(target, script, program)
| 67 | Option.set('compilerVar', "CC") |
| 68 | |
| 69 | def CBProject(target, script, program): |
| 70 | project_path = os.path.dirname(os.path.abspath(target)) |
| 71 | |
| 72 | if os.path.isfile('template.cbp'): |
| 73 | tree = etree.parse('template.cbp') |
| 74 | else: |
| 75 | tree = etree.parse(os.path.join(os.path.dirname(__file__), 'template.cbp')) |
| 76 | |
| 77 | root = tree.getroot() |
| 78 | |
| 79 | out = open(target, 'w') |
| 80 | out.write('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\n') |
| 81 | |
| 82 | ProjectFiles = [] |
| 83 | |
| 84 | # SECTION 1. add "*.c|*.h" files group |
| 85 | for elem in tree.iter(tag='Project'): |
| 86 | # print elem.tag, elem.attrib |
| 87 | break |
| 88 | # add c files |
| 89 | for group in script: |
| 90 | group_xml = CB_AddCFiles(ProjectFiles, elem, group['name'], group['src'], project_path) |
| 91 | # add h files |
| 92 | CB_AddHeadFiles(program, elem, project_path) |
| 93 | |
| 94 | # SECTION 2. |
| 95 | # write head include path |
| 96 | if 'CPPPATH' in building.Env: |
| 97 | cpp_path = building.Env['CPPPATH'] |
| 98 | paths = set() |
| 99 | for path in cpp_path: |
| 100 | inc = _make_path_relative(project_path, os.path.normpath(path)) |
| 101 | paths.add(inc) #.replace('\\', '/') |
| 102 | |
| 103 | paths = [i for i in paths] |
| 104 | paths.sort() |
| 105 | # write include path, definitions |
| 106 | for elem in tree.iter(tag='Compiler'): |
| 107 | break |
| 108 | for path in paths: |
| 109 | Add = SubElement(elem, 'Add') |
| 110 | Add.set('directory', path) |
| 111 | |
| 112 | for macro in building.Env.get('CPPDEFINES', []): |
| 113 | Add = SubElement(elem, 'Add') |
| 114 | for d in macro: |
| 115 | Add.set('option', "-D"+d) |
| 116 | |
| 117 | # write link flags |
| 118 | ''' |
| 119 | # write lib dependence |
| 120 | if 'LIBS' in building.Env: |
| 121 | for elem in tree.iter(tag='Tool'): |
| 122 | if elem.attrib['Name'] == 'VCLinkerTool': |
| 123 | break |
| 124 | libs_with_extention = [i+'.lib' for i in building.Env['LIBS']] |
| 125 | libs = ' '.join(libs_with_extention) |
| 126 | elem.set('AdditionalDependencies', libs) |
no test coverage detected