restructure - Added single-nested inc_dir support to legacy build_lib

Added single-nested include directories to libraries built with the
legacy build_lib function. Unfortunately, to get this working without
a significant rewrite of the legacy build tools, library header files
are just duplicated in the precompile stage.
pull/2878/head
Christopher Haster 2016-10-01 13:34:57 -05:00
parent 04a2af7395
commit a7ddc46caf
4 changed files with 24 additions and 18 deletions

2
mbed.h
View File

@ -19,7 +19,7 @@
#define MBED_LIBRARY_VERSION 123
#if MBED_CONF_RTOS_PRESENT
#include "rtos.h"
#include "rtos/rtos.h"
#endif
#if MBED_CONF_NSAPI_PRESENT

View File

@ -26,7 +26,9 @@ from time import time
from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException,\
ToolException, InvalidReleaseTargetException
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_HEADER,\
MBED_DRIVERS, MBED_PLATFORM, MBED_HAL, MBED_CONFIG_FILE
MBED_DRIVERS, MBED_PLATFORM, MBED_HAL, MBED_CONFIG_FILE,\
MBED_LIBRARIES_DRIVERS, MBED_LIBRARIES_PLATFORM, MBED_LIBRARIES_HAL,\
BUILD_DIR
from tools.targets import TARGET_NAMES, TARGET_MAP
from tools.libraries import Library
from tools.toolchains import TOOLCHAIN_CLASSES
@ -772,6 +774,8 @@ def build_lib(lib_id, target, toolchain_name, verbose=False,
for resource in resources:
toolchain.copy_files(resource.headers, build_path,
resources=resource)
toolchain.copy_files(resource.headers, join(build_path, name),
resources=resource)
dependencies_include_dir.extend(
toolchain.scan_resources(build_path).inc_dirs)
@ -905,12 +909,12 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
# Common Headers
toolchain.copy_files([MBED_HEADER], MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers,
MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers,
MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers,
MBED_LIBRARIES)
for dir, dest in [(MBED_DRIVERS, MBED_LIBRARIES_DRIVERS),
(MBED_PLATFORM, MBED_LIBRARIES_PLATFORM),
(MBED_HAL, MBED_LIBRARIES_HAL)]:
resources = toolchain.scan_resources(dir)
toolchain.copy_files(resources.headers, MBED_LIBRARIES)
toolchain.copy_files(resources.headers, dest)
# Target specific sources
hal_src = MBED_TARGETS_PATH
@ -925,14 +929,14 @@ def build_mbed_libs(target, toolchain_name, verbose=False,
[MBED_LIBRARIES] + incdirs)
# Common Sources
mbed_resources = toolchain.scan_resources(MBED_DRIVERS)
mbed_resources += toolchain.scan_resources(MBED_PLATFORM)
mbed_resources += toolchain.scan_resources(MBED_HAL)
mbed_resources = None
for dir in [MBED_DRIVERS, MBED_PLATFORM, MBED_HAL]:
mbed_resources += toolchain.scan_resources(dir)
objects += toolchain.compile_sources(mbed_resources, tmp_path,
[MBED_LIBRARIES] + incdirs)
[MBED_LIBRARIES] + incdirs)
# A number of compiled files need to be copied as objects as opposed to
# being part of the mbed library, for reasons that have to do with the
# way the linker search for symbols in archives. These are:
# - retarget.o: to make sure that the C standard lib symbols get
# overridden

View File

@ -14,8 +14,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from tools.paths import MBED_RTX, RTOS_LIBRARIES, MBED_LIBRARIES, MBED_RPC,\
RTOS_ABSTRACTION, RPC_LIBRARY, USB, USB_LIBRARIES, USB_HOST,\
from tools.paths import MBED_RTX, RTOS, RTOS_LIBRARIES, MBED_LIBRARIES,\
MBED_RPC, RPC_LIBRARY, USB, USB_LIBRARIES, USB_HOST,\
USB_HOST_LIBRARIES, FAT_FS, DSP_ABSTRACTION, DSP_CMSIS, DSP_LIBRARIES,\
SD_FS, FS_LIBRARY, ETH_SOURCES, LWIP_SOURCES, ETH_LIBRARY, UBLOX_SOURCES,\
UBLOX_LIBRARY, CELLULAR_SOURCES, CELLULAR_USB_SOURCES, CPPUTEST_SRC,\
@ -36,7 +36,7 @@ LIBRARIES = [
},
{
"id": "rtos",
"source_dir": RTOS_ABSTRACTION,
"source_dir": RTOS,
"build_dir": RTOS_LIBRARIES,
"dependencies": [MBED_LIBRARIES, MBED_RTX],
},
@ -62,7 +62,7 @@ LIBRARIES = [
"id": "usb_host",
"source_dir": USB_HOST,
"build_dir": USB_HOST_LIBRARIES,
"dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_ABSTRACTION],
"dependencies": [MBED_LIBRARIES, FAT_FS, MBED_RTX, RTOS_LIBRARIES],
},
# DSP libraries

View File

@ -39,6 +39,9 @@ MBED_HAL = join(ROOT, "hal")
MBED_TARGETS_PATH = join(ROOT, "targets")
MBED_LIBRARIES = join(BUILD_DIR, "mbed")
MBED_LIBRARIES_DRIVERS = join(MBED_LIBRARIES, "drivers")
MBED_LIBRARIES_PLATFORM = join(MBED_LIBRARIES, "platform")
MBED_LIBRARIES_HAL = join(MBED_LIBRARIES, "hal")
MBED_CONFIG_FILE = join(ROOT, "platform/mbed_lib.json")
@ -54,7 +57,6 @@ RPC_LIBRARY = join(BUILD_DIR, "rpc")
# mbed RTOS
RTOS = join(ROOT, "rtos")
MBED_RTX = join(RTOS, "rtx")
RTOS_ABSTRACTION = RTOS
RTOS_LIBRARIES = join(BUILD_DIR, "rtos")