Add config data to build_lib in build_api.py

`build_lib` wasn't aware of configuration data, so some of the source
files that depends on configuration data fail to compile. This commit
fixes that by making `build_lib` aware of configuration data.
pull/2423/head
Bogdan Marinescu 2016-08-11 13:54:41 +03:00
parent 002865f3d0
commit d471a4f019
1 changed files with 10 additions and 0 deletions

View File

@ -574,6 +574,11 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean
toolchain.info("Building library %s (%s, %s)" % (name.upper(), target.name, toolchain_name))
# Take into account the library configuration (MBED_CONFIG_FILE)
config = Config(target)
toolchain.config = config
config.add_config_files([MBED_CONFIG_FILE])
# Scan Resources
resources = []
for src_path in src_paths:
@ -596,6 +601,11 @@ def build_lib(lib_id, target, toolchain_name, options=None, verbose=False, clean
if inc_dirs:
dependencies_include_dir.extend(inc_dirs)
# Add other discovered configuration data to the configuration object
for r in resources:
config.load_resources(r)
toolchain.set_config_data(toolchain.config.get_config_data())
# Create the desired build directory structure
bin_path = join(build_path, toolchain.obj_path)
mkdir(bin_path)