(script, program)
| 150 | out.close() |
| 151 | |
| 152 | def TargetCodelite(script, program): |
| 153 | project_name = os.path.abspath('.').replace('\\', '/').split('/')[-1] |
| 154 | #project_name.replace('-', '_') |
| 155 | project_path = os.path.abspath('.') |
| 156 | CLGenWorkspace(project_name, project_path) |
| 157 | |
| 158 | if os.path.isfile('codelite_template.project'): |
| 159 | tree = etree.parse('codelite_template.project') |
| 160 | else: |
| 161 | tree = etree.parse(os.path.join(os.path.dirname(__file__), 'codelite_template.project')) |
| 162 | |
| 163 | root = tree.getroot() |
| 164 | root.attrib['Name'] = project_name |
| 165 | |
| 166 | out = open(project_name + '.project', 'w') |
| 167 | out.write('<?xml version="1.0" encoding="UTF-8"?>\n') |
| 168 | |
| 169 | # add files |
| 170 | for group in script: |
| 171 | CLAddCFiles(root, group['src'], project_path) |
| 172 | # add header file |
| 173 | CLAddHeaderFiles(root, program, project_path) |
| 174 | |
| 175 | # SECTION 2. |
| 176 | # write head include path |
| 177 | |
| 178 | if 'CPPPATH' in building.Env: |
| 179 | cpp_path = building.Env['CPPPATH'] |
| 180 | paths = set() |
| 181 | for path in cpp_path: |
| 182 | inc = _make_path_relative(project_path, os.path.normpath(path)) |
| 183 | paths.add(inc) #.replace('\\', '/') |
| 184 | |
| 185 | paths = [i for i in paths] |
| 186 | paths.sort() |
| 187 | |
| 188 | # write include path, definitions |
| 189 | for elem in tree.iter(tag='Compiler'): |
| 190 | break |
| 191 | |
| 192 | for path in paths: |
| 193 | CLAddIncludePath(root, path) |
| 194 | |
| 195 | |
| 196 | #print building.Env.get('LIBPATH', []) |
| 197 | #print building.Env.get('LIBS', []) |
| 198 | |
| 199 | CLSetCFlags(root, building.Env.get('CFLAGS', [])) |
| 200 | CLSetCxxFlags(root, building.Env.get('CFLAGS', [])) |
| 201 | |
| 202 | asflags = building.Env.get('ASFLAGS', []) |
| 203 | asflags = asflags.replace('-ffunction-sections', '') |
| 204 | asflags = asflags.replace('-fdata-sections', '') |
| 205 | asflags = asflags.replace('-x', '') |
| 206 | asflags = asflags.replace('-Wa,', '') |
| 207 | asflags = asflags.replace('assembler-with-cpp', '') |
| 208 | CLSetAsFlags(root, asflags) |
| 209 | CLSetLdFlags(root, building.Env.get('LINKFLAGS', [])) |
no test coverage detected