From 735eef7afddf464cf29ddea73c8de9319e00ba35 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Wed, 17 Jun 2020 15:10:55 +0100 Subject: [PATCH 1/5] Add CMakelists The CMake support is still in development. For more information, see mbed-os/cmake/README.md --- CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8032273 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.18.2 FATAL_ERROR) + +# TODO: @mbed-os-tools MBED_ROOT and MBED_CONFIG_PATH should probably come from mbedtools +set(MBED_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "") +set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "") +set(APP_TARGET mbed-os-example-cellular) + +add_subdirectory(${MBED_ROOT}) + +add_executable(${APP_TARGET}) + +mbed_configure_app_target(${APP_TARGET}) + +mbed_set_mbed_target_linker_script(${APP_TARGET}) + +project(${APP_TARGET}) + +target_sources(${APP_TARGET} + PRIVATE + main.cpp +) + +target_link_libraries(${APP_TARGET} mbed-os) + +mbed_generate_bin_hex(${APP_TARGET}) + +option(VERBOSE_BUILD "Have a verbose build process") +if(VERBOSE_BUILD) + set(CMAKE_VERBOSE_MAKEFILE ON) +endif() From a511326d76f4f62d1c88b09816ffc534301340ec Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Tue, 6 Oct 2020 00:07:35 +0100 Subject: [PATCH 2/5] CMake: Add required Mbed OS component Mbed OS has multiple targets that can be linked to as required. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8032273..bc41a8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,10 @@ target_sources(${APP_TARGET} main.cpp ) -target_link_libraries(${APP_TARGET} mbed-os) +target_link_libraries(${APP_TARGET} + mbed-os + mbed-os-cellular +) mbed_generate_bin_hex(${APP_TARGET}) From 82bbe9a9cb74fb3e3394cbb5417a9f1e4ef47085 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Thu, 22 Oct 2020 17:42:12 +0100 Subject: [PATCH 3/5] CMake: Use renamed Mbed CMake targets component They are now prefixed with "mbed-" instead of "mbed-os-" --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc41a8e..9dcc36f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,9 @@ target_sources(${APP_TARGET} ) target_link_libraries(${APP_TARGET} - mbed-os - mbed-os-cellular + PRIVATE + mbed-os + mbed-cellular ) mbed_generate_bin_hex(${APP_TARGET}) From 7159342f8a2cf46da53607cefe14ed144834380a Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Fri, 23 Oct 2020 10:16:03 +0100 Subject: [PATCH 4/5] CMake: Perform toolchain and language setup --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dcc36f..b622bdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ set(MBED_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "") set(APP_TARGET mbed-os-example-cellular) +include(${MBED_ROOT}/tools/cmake/app.cmake) + add_subdirectory(${MBED_ROOT}) add_executable(${APP_TARGET}) From cf7c03639b5843ec375e0c9693e3c1be16068baa Mon Sep 17 00:00:00 2001 From: Rajkumar Kanagaraj Date: Wed, 4 Nov 2020 14:05:51 +0000 Subject: [PATCH 5/5] CMake: Call mbed_set_post_build API for setting post build operations - Update CMake minimum version required from 3.18.2 to 3.19.0 - Replace mbed-os source path MBED_ROOT with MBED_PATH in CMakeLists.txt --- CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b622bdc..4eafc69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,15 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.18.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) -# TODO: @mbed-os-tools MBED_ROOT and MBED_CONFIG_PATH should probably come from mbedtools -set(MBED_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "") +set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "") set(APP_TARGET mbed-os-example-cellular) -include(${MBED_ROOT}/tools/cmake/app.cmake) +include(${MBED_PATH}/tools/cmake/app.cmake) -add_subdirectory(${MBED_ROOT}) +add_subdirectory(${MBED_PATH}) add_executable(${APP_TARGET}) @@ -31,7 +30,7 @@ target_link_libraries(${APP_TARGET} mbed-cellular ) -mbed_generate_bin_hex(${APP_TARGET}) +mbed_set_post_build(${APP_TARGET}) option(VERBOSE_BUILD "Have a verbose build process") if(VERBOSE_BUILD)