Skip to content

Fix for libraries being built with features support #1958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions tools/build_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,6 @@ def build_library(src_paths, build_path, target, toolchain_name,
for path in src_paths:
# Scan resources
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
if not resources:
Expand Down Expand Up @@ -404,6 +394,16 @@ def build_library(src_paths, build_path, target, toolchain_name,
# And add the configuration macros to the toolchain
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
objects = toolchain.compile_sources(resources, abspath(tmp_path), resources.inc_dirs)
resources.objects.extend(objects)
Expand Down Expand Up @@ -544,7 +544,7 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean

# Copy Headers
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)

Expand Down Expand Up @@ -643,7 +643,7 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
# Target specific sources
HAL_SRC = join(MBED_TARGETS_PATH, "hal")
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
objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES] + incdirs)

Expand Down Expand Up @@ -821,7 +821,7 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM
hal_implementation = toolchain.scan_resources(HAL_SRC)

# 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)

target_includes = ["-I%s" % i for i in incdirs.inc_dirs]
Expand Down Expand Up @@ -925,7 +925,7 @@ def static_analysis_scan_library(src_paths, build_path, target, toolchain_name,

# Copy Headers
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]
c_sources += " ".join(resource.c_sources) + " "
cpp_sources += " ".join(resource.cpp_sources) + " "
Expand Down
2 changes: 1 addition & 1 deletion tools/export/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __scan_and_copy(self, src_path, trg_path):
'lib_builds', 'lib_refs', 'repo_files', 'hex_files', 'bin_files']:
r = getattr(resources, r_type)
if r:
self.toolchain.copy_files(r, trg_path, rel_path=src_path)
self.toolchain.copy_files(r, trg_path, resources=resources)
return resources

@staticmethod
Expand Down
6 changes: 4 additions & 2 deletions tools/toolchains/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def scan_repository(self, path):

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
if type(files_paths) != ListType: files_paths = [files_paths]
Expand All @@ -556,7 +556,9 @@ def copy_files(self, files_paths, trg_path, rel_path=None):
files_paths.remove(source)

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)
else:
_, relative_path = split(source)
Expand Down