Skip to content

CMake: Don't force users to build specific library type #15526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -40,20 +40,20 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
endif()
endif()

add_library(mbed-core INTERFACE)
add_library(mbed-core ${CMAKE_LIBRARY_TYPE})

add_library(mbed-os INTERFACE)
add_library(mbed-os ${CMAKE_LIBRARY_TYPE})

target_link_libraries(mbed-os
INTERFACE
${CMAKE_LIBRARY_TYPE}
mbed-rtos
mbed-core
)

add_library(mbed-baremetal INTERFACE)
add_library(mbed-baremetal ${CMAKE_LIBRARY_TYPE})

target_link_libraries(mbed-baremetal
INTERFACE
${CMAKE_LIBRARY_TYPE}
mbed-core
)
# Validate selected C library type
@@ -92,15 +92,15 @@ if(${CMAKE_CROSSCOMPILING})
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})

target_compile_features(mbed-core
INTERFACE
${CMAKE_LIBRARY_TYPE}
c_std_11
cxx_std_14
)

endif()

target_compile_definitions(mbed-core
INTERFACE
${CMAKE_LIBRARY_TYPE}
TARGET_NAME=${MBED_TARGET}
${MBED_TARGET_DEFINITIONS}
${MBED_CONFIG_DEFINITIONS}
@@ -110,7 +110,7 @@ if(${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
if(NOT BUILD_GREENTEA_TESTS)
target_compile_definitions(${PROJECT_NAME}
INTERFACE
${CMAKE_LIBRARY_TYPE}
MBED_TEST_MODE
)
endif()
@@ -135,30 +135,30 @@ if(${CMAKE_CROSSCOMPILING})
# for the GCC_ARM and ARM toolchains respectively.
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
target_compile_definitions(mbed-core
INTERFACE
${CMAKE_LIBRARY_TYPE}
TOOLCHAIN_GCC_ARM
TOOLCHAIN_GCC
)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
target_compile_definitions(mbed-core
INTERFACE
${CMAKE_LIBRARY_TYPE}
TOOLCHAIN_ARM
)
endif()
endif()

# Include mbed.h and config from generate folder
target_include_directories(mbed-core
INTERFACE
${CMAKE_LIBRARY_TYPE}
${CMAKE_CURRENT_SOURCE_DIR}
)

# These targets are made visible here so their source files which
# are spread in different directories can be referenced and can be linked against
# by libraries that depend on them.
# TODO CMake: Should the source files be moved?
add_library(mbed-device_key INTERFACE)
add_library(mbed-rtos INTERFACE)
add_library(mbed-device_key ${CMAKE_LIBRARY_TYPE})
add_library(mbed-rtos ${CMAKE_LIBRARY_TYPE})

# Include targets/ first, because any post-build hook needs to be defined
# before other parts of Mbed OS can add greentea tests which require
@@ -188,7 +188,7 @@ if(${CMAKE_CROSSCOMPILING})
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
string(PREPEND MBED_TARGET_CONVERTED "mbed-")

target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED})
target_link_libraries(mbed-core ${CMAKE_LIBRARY_TYPE} ${MBED_TARGET_CONVERTED})
endif()

# Ninja requires to be forced for response files
6 changes: 3 additions & 3 deletions cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-cmsis-cortex-a INTERFACE)
add_library(mbed-cmsis-cortex-a ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-cmsis-cortex-a
INTERFACE
${CMAKE_LIBRARY_TYPE}
Include
)

target_sources(mbed-cmsis-cortex-a
INTERFACE
${CMAKE_LIBRARY_TYPE}
Source/irq_ctrl_gic.c
)
6 changes: 3 additions & 3 deletions cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-cmsis-cortex-m INTERFACE)
add_library(mbed-cmsis-cortex-m ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-cmsis-cortex-m
INTERFACE
${CMAKE_LIBRARY_TYPE}
Include
)

target_sources(mbed-cmsis-cortex-m
INTERFACE
${CMAKE_LIBRARY_TYPE}
Source/mbed_tz_context.c
)
42 changes: 21 additions & 21 deletions connectivity/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,27 +2,27 @@
# SPDX-License-Identifier: Apache-2.0

# List of all connectivity libraries available.
add_library(mbed-802.15.4-rf INTERFACE)
add_library(mbed-ble INTERFACE)
add_library(mbed-ble-cordio INTERFACE)
add_library(mbed-ble-cordio_ll INTERFACE)
add_library(mbed-cellular INTERFACE)
add_library(mbed-coap INTERFACE)
add_library(mbed-emac INTERFACE)
add_library(mbed-lorawan INTERFACE)
add_library(mbed-lwipstack INTERFACE)
add_library(mbed-mbedtls INTERFACE)
add_library(mbed-nanostack INTERFACE)
add_library(mbed-nanostack-coap_service INTERFACE)
add_library(mbed-nanostack-mbed_mesh_api INTERFACE)
add_library(mbed-nanostack-hal_mbed_cmsis_rtos INTERFACE)
add_library(mbed-nanostack-sal_stack INTERFACE)
add_library(mbed-nanostack-sal_stack-event_loop INTERFACE)
add_library(mbed-nanostack-libservice INTERFACE)
add_library(mbed-netsocket INTERFACE)
add_library(mbed-nfc INTERFACE)
add_library(mbed-ppp INTERFACE)
add_library(mbed-wifi INTERFACE)
add_library(mbed-802.15.4-rf ${CMAKE_LIBRARY_TYPE})
add_library(mbed-ble ${CMAKE_LIBRARY_TYPE})
add_library(mbed-ble-cordio ${CMAKE_LIBRARY_TYPE})
add_library(mbed-ble-cordio_ll ${CMAKE_LIBRARY_TYPE})
add_library(mbed-cellular ${CMAKE_LIBRARY_TYPE})
add_library(mbed-coap ${CMAKE_LIBRARY_TYPE})
add_library(mbed-emac ${CMAKE_LIBRARY_TYPE})
add_library(mbed-lorawan ${CMAKE_LIBRARY_TYPE})
add_library(mbed-lwipstack ${CMAKE_LIBRARY_TYPE})
add_library(mbed-mbedtls ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nanostack ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nanostack-coap_service ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nanostack-mbed_mesh_api ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nanostack-hal_mbed_cmsis_rtos ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nanostack-sal_stack ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nanostack-sal_stack-event_loop ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nanostack-libservice ${CMAKE_LIBRARY_TYPE})
add_library(mbed-netsocket ${CMAKE_LIBRARY_TYPE})
add_library(mbed-nfc ${CMAKE_LIBRARY_TYPE})
add_library(mbed-ppp ${CMAKE_LIBRARY_TYPE})
add_library(mbed-wifi ${CMAKE_LIBRARY_TYPE})

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
# Add these subdirectories for tests
8 changes: 4 additions & 4 deletions targets/TARGET_STM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -18,15 +18,15 @@ add_subdirectory(TARGET_STM32U5 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32WB EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32WL EXCLUDE_FROM_ALL)

add_library(mbed-stm INTERFACE)
add_library(mbed-stm ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-stm
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_sources(mbed-stm
INTERFACE
${CMAKE_LIBRARY_TYPE}
USBPhy_STM32.cpp
analogin_api.c
analogout_api.c
@@ -53,4 +53,4 @@ target_sources(mbed-stm
watchdog_api.c
)

target_link_libraries(mbed-stm INTERFACE mbed-cmsis-cortex-m)
target_link_libraries(mbed-stm ${CMAKE_LIBRARY_TYPE} mbed-cmsis-cortex-m)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -7,15 +7,15 @@ add_subdirectory(TARGET_STM32F070xB EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32F030x8 EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32f0 INTERFACE)
add_library(mbed-stm32f0 ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-stm32f0
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_sources(mbed-stm32f0
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
cmsis_nvic.c
@@ -27,4 +27,4 @@ target_sources(mbed-stm32f0
spi_api.c
)

target_link_libraries(mbed-stm32f0 INTERFACE mbed-stm mbed-stm32f0cube-fw)
target_link_libraries(mbed-stm32f0 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32f0cube-fw)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ add_subdirectory(TARGET_STM32F103xE EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32F103xG EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32f1 INTERFACE)
add_library(mbed-stm32f1 ${CMAKE_LIBRARY_TYPE})

target_sources(mbed-stm32f1
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -23,8 +23,8 @@ target_sources(mbed-stm32f1
)

target_include_directories(mbed-stm32f1
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_link_libraries(mbed-stm32f1 INTERFACE mbed-stm mbed-stm32f1cube-fw)
target_link_libraries(mbed-stm32f1 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32f1cube-fw)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -4,10 +4,10 @@
add_subdirectory(TARGET_STM32F207xG EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32f2 INTERFACE)
add_library(mbed-stm32f2 ${CMAKE_LIBRARY_TYPE})

target_sources(mbed-stm32f2
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -18,12 +18,12 @@ target_sources(mbed-stm32f2
)

target_include_directories(mbed-stm32f2
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
./STM32Cube_FW
./STM32Cube_FW/CMSIS
./STM32Cube_FW/STM32F2xx_HAL_Driver
./STM32Cube_FW/STM32F2xx_HAL_Driver/Legacy
)

target_link_libraries(mbed-stm32f2 INTERFACE mbed-stm mbed-stm32f2cube-fw)
target_link_libraries(mbed-stm32f2 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32f2cube-fw)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -8,15 +8,15 @@ add_subdirectory(TARGET_STM32F303xE EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32F334x8 EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32f3 INTERFACE)
add_library(mbed-stm32f3 ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-stm32f3
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_sources(mbed-stm32f3
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -27,4 +27,4 @@ target_sources(mbed-stm32f3
spi_api.c
)

target_link_libraries(mbed-stm32f3 INTERFACE mbed-stm mbed-stm32f3cube-fw)
target_link_libraries(mbed-stm32f3 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32f3cube-fw)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -39,15 +39,15 @@ add_subdirectory(TARGET_STM32F479xG EXCLUDE_FROM_ALL)

add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32f4 INTERFACE)
add_library(mbed-stm32f4 ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-stm32f4
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_sources(mbed-stm32f4
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -57,4 +57,4 @@ target_sources(mbed-stm32f4
spi_api.c
)

target_link_libraries(mbed-stm32f4 INTERFACE mbed-stm mbed-stm32f4cube-fw)
target_link_libraries(mbed-stm32f4 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32f4cube-fw)
Original file line number Diff line number Diff line change
@@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f407xe.sct)
endif()

add_library(mbed-stm32f407xe INTERFACE)
add_library(mbed-stm32f407xe ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-stm32f407xe
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_sources(mbed-stm32f407xe
INTERFACE
${CMAKE_LIBRARY_TYPE}
${STARTUP_FILE}
system_clock.c
)

mbed_set_linker_script(mbed-stm32f407xe ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(mbed-stm32f407xe INTERFACE mbed-stm32f4)
target_link_libraries(mbed-stm32f407xe ${CMAKE_LIBRARY_TYPE} mbed-stm32f4)
Original file line number Diff line number Diff line change
@@ -9,18 +9,20 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f429xg.sct)
endif()

add_library(mbed-stm32f429xg INTERFACE)
add_library(mbed-stm32f429xg ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-stm32f429xg
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_sources(mbed-stm32f429xg
INTERFACE
${CMAKE_LIBRARY_TYPE}
${STARTUP_FILE}
)

mbed_set_linker_script(mbed-stm32f429xg ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(mbed-stm32f429xg INTERFACE mbed-stm32f4)
target_link_libraries(mbed-stm32f429xg
${CMAKE_LIBRARY_TYPE}
INTERFACE mbed-stm32f4)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F7/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@ add_subdirectory(TARGET_STM32F767xI EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32F769xI EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32f7 INTERFACE)
add_library(mbed-stm32f7 ${CMAKE_LIBRARY_TYPE})

target_sources(mbed-stm32f7
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -24,8 +24,8 @@ target_sources(mbed-stm32f7


target_include_directories(mbed-stm32f7
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_link_libraries(mbed-stm32f7 INTERFACE mbed-stm mbed-stm32f7cube-fw)
target_link_libraries(mbed-stm32f7 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32f7cube-fw)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32G0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -17,15 +17,15 @@ add_subdirectory(TARGET_STM32G0C1xE EXCLUDE_FROM_ALL)

add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32g0 INTERFACE)
add_library(mbed-stm32g0 ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-stm32g0
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_sources(mbed-stm32g0
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -36,4 +36,4 @@ target_sources(mbed-stm32g0
spi_api.c
)

target_link_libraries(mbed-stm32g0 INTERFACE mbed-stm mbed-stm32g0cube-fw)
target_link_libraries(mbed-stm32g0 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32g0cube-fw)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32G4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -12,10 +12,10 @@ add_subdirectory(TARGET_STM32G491xE EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32G4A1xE EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32g4 INTERFACE)
add_library(mbed-stm32g4 ${CMAKE_LIBRARY_TYPE})

target_sources(mbed-stm32g4
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -27,8 +27,8 @@ target_sources(mbed-stm32g4
)

target_include_directories(mbed-stm32g4
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_link_libraries(mbed-stm32g4 INTERFACE mbed-stm mbed-stm32g4cube-fw)
target_link_libraries(mbed-stm32g4 ${CMAKE_LIBRARY_TYPE} mbed-stm mbed-stm32g4cube-fw)
14 changes: 7 additions & 7 deletions targets/TARGET_STM/TARGET_STM32H7/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -13,10 +13,10 @@ add_subdirectory(TARGET_STM32H7A3xIQ EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32H7B3xIQ EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(mbed-stm32h7 INTERFACE)
add_library(mbed-stm32h7 ${CMAKE_LIBRARY_TYPE})

target_sources(mbed-stm32h7
INTERFACE
${CMAKE_LIBRARY_TYPE}
analogin_device.c
analogout_device.c
flash_api.c
@@ -28,18 +28,18 @@ target_sources(mbed-stm32h7
)

target_include_directories(mbed-stm32h7
INTERFACE
${CMAKE_LIBRARY_TYPE}
.
)

target_link_libraries(mbed-stm32h7 INTERFACE mbed-stm mbed-stm32h7cube-fw)
target_link_libraries(mbed-stm32h7 ${CMAKE_LIBRARY_TYPE} INTERFACE mbed-stm mbed-stm32h7cube-fw)


# Add clock file depending on the frequency
if("STM32H7_480MHZ" IN_LIST MBED_TARGET_LABELS)
target_sources(mbed-stm32h7 INTERFACE clock_cfg/TARGET_STM32H7_480MHZ/system_clock.c)
target_sources(mbed-stm32h7 ${CMAKE_LIBRARY_TYPE} INTERFACE clock_cfg/TARGET_STM32H7_480MHZ/system_clock.c)
elseif("STM32H7_550MHZ" IN_LIST MBED_TARGET_LABELS)
target_sources(mbed-stm32h7 INTERFACE clock_cfg/TARGET_STM32H7_550MHZ/system_clock.c)
target_sources(mbed-stm32h7 ${CMAKE_LIBRARY_TYPE} INTERFACE clock_cfg/TARGET_STM32H7_550MHZ/system_clock.c)
elseif("STM32H7_280MHZ" IN_LIST MBED_TARGET_LABELS)
target_sources(mbed-stm32h7 INTERFACE clock_cfg/TARGET_STM32H7_280MHZ/system_clock.c)
target_sources(mbed-stm32h7 ${CMAKE_LIBRARY_TYPE} INTERFACE clock_cfg/TARGET_STM32H7_280MHZ/system_clock.c)
endif()
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-1024k INTERFACE)
add_library(mbed-1024k ${CMAKE_LIBRARY_TYPE})

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TARGET_1024K/TOOLCHAIN_ARM_STD/efm32gg.sct)
@@ -12,12 +12,12 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
endif()

target_include_directories(mbed-1024k
INTERFACE
${CMAKE_LIBRARY_TYPE}
device
)

target_sources(mbed-1024k
INTERFACE
${CMAKE_LIBRARY_TYPE}
PeripheralPins.c

device/system_efm32gg.c
@@ -26,15 +26,15 @@ target_sources(mbed-1024k

mbed_set_linker_script(mbed-1024k ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

add_library(mbed-efm32gg990f1024 INTERFACE)
add_library(mbed-efm32gg990f1024 ${CMAKE_LIBRARY_TYPE})

target_link_libraries(mbed-efm32gg990f1024 INTERFACE mbed-efm32 mbed-1024k)
target_link_libraries(mbed-efm32gg990f1024 ${CMAKE_LIBRARY_TYPE} mbed-efm32 mbed-1024k)

add_library(mbed-efm32gg-stk3700 INTERFACE)
add_library(mbed-efm32gg-stk3700 ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-efm32gg-stk3700
INTERFACE
${CMAKE_LIBRARY_TYPE}
TARGET_EFM32GG_STK3700
)

target_link_libraries(mbed-efm32gg-stk3700 INTERFACE mbed-efm32gg990f1024)
target_link_libraries(mbed-efm32gg-stk3700 ${CMAKE_LIBRARY_TYPE} mbed-efm32gg990f1024)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-efm32gg11 INTERFACE)
add_library(mbed-efm32gg11 ${CMAKE_LIBRARY_TYPE})

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/efm32gg11.sct)
@@ -12,27 +12,27 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
endif()

target_include_directories(mbed-efm32gg11
INTERFACE
${CMAKE_LIBRARY_TYPE}
device
)

target_sources(mbed-efm32gg11
INTERFACE
${CMAKE_LIBRARY_TYPE}
PeripheralPins.c

device/system_efm32gg11b.c
${STARTUP_FILE}
)

target_link_libraries(mbed-efm32gg11 INTERFACE mbed-efm32)
target_link_libraries(mbed-efm32gg11 ${CMAKE_LIBRARY_TYPE} mbed-efm32)

mbed_set_linker_script(mbed-efm32gg11 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

add_library(mbed-efm32gg11-stk3701 INTERFACE)
add_library(mbed-efm32gg11-stk3701 ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-efm32gg11-stk3701
INTERFACE
${CMAKE_LIBRARY_TYPE}
TARGET_EFM32GG11_STK3701
)

target_link_libraries(mbed-efm32gg11-stk3701 INTERFACE mbed-efm32gg11)
target_link_libraries(mbed-efm32gg11-stk3701 ${CMAKE_LIBRARY_TYPE} mbed-efm32gg11)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-efm32mg12 INTERFACE)
add_library(mbed-efm32mg12 ${CMAKE_LIBRARY_TYPE})

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/efr32mg12p.sct)
@@ -12,27 +12,27 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
endif()

target_include_directories(mbed-efm32mg12
INTERFACE
${CMAKE_LIBRARY_TYPE}
device
)

target_sources(mbed-efm32mg12
INTERFACE
${CMAKE_LIBRARY_TYPE}
PeripheralPins.c

device/system_efr32mg12p.c
${STARTUP_FILE}
)

target_link_libraries(mbed-efm32mg12 INTERFACE mbed-efm32)
target_link_libraries(mbed-efm32mg12 ${CMAKE_LIBRARY_TYPE} mbed-efm32)

mbed_set_linker_script(mbed-efm32mg12 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

add_library(mbed-tb-sense-12 INTERFACE)
add_library(mbed-tb-sense-12 ${CMAKE_LIBRARY_TYPE})

target_include_directories(mbed-tb-sense-12
INTERFACE
${CMAKE_LIBRARY_TYPE}
TARGET_TB_SENSE_12
)

target_link_libraries(mbed-tb-sense-12 INTERFACE mbed-efm32mg12 mbed-sl-rail-efr32-12)
target_link_libraries(mbed-tb-sense-12 ${CMAKE_LIBRARY_TYPE} mbed-efm32mg12 mbed-sl-rail-efr32-12)
7 changes: 3 additions & 4 deletions targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sl-rail-efr32-12 INTERFACE)
add_library(mbed-sl-rail-efr32-12 ${CMAKE_LIBRARY_TYPE})

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIB_RAIL efr32-rf-driver/rail/TARGET_EFR32_12/librail_efr32xg12_release.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIB_RAIL efr32-rf-driver/rail/TARGET_EFR32_12/librail_efr32xg12_release.a)
endif()

target_link_libraries(mbed-sl-rail-efr32-12 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_RAIL})

target_link_libraries(mbed-sl-rail-efr32-12 ${CMAKE_LIBRARY_TYPE} ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_RAIL})

target_include_directories(mbed-sl-rail-efr32-12
INTERFACE
${CMAKE_LIBRARY_TYPE}
efr32-rf-driver/rail
efr32-rf-driver/rail/ble
efr32-rf-driver/rail/ieee802154