|
22 | 22 |
|
23 | 23 | from building import * |
24 | 24 |
|
25 | | -MODULE_VER_NUM = 4 |
| 25 | +MODULE_VER_NUM = 5 |
26 | 26 |
|
27 | 27 | source_pattern = ['*.c', '*.cpp', '*.cxx', '*.s', '*.S', '*.asm'] |
28 | 28 |
|
@@ -138,6 +138,20 @@ def IsRttEclipsePathFormat(path): |
138 | 138 | return True |
139 | 139 | else : |
140 | 140 | return False |
| 141 | + |
| 142 | +# all libs added by scons should be ends with five whitespace as a flag |
| 143 | +rtt_lib_flag = 5 * " " |
| 144 | + |
| 145 | + |
| 146 | +def ConverToRttEclipseLibFormat(lib): |
| 147 | + return str(lib) + str(rtt_lib_flag) |
| 148 | + |
| 149 | + |
| 150 | +def IsRttEclipseLibFormat(path): |
| 151 | + if path.endswith(rtt_lib_flag): |
| 152 | + return True |
| 153 | + else: |
| 154 | + return False |
141 | 155 |
|
142 | 156 |
|
143 | 157 | def IsCppProject(): |
@@ -189,7 +203,7 @@ def HandleToolOption(tools, env, project, reset): |
189 | 203 | linker_script_option = option |
190 | 204 | elif option.get('id').find('linker.nostart') != -1: |
191 | 205 | linker_nostart_option = option |
192 | | - elif option.get('id').find('linker.libs') != -1 and env.has_key('LIBS'): |
| 206 | + elif option.get('id').find('linker.libs') != -1: |
193 | 207 | linker_libs_option = option |
194 | 208 | elif option.get('id').find('linker.paths') != -1 and env.has_key('LIBPATH'): |
195 | 209 | linker_paths_option = option |
@@ -288,16 +302,22 @@ def HandleToolOption(tools, env, project, reset): |
288 | 302 | else: |
289 | 303 | option.set('value', 'false') |
290 | 304 | # update libs |
291 | | - if linker_libs_option is not None : |
| 305 | + if linker_libs_option is not None: |
292 | 306 | option = linker_libs_option |
293 | 307 | # remove old libs |
294 | 308 | for item in option.findall('listOptionValue'): |
295 | | - option.remove(item) |
| 309 | + if IsRttEclipseLibFormat(item.get("value")): |
| 310 | + option.remove(item) |
| 311 | + |
296 | 312 | # add new libs |
297 | | - for lib in env['LIBS']: |
298 | | - SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': lib}) |
| 313 | + if env.has_key('LIBS'): |
| 314 | + for lib in env['LIBS']: |
| 315 | + formatedLib = ConverToRttEclipseLibFormat(lib) |
| 316 | + SubElement(option, 'listOptionValue', { |
| 317 | + 'builtIn': 'false', 'value': formatedLib}) |
| 318 | + |
299 | 319 | # update lib paths |
300 | | - if linker_paths_option is not None : |
| 320 | + if linker_paths_option is not None: |
301 | 321 | option = linker_paths_option |
302 | 322 | # remove old lib paths |
303 | 323 | for item in option.findall('listOptionValue'): |
|
0 commit comments