From 2c3481297cd26a4c5b56431ff8f5b352ed2411f9 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Fri, 19 Feb 2021 13:39:32 +0000 Subject: [PATCH] CMake: Create CMSIS library targets to remove dependency on MBED_TARGET_LABELS This goes towards eventually removing reliance on targets.json to specify the requirements of Mbed targets. --- cmsis/CMSIS_5/CMSIS/CMakeLists.txt | 10 +++------- cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt | 8 +++++--- cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt | 8 +++++--- targets/TARGET_ARM_FM/CMakeLists.txt | 4 +++- targets/TARGET_ARM_SSG/CMakeLists.txt | 4 +++- targets/TARGET_Ambiq_Micro/CMakeLists.txt | 2 ++ targets/TARGET_Analog_Devices/CMakeLists.txt | 2 ++ targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt | 2 ++ targets/TARGET_Freescale/CMakeLists.txt | 2 ++ targets/TARGET_GigaDevice/CMakeLists.txt | 4 +++- targets/TARGET_Maxim/CMakeLists.txt | 4 +++- targets/TARGET_NORDIC/CMakeLists.txt | 2 ++ targets/TARGET_NXP/CMakeLists.txt | 2 ++ targets/TARGET_RENESAS/CMakeLists.txt | 4 +++- targets/TARGET_STM/CMakeLists.txt | 4 +++- .../TARGET_Samsung/TARGET_SIDK_S1SBP6A/CMakeLists.txt | 4 +++- .../TARGET_Samsung/TARGET_SIDK_S5JS100/CMakeLists.txt | 4 ++-- targets/TARGET_Silicon_Labs/CMakeLists.txt | 2 ++ targets/TARGET_TOSHIBA/CMakeLists.txt | 2 ++ 19 files changed, 52 insertions(+), 22 deletions(-) diff --git a/cmsis/CMSIS_5/CMSIS/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/CMakeLists.txt index 6d0f9bb5482..64b07849972 100644 --- a/cmsis/CMSIS_5/CMSIS/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/CMakeLists.txt @@ -1,9 +1,5 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. +# Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if("CORTEX_A" IN_LIST MBED_TARGET_LABELS) - add_subdirectory(TARGET_CORTEX_A) -elseif("CORTEX_M" IN_LIST MBED_TARGET_LABELS) - add_subdirectory(TARGET_CORTEX_M) -endif() - +add_subdirectory(TARGET_CORTEX_A EXCLUDE_FROM_ALL) +add_subdirectory(TARGET_CORTEX_M EXCLUDE_FROM_ALL) diff --git a/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt index d31ef5d4ab7..cdd29d79f4b 100644 --- a/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_A/CMakeLists.txt @@ -1,12 +1,14 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. +# Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_include_directories(mbed-core +add_library(mbed-cmsis-cortex-a INTERFACE) + +target_include_directories(mbed-cmsis-cortex-a INTERFACE Include ) -target_sources(mbed-core +target_sources(mbed-cmsis-cortex-a INTERFACE Source/irq_ctrl_gic.c ) diff --git a/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt index f13c8c6ce83..b944fe4247a 100644 --- a/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/CMakeLists.txt @@ -1,12 +1,14 @@ -# Copyright (c) 2020 ARM Limited. All rights reserved. +# Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_include_directories(mbed-core +add_library(mbed-cmsis-cortex-m INTERFACE) + +target_include_directories(mbed-cmsis-cortex-m INTERFACE Include ) -target_sources(mbed-core +target_sources(mbed-cmsis-cortex-m INTERFACE Source/mbed_tz_context.c ) diff --git a/targets/TARGET_ARM_FM/CMakeLists.txt b/targets/TARGET_ARM_FM/CMakeLists.txt index 2743e280d91..9cb306bf6cc 100644 --- a/targets/TARGET_ARM_FM/CMakeLists.txt +++ b/targets/TARGET_ARM_FM/CMakeLists.txt @@ -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 add_library(mbed-arm-fm INTERFACE) @@ -9,3 +9,5 @@ target_include_directories(mbed-arm-fm INTERFACE . ) + +target_link_libraries(mbed-arm-fm INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_ARM_SSG/CMakeLists.txt b/targets/TARGET_ARM_SSG/CMakeLists.txt index 7c022c221c7..e81a3f23d99 100644 --- a/targets/TARGET_ARM_SSG/CMakeLists.txt +++ b/targets/TARGET_ARM_SSG/CMakeLists.txt @@ -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 add_library(mbed-arm-ssg INTERFACE) @@ -12,3 +12,5 @@ target_include_directories(mbed-arm-ssg INTERFACE . ) + +target_link_libraries(mbed-arm-ssg INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_Ambiq_Micro/CMakeLists.txt b/targets/TARGET_Ambiq_Micro/CMakeLists.txt index cf589277f29..b4dcbe0c510 100644 --- a/targets/TARGET_Ambiq_Micro/CMakeLists.txt +++ b/targets/TARGET_Ambiq_Micro/CMakeLists.txt @@ -24,3 +24,5 @@ target_sources(mbed-ambiq-micro sdk/utils/am_util_string.c sdk/utils/am_util_time.c ) + +target_link_libraries(mbed-ambiq-micro INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_Analog_Devices/CMakeLists.txt b/targets/TARGET_Analog_Devices/CMakeLists.txt index 49645d8fab4..a768deae5b3 100644 --- a/targets/TARGET_Analog_Devices/CMakeLists.txt +++ b/targets/TARGET_Analog_Devices/CMakeLists.txt @@ -10,3 +10,5 @@ target_include_directories(mbed-analog-devices INTERFACE . ) + +target_link_libraries(mbed-analog-devices INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt b/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt index eccb5965fc3..7fe1b4c5f08 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt +++ b/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt @@ -280,6 +280,8 @@ target_sources(mbed-psoc6 ${ASSEMBLY_ROUTINES} ) +target_link_libraries(mbed-psoc6 INTERFACE mbed-cmsis-cortex-m) + # TODO: Include only if mbed-baremetal is not used if("CY_RTOS_AWARE" IN_LIST MBED_CONFIG_DEFINITIONS) target_link_libraries(mbed-psoc6 INTERFACE mbed-cy-rtos mbed-cy-rtx) diff --git a/targets/TARGET_Freescale/CMakeLists.txt b/targets/TARGET_Freescale/CMakeLists.txt index 86d31336ed2..0d5f25655b8 100644 --- a/targets/TARGET_Freescale/CMakeLists.txt +++ b/targets/TARGET_Freescale/CMakeLists.txt @@ -15,3 +15,5 @@ target_sources(mbed-freescale INTERFACE USBPhy_Kinetis.cpp ) + +target_link_libraries(mbed-freescale INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_GigaDevice/CMakeLists.txt b/targets/TARGET_GigaDevice/CMakeLists.txt index dcaa0af40b3..4748be10e44 100644 --- a/targets/TARGET_GigaDevice/CMakeLists.txt +++ b/targets/TARGET_GigaDevice/CMakeLists.txt @@ -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 add_subdirectory(TARGET_GD32F30X EXCLUDE_FROM_ALL) @@ -10,3 +10,5 @@ target_include_directories(mbed-gigadevice INTERFACE . ) + +target_link_libraries(mbed-gigadevice INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_Maxim/CMakeLists.txt b/targets/TARGET_Maxim/CMakeLists.txt index aa1e2ca4a6f..3b4402d8539 100644 --- a/targets/TARGET_Maxim/CMakeLists.txt +++ b/targets/TARGET_Maxim/CMakeLists.txt @@ -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 @@ -17,3 +17,5 @@ target_sources(mbed-maxim INTERFACE USBPhy_Maxim.cpp ) + +target_link_libraries(mbed-maxim INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_NORDIC/CMakeLists.txt b/targets/TARGET_NORDIC/CMakeLists.txt index f3c0c56577a..ab8009bee2e 100644 --- a/targets/TARGET_NORDIC/CMakeLists.txt +++ b/targets/TARGET_NORDIC/CMakeLists.txt @@ -9,3 +9,5 @@ target_include_directories(mbed-nordic INTERFACE . ) + +target_link_libraries(mbed-nordic INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_NXP/CMakeLists.txt b/targets/TARGET_NXP/CMakeLists.txt index e42f86e3fd6..e519a4453d7 100644 --- a/targets/TARGET_NXP/CMakeLists.txt +++ b/targets/TARGET_NXP/CMakeLists.txt @@ -16,3 +16,5 @@ target_sources(mbed-nxp INTERFACE USBHAL_LPC17.cpp ) + +target_link_libraries(mbed-nxp INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_RENESAS/CMakeLists.txt b/targets/TARGET_RENESAS/CMakeLists.txt index b526fd3fe39..9ee79c9268c 100644 --- a/targets/TARGET_RENESAS/CMakeLists.txt +++ b/targets/TARGET_RENESAS/CMakeLists.txt @@ -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 add_subdirectory(TARGET_RZ_A1XX EXCLUDE_FROM_ALL) @@ -10,3 +10,5 @@ target_include_directories(mbed-renesas INTERFACE . ) + +target_link_libraries(mbed-renesas INTERFACE mbed-cmsis-cortex-a) diff --git a/targets/TARGET_STM/CMakeLists.txt b/targets/TARGET_STM/CMakeLists.txt index 09780ebcffb..5d9609f7955 100644 --- a/targets/TARGET_STM/CMakeLists.txt +++ b/targets/TARGET_STM/CMakeLists.txt @@ -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 add_subdirectory(TARGET_STM32F0 EXCLUDE_FROM_ALL) @@ -51,3 +51,5 @@ target_sources(mbed-stm us_ticker.c watchdog_api.c ) + +target_link_libraries(mbed-stm INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_Samsung/TARGET_SIDK_S1SBP6A/CMakeLists.txt b/targets/TARGET_Samsung/TARGET_SIDK_S1SBP6A/CMakeLists.txt index feeac9544c5..bb247d8c3cb 100644 --- a/targets/TARGET_Samsung/TARGET_SIDK_S1SBP6A/CMakeLists.txt +++ b/targets/TARGET_Samsung/TARGET_SIDK_S1SBP6A/CMakeLists.txt @@ -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 if(${MBED_TOOLCHAIN} STREQUAL "ARM") @@ -44,3 +44,5 @@ target_sources(mbed-s1sbp6a ) mbed_set_linker_script(mbed-s1sbp6a ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) + +target_link_libraries(mbed-s1sbp6a INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_Samsung/TARGET_SIDK_S5JS100/CMakeLists.txt b/targets/TARGET_Samsung/TARGET_SIDK_S5JS100/CMakeLists.txt index 67b64c1dcb9..00ff2385d72 100644 --- a/targets/TARGET_Samsung/TARGET_SIDK_S5JS100/CMakeLists.txt +++ b/targets/TARGET_Samsung/TARGET_SIDK_S5JS100/CMakeLists.txt @@ -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 if(${MBED_TOOLCHAIN} STREQUAL "ARM") @@ -64,4 +64,4 @@ target_sources(mbed-s5js100 mbed_set_linker_script(mbed-s5js100 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) -target_link_libraries(mbed-s5js100) +target_link_libraries(mbed-s5js100 INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_Silicon_Labs/CMakeLists.txt b/targets/TARGET_Silicon_Labs/CMakeLists.txt index 6e4ca12703f..fc1206818e1 100644 --- a/targets/TARGET_Silicon_Labs/CMakeLists.txt +++ b/targets/TARGET_Silicon_Labs/CMakeLists.txt @@ -10,3 +10,5 @@ target_include_directories(mbed-silicon-labs INTERFACE . ) + +target_link_libraries(mbed-silicon-labs INTERFACE mbed-cmsis-cortex-m) diff --git a/targets/TARGET_TOSHIBA/CMakeLists.txt b/targets/TARGET_TOSHIBA/CMakeLists.txt index 482c9752025..bbad8b524f0 100644 --- a/targets/TARGET_TOSHIBA/CMakeLists.txt +++ b/targets/TARGET_TOSHIBA/CMakeLists.txt @@ -10,3 +10,5 @@ target_include_directories(mbed-toshiba INTERFACE . ) + +target_link_libraries(mbed-toshiba INTERFACE mbed-cmsis-cortex-m)