Skip to content

Commit bc61170

Browse files
committed
[restructure] Worked around dropped namespaces in build_travis
The platform/driver header files can not be correctly namespaced due to header flattening in tools/build_api.py.
1 parent d8f31ce commit bc61170

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

mbed.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121

2222
// Common codebase
23-
#include "platform/platform.h"
24-
#include "drivers/drivers.h"
23+
#include "platform.h"
24+
#include "drivers.h"
2525

2626
// RTOS
2727
#if MBED_CONF_RTOS_PRESENT

tools/build_api.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import fnmatch
2929

3030
from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException, ToolException, InvalidReleaseTargetException
31-
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_DRIVERS, MBED_PLATFORM, MBED_CONFIG_FILE
31+
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_DRIVERS, MBED_PLATFORM, MBED_HAL, MBED_CONFIG_FILE
3232
from tools.targets import TARGET_NAMES, TARGET_MAP
3333
from tools.libraries import Library
3434
from tools.toolchains import TOOLCHAIN_CLASSES
@@ -715,8 +715,9 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
715715

716716
# Common Headers
717717
toolchain.copy_files(['mbed.h'], MBED_LIBRARIES)
718-
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers, join(MBED_LIBRARIES, 'drivers'))
719-
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers, join(MBED_LIBRARIES, 'platform'))
718+
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers, MBED_LIBRARIES)
719+
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers, MBED_LIBRARIES)
720+
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers, MBED_LIBRARIES)
720721

721722
# Target specific sources
722723
HAL_SRC = MBED_TARGETS_PATH
@@ -726,7 +727,9 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
726727
objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES] + incdirs)
727728

728729
# Common Sources
729-
mbed_resources = toolchain.scan_resources(MBED_DRIVERS) + toolchain.scan_resources(MBED_PLATFORM)
730+
mbed_resources = (toolchain.scan_resources(MBED_DRIVERS)
731+
+ toolchain.scan_resources(MBED_PLATFORM)
732+
+ toolchain.scan_resources(MBED_HAL))
730733
objects += toolchain.compile_sources(mbed_resources, TMP_PATH, [MBED_LIBRARIES] + incdirs)
731734

732735
# A number of compiled files need to be copied as objects as opposed to
@@ -941,8 +944,9 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM
941944

942945
# Common Headers
943946
toolchain.copy_files(['mbed.h'], MBED_LIBRARIES)
944-
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers, join(MBED_LIBRARIES, 'drivers'))
945-
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers, join(MBED_LIBRARIES, 'platform'))
947+
toolchain.copy_files(toolchain.scan_resources(MBED_DRIVERS).headers, MBED_LIBRARIES)
948+
toolchain.copy_files(toolchain.scan_resources(MBED_PLATFORM).headers, MBED_LIBRARIES)
949+
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers, MBED_LIBRARIES)
946950

947951
# Target specific sources
948952
HAL_SRC = MBED_TARGETS_PATH
@@ -960,13 +964,16 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM
960964
target_macros = ["-D%s"% s for s in toolchain.get_symbols() + toolchain.macros]
961965

962966
# Common Sources
963-
mbed_resources = toolchain.scan_resources(MBED_DRIVERS) + toolchain.scan_resources(MBED_PLATFORM)
967+
mbed_resources = (toolchain.scan_resources(MBED_DRIVERS)
968+
+ toolchain.scan_resources(MBED_PLATFORM)
969+
+ toolchain.scan_resources(MBED_HAL))
964970

965971
# Gather include paths, c, cpp sources and macros to transfer to cppcheck command line
966972
mbed_includes = ["-I%s" % i for i in mbed_resources.inc_dirs]
967973
mbed_includes.append("-I%s"% str(BUILD_TARGET))
968974
mbed_includes.append("-I%s"% str(MBED_DRIVERS))
969975
mbed_includes.append("-I%s"% str(MBED_PLATFORM))
976+
mbed_includes.append("-I%s"% str(MBED_HAL))
970977
mbed_c_sources = " ".join(mbed_resources.c_sources)
971978
mbed_cpp_sources = " ".join(mbed_resources.cpp_sources)
972979

tools/paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# mbed libraries
3434
MBED_DRIVERS = join(ROOT, "drivers")
3535
MBED_PLATFORM = join(ROOT, "platform")
36-
36+
MBED_HAL = join(ROOT, "hal")
3737
MBED_TARGETS_PATH = join(ROOT, "targets")
3838

3939
MBED_LIBRARIES = join(BUILD_DIR, "mbed")

0 commit comments

Comments
 (0)