Skip to content

CMake: Call mbed_set_post_build API for setting post build operations #246

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

Merged
merged 4 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
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
27 changes: 21 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ language: sh
os: linux
dist: xenial

env:
global:
- PROFILE=develop

cache:
pip: true
ccache: true
Expand All @@ -28,8 +32,13 @@ cache:

addons:
apt:
sources:
- sourceline: 'deb https://apt.kitware.com/ubuntu/ xenial main'
key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
- sourceline: 'deb https://apt.kitware.com/ubuntu/ xenial-rc main'
packages:
- ninja-build
- cmake
- ninja-build

matrix:
include:
Expand All @@ -56,16 +65,22 @@ matrix:
- export PATH="$PATH:${PWD}/gcc-arm-none-eabi-9-2020-q2-update/bin"
- popd
- arm-none-eabi-gcc --version
- pip install --upgrade cmake
# Hide Travis-preinstalled CMake
# The Travis-preinstalled CMake is unfortunately not installed via apt, so we
# can't replace it with an apt-supplied version very easily. Additionally, we
# can't permit the Travis-preinstalled copy to survive, as the Travis default
# path lists the Travis CMake install location ahead of any place where apt
# would install CMake to. Instead of apt removing or upgrading to a new CMake
# version, we must instead delete the Travis copy of CMake.
- sudo rm -rf /usr/local/cmake*
- pip install --upgrade mbed-tools
# Fetch mbed-os: We use manual clone, with depth=1 and --single-branch to save time.
- >-
git clone --depth=1 --single-branch https://github.com/ARMmbed/mbed-os.git;
git clone --depth=1 --branch feature-cmake https://github.com/ARMmbed/mbed-os.git;
- >-
mbedtools configure -t GCC_ARM -m ${TARGET_NAME};
mkdir -p build
script:
- cd build && cmake .. -GNinja -DCMAKE_BUILD_TYPE=${PROFILE} && cmake --build .
- echo mbedtools build -t GCC_ARM -m ${TARGET_NAME} -b ${PROFILE}
- mbedtools build -t GCC_ARM -m ${TARGET_NAME} -b ${PROFILE}
- ccache -s

- <<: *cmake-build-test
Expand Down
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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-blinky)

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})

Expand All @@ -30,7 +29,7 @@ target_link_libraries(${APP_TARGET}
mbed-os
)

mbed_generate_bin_hex(${APP_TARGET})
mbed_set_post_build(${APP_TARGET})

option(VERBOSE_BUILD "Have a verbose build process")
if(VERBOSE_BUILD)
Expand Down