mirror of https://github.com/ARMmbed/mbed-os.git
CMake: Refactor WIO_EMW3166 support
Ensure WICED is included for Mbed targets that require it. This also removes the need for checking MBED_TARGET_LABELS repeatedly and allows us to be more flexible in the way we include MBED_TARGET source in the build. A side effect of this is it will allow us to support custom targets without breaking the build for 'standard' targets, as we use CMake's standard mechanism for adding build rules to the build system, rather than implementing our own layer of logic to exclude files not needed for the target being built. Using this approach, if an MBED_TARGET is not linked to using `target_link_libraries` its source files will not be added to the build. This means custom target source can be added to the user's application CMakeLists.txt without polluting the build system when trying to compile for a standard MBED_TARGET.pull/14280/head
parent
3174a4c6a5
commit
d7a7d44b4b
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
include(../tools/cmake/set_linker_script.cmake)
|
||||
|
||||
|
@ -34,6 +34,8 @@ elseif("STM" IN_LIST MBED_TARGET_LABELS)
|
|||
add_subdirectory(TARGET_STM)
|
||||
elseif("TOSHIBA" IN_LIST MBED_TARGET_LABELS)
|
||||
add_subdirectory(TARGET_TOSHIBA)
|
||||
elseif("WICED" IN_LIST MBED_TARGET_LABELS)
|
||||
endif()
|
||||
|
||||
if("WICED" IN_LIST MBED_TARGET_LABELS)
|
||||
add_subdirectory(TARGET_WICED)
|
||||
endif()
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
add_library(WIO_EMW3166 INTERFACE)
|
||||
add_library(mbed-wio-emw3166 INTERFACE)
|
||||
|
||||
target_sources(WIO_EMW3166
|
||||
target_sources(mbed-wio-emw3166
|
||||
INTERFACE
|
||||
PeripheralPins.c
|
||||
)
|
||||
|
||||
target_include_directories(WIO_EMW3166
|
||||
target_include_directories(mbed-wio-emw3166
|
||||
INTERFACE
|
||||
.
|
||||
)
|
||||
|
||||
target_link_libraries(WIO_EMW3166 INTERFACE STM32F412xG)
|
||||
target_link_libraries(mbed-wio-emw3166 INTERFACE mbed-wiced mbed-stm32f412xg)
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if("WIO_EMW3166" IN_LIST MBED_TARGET_LABELS)
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
set(LIB_WICED_DRIVERS TOOLCHAIN_ARMC6/TARGET_WIO_EMW3166/libwiced_drivers.ar)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
set(LIB_WICED_DRIVERS TOOLCHAIN_GCC_ARM/TARGET_WIO_EMW3166/libwiced_drivers.a)
|
||||
endif()
|
||||
add_library(mbed-wiced INTERFACE)
|
||||
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
|
||||
set(LIB_WICED_DRIVERS TOOLCHAIN_ARMC6/TARGET_WIO_EMW3166/libwiced_drivers.ar)
|
||||
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
set(LIB_WICED_DRIVERS TOOLCHAIN_GCC_ARM/TARGET_WIO_EMW3166/libwiced_drivers.a)
|
||||
endif()
|
||||
|
||||
target_link_libraries(mbed-core INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_WICED_DRIVERS})
|
||||
target_link_libraries(mbed-wiced INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_WICED_DRIVERS})
|
||||
|
||||
target_include_directories(mbed-core
|
||||
target_include_directories(mbed-wiced
|
||||
INTERFACE
|
||||
wiced_interface
|
||||
)
|
||||
|
||||
target_sources(mbed-core
|
||||
target_sources(mbed-wiced
|
||||
INTERFACE
|
||||
wiced_interface/default_wifi_interface.cpp
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue