Filter libraries by extension in exporters

pull/7183/head
Jimmy Brisson 2018-06-26 10:22:10 -05:00
parent 62538e3bce
commit 3b7a5bb35e
18 changed files with 25 additions and 20 deletions

View File

@ -59,7 +59,7 @@ class AtmelStudio(Exporter):
source_folders.append(e) source_folders.append(e)
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
libraries.append(l[3:]) libraries.append(l[3:])

View File

@ -318,7 +318,7 @@ class CCES(Exporter):
cxx_flags = self.flags['cxx_flags'] + self.flags['common_flags'] cxx_flags = self.flags['cxx_flags'] + self.flags['common_flags']
libs = [] libs = []
for libpath in self.resources.libraries: for libpath in self.libraries:
lib = os.path.splitext(os.path.basename(libpath))[0] lib = os.path.splitext(os.path.basename(libpath))[0]
libs.append(lib[3:]) # skip 'lib' prefix libs.append(lib[3:]) # skip 'lib' prefix

View File

@ -68,7 +68,7 @@ class CMake(Exporter):
srcs = [re.sub(r'^[.]/', '', f) for f in srcs] srcs = [re.sub(r'^[.]/', '', f) for f in srcs]
# additional libraries # additional libraries
libraries = [self.prepare_lib(basename(lib)) for lib in self.resources.libraries] libraries = [self.prepare_lib(basename(lib)) for lib in self.libraries]
sys_libs = [self.prepare_sys_lib(lib) for lib in self.toolchain.sys_libs] sys_libs = [self.prepare_sys_lib(lib) for lib in self.toolchain.sys_libs]
# sort includes reverse, so the deepest dir comes first (ensures short includes) # sort includes reverse, so the deepest dir comes first (ensures short includes)

View File

@ -143,7 +143,7 @@ class CMSIS(Exporter):
def generate(self): def generate(self):
srcs = self.resources.headers + self.resources.s_sources + \ srcs = self.resources.headers + self.resources.s_sources + \
self.resources.c_sources + self.resources.cpp_sources + \ self.resources.c_sources + self.resources.cpp_sources + \
self.resources.objects + self.resources.libraries + \ self.resources.objects + self.libraries + \
[self.resources.linker_script] [self.resources.linker_script]
srcs = [fileCMSIS(src, src) for src in srcs if src] srcs = [fileCMSIS(src, src) for src in srcs if src]
ctx = { ctx = {

View File

@ -90,8 +90,7 @@ class CodeBlocks(GccArm):
not x.startswith('obj'))]; not x.startswith('obj'))];
c_sources = sorted([self.filter_dot(s) for s in self.resources.c_sources]) c_sources = sorted([self.filter_dot(s) for s in self.resources.c_sources])
libraries = [self.prepare_lib(basename(lib)) for lib libraries = [self.prepare_lib(basename(lib)) for lib in self.libraries]
in self.resources.libraries]
sys_libs = [self.prepare_sys_lib(lib) for lib sys_libs = [self.prepare_sys_lib(lib) for lib
in self.toolchain.sys_libs] in self.toolchain.sys_libs]
ncs36510fib = (hasattr(self.toolchain.target, 'post_binary_hook') and ncs36510fib = (hasattr(self.toolchain.target, 'post_binary_hook') and

View File

@ -88,7 +88,7 @@ class CoIDE(Exporter):
}) })
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
libraries.append(l[3:]) libraries.append(l[3:])

View File

@ -60,7 +60,7 @@ class DS5_5(Exporter):
'name': self.project_name, 'name': self.project_name,
'include_paths': self.resources.inc_dirs, 'include_paths': self.resources.inc_dirs,
'scatter_file': self.resources.linker_script, 'scatter_file': self.resources.linker_script,
'object_files': self.resources.objects + self.resources.libraries, 'object_files': self.resources.objects + self.libraries,
'source_files': source_files, 'source_files': source_files,
'symbols': self.toolchain.get_symbols() 'symbols': self.toolchain.get_symbols()
} }

View File

@ -60,7 +60,7 @@ class EmBitz(Exporter):
}) })
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
libraries.append(l[3:]) libraries.append(l[3:])

View File

@ -118,6 +118,11 @@ class Exporter(object):
config_header.name) config_header.name)
return flags return flags
@property
def libraries(self):
return [l for l in self.resources.get_file_names(FileType.LIB)
if l.endswith(self.toolchain.LIBRARY_EXT)]
def toolchain_flags(self, toolchain): def toolchain_flags(self, toolchain):
"""Returns a dictionary of toolchain flags. """Returns a dictionary of toolchain flags.
Keys of the dictionary are: Keys of the dictionary are:

View File

@ -90,7 +90,7 @@ class GNUARMEclipse(Exporter):
# TODO: use some logger to display additional info if verbose # TODO: use some logger to display additional info if verbose
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
libraries.append(l[3:]) libraries.append(l[3:])

View File

@ -109,7 +109,7 @@ class IAR(Exporter):
raise NotSupportedException("No linker script found.") raise NotSupportedException("No linker script found.")
srcs = self.resources.headers + self.resources.s_sources + \ srcs = self.resources.headers + self.resources.s_sources + \
self.resources.c_sources + self.resources.cpp_sources + \ self.resources.c_sources + self.resources.cpp_sources + \
self.resources.objects + self.resources.libraries self.resources.objects + self.libraries
flags = self.flags flags = self.flags
c_flags = list(set(flags['common_flags'] c_flags = list(set(flags['common_flags']
+ flags['c_flags'] + flags['c_flags']

View File

@ -33,7 +33,7 @@ class KDS(Exporter):
def generate(self): def generate(self):
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
libraries.append(l[3:]) libraries.append(l[3:])

View File

@ -44,7 +44,7 @@ class LPCXpresso(Exporter):
def generate(self): def generate(self):
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
libraries.append(l[3:]) libraries.append(l[3:])

View File

@ -70,7 +70,7 @@ class Makefile(Exporter):
self.resources.cpp_sources] self.resources.cpp_sources]
libraries = [self.prepare_lib(basename(lib)) for lib libraries = [self.prepare_lib(basename(lib)) for lib
in self.resources.libraries] in self.libraries]
sys_libs = [self.prepare_sys_lib(lib) for lib sys_libs = [self.prepare_sys_lib(lib) for lib
in self.toolchain.sys_libs] in self.toolchain.sys_libs]

View File

@ -76,12 +76,13 @@ class MCUXpresso(GNUARMEclipse):
# TODO: use some logger to display additional info if verbose # TODO: use some logger to display additional info if verbose
self.libraries = [] libraries = []
# print 'libraries' # print 'libraries'
# print self.resources.libraries # print self.resources.libraries
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
self.libraries.append(l[3:]) libraries.append(l[3:])
self.libraries = libraries
self.system_libraries = [ self.system_libraries = [
'stdc++', 'supc++', 'm', 'c', 'gcc', 'nosys' 'stdc++', 'supc++', 'm', 'c', 'gcc', 'nosys'

View File

@ -144,7 +144,7 @@ class SimplicityV3(Exporter):
main_files.append(source) main_files.append(source)
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
l, _ = splitext(basename(lib)) l, _ = splitext(basename(lib))
if l[3:] not in EXCLUDED_LIBS: if l[3:] not in EXCLUDED_LIBS:
libraries.append(l[3:]) libraries.append(l[3:])

View File

@ -434,7 +434,7 @@ class Sw4STM32(GNUARMEclipse):
self.resources.win_to_unix() self.resources.win_to_unix()
libraries = [] libraries = []
for lib in self.resources.libraries: for lib in self.libraries:
library, _ = splitext(basename(lib)) library, _ = splitext(basename(lib))
libraries.append(library[3:]) libraries.append(library[3:])

View File

@ -218,7 +218,7 @@ class Uvision(Exporter):
srcs = self.resources.headers + self.resources.s_sources + \ srcs = self.resources.headers + self.resources.s_sources + \
self.resources.c_sources + self.resources.cpp_sources + \ self.resources.c_sources + self.resources.cpp_sources + \
self.resources.objects + self.resources.libraries self.resources.objects + self.libraries
ctx = { ctx = {
'name': self.project_name, 'name': self.project_name,
# project_files => dict of generators - file group to generator of # project_files => dict of generators - file group to generator of