diff options
| author | Bernard Xiong <[email protected]> | 2020-07-28 05:44:20 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2020-07-28 05:44:20 +0800 |
| commit | 6bf76a375c53c1de3f1a4b1d0f7fc6506833f6dd (patch) | |
| tree | 13147a2fa7afeec29d7ee6d00e2afe7afa3879d8 /tools | |
| parent | a0897d684a8e88b76a72b2124d81d20bfdc2429d (diff) | |
| parent | fa599be08cb79b16d9bdb1456e195ac134b0f34f (diff) | |
Merge branch 'master' into gitee_master
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/eclipse.py | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/tools/eclipse.py b/tools/eclipse.py index ef546fb15a..154bffb754 100644 --- a/tools/eclipse.py +++ b/tools/eclipse.py @@ -22,7 +22,7 @@ from xml.etree.ElementTree import SubElement from building import * -MODULE_VER_NUM = 3 +MODULE_VER_NUM = 5 source_pattern = ['*.c', '*.cpp', '*.cxx', '*.s', '*.S', '*.asm'] @@ -138,6 +138,20 @@ def IsRttEclipsePathFormat(path): return True else : return False + +# all libs added by scons should be ends with five whitespace as a flag +rtt_lib_flag = 5 * " " + + +def ConverToRttEclipseLibFormat(lib): + return str(lib) + str(rtt_lib_flag) + + +def IsRttEclipseLibFormat(path): + if path.endswith(rtt_lib_flag): + return True + else: + return False def IsCppProject(): @@ -189,7 +203,7 @@ def HandleToolOption(tools, env, project, reset): linker_script_option = option elif option.get('id').find('linker.nostart') != -1: linker_nostart_option = option - elif option.get('id').find('linker.libs') != -1 and env.has_key('LIBS'): + elif option.get('id').find('linker.libs') != -1: linker_libs_option = option elif option.get('id').find('linker.paths') != -1 and env.has_key('LIBPATH'): linker_paths_option = option @@ -288,16 +302,22 @@ def HandleToolOption(tools, env, project, reset): else: option.set('value', 'false') # update libs - if linker_libs_option is not None : + if linker_libs_option is not None: option = linker_libs_option # remove old libs for item in option.findall('listOptionValue'): - option.remove(item) + if IsRttEclipseLibFormat(item.get("value")): + option.remove(item) + # add new libs - for lib in env['LIBS']: - SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': lib}) + if env.has_key('LIBS'): + for lib in env['LIBS']: + formatedLib = ConverToRttEclipseLibFormat(lib) + SubElement(option, 'listOptionValue', { + 'builtIn': 'false', 'value': formatedLib}) + # update lib paths - if linker_paths_option is not None : + if linker_paths_option is not None: option = linker_paths_option # remove old lib paths for item in option.findall('listOptionValue'): @@ -348,12 +368,13 @@ def GenExcluding(env, project): rtt_root = os.path.abspath(env['RTT_ROOT']) bsp_root = os.path.abspath(env['BSP_ROOT']) coll_dirs = CollectPaths(project['DIRS']) - all_paths = [OSPath(path) for path in coll_dirs] + all_paths_temp = [OSPath(path) for path in coll_dirs] + all_paths = [] - # remove unused path - for path in all_paths: - if not path.startswith(rtt_root) and not path.startswith(bsp_root): - all_paths.remove(path) + # add used path + for path in all_paths_temp: + if path.startswith(rtt_root) or path.startswith(bsp_root): + all_paths.append(path) if bsp_root.startswith(rtt_root): # bsp folder is in the RT-Thread root folder, such as the RT-Thread source code on GitHub |
