diff --git a/workspace_tools/build_api.py b/workspace_tools/build_api.py index 1553317044..23c3d08ff8 100644 --- a/workspace_tools/build_api.py +++ b/workspace_tools/build_api.py @@ -92,7 +92,7 @@ def build_project(src_path, build_path, target, toolchain_name, def build_library(src_paths, build_path, target, toolchain_name, dependencies_paths=None, options=None, name=None, clean=False, - notify=None, verbose=False, macros=None, inc_dirs=None, jobs=1): + notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None, jobs=1): """ src_path: the path of the source directory build_path: the path of the build directory target: ['LPC1768', 'LPC11U24', 'LPC2368'] @@ -102,6 +102,7 @@ def build_library(src_paths, build_path, target, toolchain_name, notify: Notify function for logs verbose: Write the actual tools command lines if True inc_dirs: additional include directories which should be included in build + inc_dirs_ext: additional include directories which should be copied to library directory """ if type(src_paths) != ListType: src_paths = [src_paths] @@ -124,6 +125,11 @@ def build_library(src_paths, build_path, target, toolchain_name, resources = [] for src_path in src_paths: resources.append(toolchain.scan_resources(src_path)) + # Add extra include directories / files which are required by library + # This files usually are not in the same directory as source files so + # previous scan will not include them + for inc_ext in inc_dirs_ext: + resources.append(toolchain.scan_resources(inc_ext)) # Dependencies Include Paths dependencies_include_dir = [] @@ -171,6 +177,7 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals macros=MACROS, notify=notify, inc_dirs=lib.inc_dirs, + inc_dirs_ext=lib.inc_dirs_ext, jobs=jobs) else: print 'Library "%s" is not yet supported on target %s with toolchain %s' % (lib_id, target.name, toolchain) diff --git a/workspace_tools/libraries.py b/workspace_tools/libraries.py index 5bb19913e0..954419a8f1 100644 --- a/workspace_tools/libraries.py +++ b/workspace_tools/libraries.py @@ -94,7 +94,7 @@ LIBRARIES = [ "build_dir": CPPUTEST_LIBRARY, "dependencies": [MBED_LIBRARIES], 'inc_dirs': [CPPUTEST_INC, CPPUTEST_PLATFORM_INC, CPPUTEST_TESTRUNNER_INC, TEST_MBED_LIB], - 'inc_dirs_ext': [CPPUTEST_INC], + 'inc_dirs_ext': [CPPUTEST_INC_EXT], 'macros': ["CPPUTEST_USE_MEM_LEAK_DETECTION=0", "CPPUTEST_USE_STD_CPP_LIB=0", "CPPUTEST=1"], }, ] diff --git a/workspace_tools/paths.py b/workspace_tools/paths.py index 2b601e8170..f21466fa6d 100644 --- a/workspace_tools/paths.py +++ b/workspace_tools/paths.py @@ -95,8 +95,9 @@ EXPORT_TMP = join(EXPORT_DIR, ".temp") # CppUtest library CPPUTEST_DIR = join(ROOT, "..") -CPPUTEST_SRC = join(CPPUTEST_DIR, "cpputest", "src", "CppUTest") #, "CppUTest" -CPPUTEST_INC = join(CPPUTEST_DIR, "cpputest", "include") #, "CppUTest" +CPPUTEST_SRC = join(CPPUTEST_DIR, "cpputest", "src", "CppUTest") +CPPUTEST_INC = join(CPPUTEST_DIR, "cpputest", "include") +CPPUTEST_INC_EXT = join(CPPUTEST_DIR, "cpputest", "include", "CppUTest") # Platform dependant code is here (for armcc compiler) CPPUTEST_PLATFORM_SRC = join(CPPUTEST_DIR, "cpputest", "src", "Platforms", "armcc") CPPUTEST_PLATFORM_INC = join(CPPUTEST_DIR, "cpputest", "include", "Platforms", "armcc")