Fix libraries being built with features support

pull/1958/head
Mihail Stoyanov 2016-06-16 00:31:25 +01:00
parent ac1a63f1a1
commit e44566b319
3 changed files with 19 additions and 17 deletions

View File

@ -337,16 +337,6 @@ def build_library(src_paths, build_path, target, toolchain_name,
# Scan resources # Scan resources
resource = toolchain.scan_resources(path) resource = toolchain.scan_resources(path)
# Copy headers, objects and static libraries - all files needed for static lib
toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path)
toolchain.copy_files(resource.objects, build_path, rel_path=resource.base_path)
toolchain.copy_files(resource.libraries, build_path, rel_path=resource.base_path)
if resource.linker_script:
toolchain.copy_files(resource.linker_script, build_path, rel_path=resource.base_path)
if resource.hex_files:
toolchain.copy_files(resource.hex_files, build_path, rel_path=resource.base_path)
# Extend resources collection # Extend resources collection
if not resources: if not resources:
resources = resource resources = resource
@ -404,6 +394,16 @@ def build_library(src_paths, build_path, target, toolchain_name,
# And add the configuration macros to the toolchain # And add the configuration macros to the toolchain
toolchain.add_macros(config.get_config_data_macros()) toolchain.add_macros(config.get_config_data_macros())
# Copy headers, objects and static libraries - all files needed for static lib
toolchain.copy_files(resources.headers, build_path, resources=resources)
toolchain.copy_files(resources.objects, build_path, resources=resources)
toolchain.copy_files(resources.libraries, build_path, resources=resources)
if resources.linker_script:
toolchain.copy_files(resources.linker_script, build_path, resources=resources)
if resource.hex_files:
toolchain.copy_files(resources.hex_files, build_path, resources=resources)
# Compile Sources # Compile Sources
objects = toolchain.compile_sources(resources, abspath(tmp_path), resources.inc_dirs) objects = toolchain.compile_sources(resources, abspath(tmp_path), resources.inc_dirs)
resources.objects.extend(objects) resources.objects.extend(objects)
@ -544,7 +544,7 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean
# Copy Headers # Copy Headers
for resource in resources: for resource in resources:
toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path) toolchain.copy_files(resource.headers, build_path, resources=resource)
dependencies_include_dir.extend(toolchain.scan_resources(build_path).inc_dirs) dependencies_include_dir.extend(toolchain.scan_resources(build_path).inc_dirs)
@ -643,7 +643,7 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
# Target specific sources # Target specific sources
HAL_SRC = join(MBED_TARGETS_PATH, "hal") HAL_SRC = join(MBED_TARGETS_PATH, "hal")
hal_implementation = toolchain.scan_resources(HAL_SRC) hal_implementation = toolchain.scan_resources(HAL_SRC)
toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files + hal_implementation.libraries, BUILD_TARGET, HAL_SRC) toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files + hal_implementation.libraries, BUILD_TARGET, resources=hal_implementation)
incdirs = toolchain.scan_resources(BUILD_TARGET).inc_dirs incdirs = toolchain.scan_resources(BUILD_TARGET).inc_dirs
objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES] + incdirs) objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES] + incdirs)
@ -821,7 +821,7 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM
hal_implementation = toolchain.scan_resources(HAL_SRC) hal_implementation = toolchain.scan_resources(HAL_SRC)
# Copy files before analysis # Copy files before analysis
toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files, BUILD_TARGET, HAL_SRC) toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files, BUILD_TARGET, resources=hal_implementation)
incdirs = toolchain.scan_resources(BUILD_TARGET) incdirs = toolchain.scan_resources(BUILD_TARGET)
target_includes = ["-I%s" % i for i in incdirs.inc_dirs] target_includes = ["-I%s" % i for i in incdirs.inc_dirs]
@ -925,7 +925,7 @@ def static_analysis_scan_library(src_paths, build_path, target, toolchain_name,
# Copy Headers # Copy Headers
for resource in resources: for resource in resources:
toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path) toolchain.copy_files(resource.headers, build_path, resources=resource)
includes += ["-I%s" % i for i in resource.inc_dirs] includes += ["-I%s" % i for i in resource.inc_dirs]
c_sources += " ".join(resource.c_sources) + " " c_sources += " ".join(resource.c_sources) + " "
cpp_sources += " ".join(resource.cpp_sources) + " " cpp_sources += " ".join(resource.cpp_sources) + " "

View File

@ -57,7 +57,7 @@ class Exporter(object):
'lib_builds', 'lib_refs', 'repo_files', 'hex_files', 'bin_files']: 'lib_builds', 'lib_refs', 'repo_files', 'hex_files', 'bin_files']:
r = getattr(resources, r_type) r = getattr(resources, r_type)
if r: if r:
self.toolchain.copy_files(r, trg_path, rel_path=src_path) self.toolchain.copy_files(r, trg_path, resources=resources)
return resources return resources
@staticmethod @staticmethod

View File

@ -546,7 +546,7 @@ class mbedToolchain:
return resources return resources
def copy_files(self, files_paths, trg_path, rel_path=None): def copy_files(self, files_paths, trg_path, resources=None, rel_path=None):
# Handle a single file # Handle a single file
if type(files_paths) != ListType: files_paths = [files_paths] if type(files_paths) != ListType: files_paths = [files_paths]
@ -556,7 +556,9 @@ class mbedToolchain:
files_paths.remove(source) files_paths.remove(source)
for source in files_paths: for source in files_paths:
if rel_path is not None: if resources is not None:
relative_path = relpath(source, resources.file_basepath[source])
elif rel_path is not None:
relative_path = relpath(source, rel_path) relative_path = relpath(source, rel_path)
else: else:
_, relative_path = split(source) _, relative_path = split(source)