mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #1956 from screamerbg/fix-features3
Fixed features not being includedpull/1958/head
commit
ac1a63f1a1
|
@ -227,7 +227,7 @@ def build_project(src_path, build_path, target, toolchain_name,
|
||||||
|
|
||||||
for feature in features:
|
for feature in features:
|
||||||
if feature in resources.features:
|
if feature in resources.features:
|
||||||
resources += resources.features[feature]
|
resources.add(resources.features[feature])
|
||||||
|
|
||||||
prev_features = features
|
prev_features = features
|
||||||
config.validate_config()
|
config.validate_config()
|
||||||
|
@ -236,10 +236,8 @@ def build_project(src_path, build_path, target, toolchain_name,
|
||||||
toolchain.add_macros(config.get_config_data_macros())
|
toolchain.add_macros(config.get_config_data_macros())
|
||||||
|
|
||||||
# Compile Sources
|
# Compile Sources
|
||||||
for path in src_paths:
|
objects = toolchain.compile_sources(resources, build_path, resources.inc_dirs)
|
||||||
src = toolchain.scan_resources(path)
|
resources.objects.extend(objects)
|
||||||
objects = toolchain.compile_sources(src, build_path, resources.inc_dirs)
|
|
||||||
resources.objects.extend(objects)
|
|
||||||
|
|
||||||
# Link Program
|
# Link Program
|
||||||
res, _ = toolchain.link_program(resources, build_path, name)
|
res, _ = toolchain.link_program(resources, build_path, name)
|
||||||
|
@ -398,7 +396,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
||||||
|
|
||||||
for feature in features:
|
for feature in features:
|
||||||
if feature in resources.features:
|
if feature in resources.features:
|
||||||
resources += resources.features[feature]
|
resources.add(resources.features[feature])
|
||||||
|
|
||||||
prev_features = features
|
prev_features = features
|
||||||
config.validate_config()
|
config.validate_config()
|
||||||
|
@ -407,10 +405,8 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
||||||
toolchain.add_macros(config.get_config_data_macros())
|
toolchain.add_macros(config.get_config_data_macros())
|
||||||
|
|
||||||
# Compile Sources
|
# Compile Sources
|
||||||
for path in src_paths:
|
objects = toolchain.compile_sources(resources, abspath(tmp_path), resources.inc_dirs)
|
||||||
src = toolchain.scan_resources(path)
|
resources.objects.extend(objects)
|
||||||
objects = toolchain.compile_sources(src, abspath(tmp_path), resources.inc_dirs)
|
|
||||||
resources.objects.extend(objects)
|
|
||||||
|
|
||||||
if archive:
|
if archive:
|
||||||
toolchain.build_library(objects, build_path, name)
|
toolchain.build_library(objects, build_path, name)
|
||||||
|
|
|
@ -64,6 +64,8 @@ class Resources:
|
||||||
def __init__(self, base_path=None):
|
def __init__(self, base_path=None):
|
||||||
self.base_path = base_path
|
self.base_path = base_path
|
||||||
|
|
||||||
|
self.file_basepath = {}
|
||||||
|
|
||||||
self.inc_dirs = []
|
self.inc_dirs = []
|
||||||
self.headers = []
|
self.headers = []
|
||||||
|
|
||||||
|
@ -105,6 +107,9 @@ class Resources:
|
||||||
return self.add(resources)
|
return self.add(resources)
|
||||||
|
|
||||||
def add(self, resources):
|
def add(self, resources):
|
||||||
|
for f,p in resources.file_basepath.items():
|
||||||
|
self.file_basepath[f] = p
|
||||||
|
|
||||||
self.inc_dirs += resources.inc_dirs
|
self.inc_dirs += resources.inc_dirs
|
||||||
self.headers += resources.headers
|
self.headers += resources.headers
|
||||||
|
|
||||||
|
@ -404,9 +409,14 @@ class mbedToolchain:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def scan_resources(self, path, exclude_paths=None):
|
def scan_resources(self, path, exclude_paths=None, base_path=None):
|
||||||
labels = self.get_labels()
|
labels = self.get_labels()
|
||||||
|
|
||||||
resources = Resources(path)
|
resources = Resources(path)
|
||||||
|
if not base_path:
|
||||||
|
base_path = path
|
||||||
|
resources.base_path = base_path
|
||||||
|
|
||||||
self.has_config = False
|
self.has_config = False
|
||||||
|
|
||||||
""" os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]])
|
""" os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]])
|
||||||
|
@ -445,7 +455,7 @@ class mbedToolchain:
|
||||||
dirs.remove(d)
|
dirs.remove(d)
|
||||||
|
|
||||||
if (d.startswith('FEATURE_')):
|
if (d.startswith('FEATURE_')):
|
||||||
resources.features[d[8:]] = self.scan_resources(dir_path)
|
resources.features[d[8:]] = self.scan_resources(dir_path, base_path=base_path)
|
||||||
dirs.remove(d)
|
dirs.remove(d)
|
||||||
|
|
||||||
# Remove dirs that already match the ignorepatterns
|
# Remove dirs that already match the ignorepatterns
|
||||||
|
@ -467,6 +477,8 @@ class mbedToolchain:
|
||||||
for file in files:
|
for file in files:
|
||||||
file_path = join(root, file)
|
file_path = join(root, file)
|
||||||
|
|
||||||
|
resources.file_basepath[file_path] = base_path
|
||||||
|
|
||||||
if self.is_ignored(file_path):
|
if self.is_ignored(file_path):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -597,15 +609,13 @@ class mbedToolchain:
|
||||||
queue = []
|
queue = []
|
||||||
prev_dir = None
|
prev_dir = None
|
||||||
|
|
||||||
# The dependency checking for C/C++ is delegated to the compiler
|
|
||||||
base_path = resources.base_path
|
|
||||||
# Sort compile queue for consistency
|
# Sort compile queue for consistency
|
||||||
files_to_compile.sort()
|
files_to_compile.sort()
|
||||||
work_dir = getcwd()
|
work_dir = getcwd()
|
||||||
|
|
||||||
for source in files_to_compile:
|
for source in files_to_compile:
|
||||||
_, name, _ = split_path(source)
|
_, name, _ = split_path(source)
|
||||||
object = self.relative_object_path(build_path, base_path, source)
|
object = self.relative_object_path(build_path, resources.file_basepath[source], source)
|
||||||
|
|
||||||
# Queue mode (multiprocessing)
|
# Queue mode (multiprocessing)
|
||||||
commands = self.compile_command(source, object, inc_paths)
|
commands = self.compile_command(source, object, inc_paths)
|
||||||
|
|
Loading…
Reference in New Issue