restructure - Changed legacy build_lib to respect lib name in path

pull/2878/head
Christopher Haster 2016-10-01 18:08:38 -05:00
parent a7ddc46caf
commit b8fb7a6e3c
2 changed files with 9 additions and 6 deletions

View File

@ -19,7 +19,7 @@ import re
import tempfile import tempfile
from types import ListType from types import ListType
from shutil import rmtree from shutil import rmtree
from os.path import join, exists, basename, abspath, normpath from os.path import join, exists, dirname, basename, abspath, normpath
from os import linesep, remove from os import linesep, remove
from time import time from time import time
@ -755,6 +755,7 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
for path in dependencies_paths: for path in dependencies_paths:
lib_resources = toolchain.scan_resources(path) lib_resources = toolchain.scan_resources(path)
dependencies_include_dir.extend(lib_resources.inc_dirs) dependencies_include_dir.extend(lib_resources.inc_dirs)
dependencies_include_dir.extend(map(dirname, lib_resources.inc_dirs))
if inc_dirs: if inc_dirs:
dependencies_include_dir.extend(inc_dirs) dependencies_include_dir.extend(inc_dirs)
@ -774,8 +775,6 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
for resource in resources: for resource in resources:
toolchain.copy_files(resource.headers, build_path, toolchain.copy_files(resource.headers, build_path,
resources=resource) resources=resource)
toolchain.copy_files(resource.headers, join(build_path, name),
resources=resource)
dependencies_include_dir.extend( dependencies_include_dir.extend(
toolchain.scan_resources(build_path).inc_dirs) toolchain.scan_resources(build_path).inc_dirs)
@ -909,12 +908,14 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
# Common Headers # Common Headers
toolchain.copy_files([MBED_HEADER], MBED_LIBRARIES) toolchain.copy_files([MBED_HEADER], MBED_LIBRARIES)
library_incdirs = [dirname(MBED_LIBRARIES), MBED_LIBRARIES]
for dir, dest in [(MBED_DRIVERS, MBED_LIBRARIES_DRIVERS), for dir, dest in [(MBED_DRIVERS, MBED_LIBRARIES_DRIVERS),
(MBED_PLATFORM, MBED_LIBRARIES_PLATFORM), (MBED_PLATFORM, MBED_LIBRARIES_PLATFORM),
(MBED_HAL, MBED_LIBRARIES_HAL)]: (MBED_HAL, MBED_LIBRARIES_HAL)]:
resources = toolchain.scan_resources(dir) resources = toolchain.scan_resources(dir)
toolchain.copy_files(resources.headers, MBED_LIBRARIES)
toolchain.copy_files(resources.headers, dest) toolchain.copy_files(resources.headers, dest)
library_incdirs.append(dest)
# Target specific sources # Target specific sources
hal_src = MBED_TARGETS_PATH hal_src = MBED_TARGETS_PATH
@ -926,7 +927,7 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
build_target, resources=hal_implementation) 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, objects = toolchain.compile_sources(hal_implementation, tmp_path,
[MBED_LIBRARIES] + incdirs) library_incdirs + incdirs)
# Common Sources # Common Sources
mbed_resources = None mbed_resources = None
@ -934,7 +935,7 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
mbed_resources += toolchain.scan_resources(dir) mbed_resources += toolchain.scan_resources(dir)
objects += toolchain.compile_sources(mbed_resources, tmp_path, objects += toolchain.compile_sources(mbed_resources, tmp_path,
[MBED_LIBRARIES] + incdirs) library_incdirs + incdirs)
# A number of compiled files need to be copied as objects as opposed to # A number of compiled files need to be copied as objects as opposed to
# way the linker search for symbols in archives. These are: # way the linker search for symbols in archives. These are:

View File

@ -30,6 +30,7 @@ sys.path.insert(0, ROOT)
from tools.utils import args_error from tools.utils import args_error
from tools.paths import BUILD_DIR from tools.paths import BUILD_DIR
from tools.paths import MBED_LIBRARIES
from tools.paths import RTOS_LIBRARIES from tools.paths import RTOS_LIBRARIES
from tools.paths import RPC_LIBRARY from tools.paths import RPC_LIBRARY
from tools.paths import ETH_LIBRARY from tools.paths import ETH_LIBRARY
@ -285,6 +286,7 @@ if __name__ == '__main__':
jobs=options.jobs, jobs=options.jobs,
name=options.artifact_name, name=options.artifact_name,
app_config=options.app_config, app_config=options.app_config,
inc_dirs=[dirname(MBED_LIBRARIES)],
build_profile=extract_profile(parser, build_profile=extract_profile(parser,
options, options,
toolchain)) toolchain))