mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14328 from hugueskamba/hk_cmake_fix_greentea_tests
CMake: Fix Greentea testspull/14343/head
commit
737153bcc1
|
@ -88,30 +88,31 @@ cmake -S <source-dir> -B <build-dir> -DCMAKE_BUILD_TYPE=debug
|
|||
## How to build a greentea test
|
||||
|
||||
Install prerequisites suggested in the previous section and follow the below steps to build:
|
||||
* Generate the `.mbedbuild/` configuration directory for the Mbed target you want to run the test on using [mbed-os-example-blinky](https://github.com/ARMmbed/mbed-os-example-blinky)
|
||||
```
|
||||
$ mbedtools configure -t <TOOLCHAIN> -m <MBED_TARGET>
|
||||
```
|
||||
* Copy `.mbedbuild/` into the test suite directory.
|
||||
* Set your current directory to the test suite directory
|
||||
|
||||
* Cmake `MBED_TEST_LINK_LIBRARIES` command-line argument config must be passed either `mbed-os` or `mbed-baremetal` when you are building a greentea test. In addition to that, you must pass any extra library along if that library source is not maintained as part of mbed os source tree.
|
||||
* CMake `MBED_TEST_LINK_LIBRARIES` command-line argument config must be passed either `mbed-os` or `mbed-baremetal` when you are building a greentea test. In addition to that, you must pass any extra library along if that library source is not maintained as part of mbed os source tree.
|
||||
|
||||
For example:
|
||||
kvstore greentea test is dependent on `mbed-storage` and `mbed-storage-filesystemstore` library however you don't need to pass it via `MBED_TEST_LINK_LIBRARIES` as it is already target linked in greentea test CMakeLists.txt, at the same time some libraries and test cases are private to the application and if you want to use it with kvstore test then pass it with `MBED_TEST_LINK_LIBRARIES` command-line argument.
|
||||
|
||||
* Run the following command to build the test binary with the full profile
|
||||
|
||||
* Run the following command for the test suite to be recognised as a valid Mbed application
|
||||
```
|
||||
mkdir cmake_build && cd cmake_build && cmake .. -G Ninja -DMBED_TEST_LINK_LIBRARIES=mbed-os && cmake --build .
|
||||
touch mbed-os.lib && ln -s /path/to/mbed-os mbed-os
|
||||
```
|
||||
* Run the following command to build the test binary with the baremetal profile
|
||||
* Run the following command for the configuration CMake module to be generated
|
||||
```
|
||||
mkdir cmake_build && cd cmake_build && cmake .. -G Ninja -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal && cmake --build .
|
||||
mbedtools configure -t <TOOLCHAIN> -m <MBED_TARGET>
|
||||
```
|
||||
* Run the following command to build the test binary with the full profile and XYZ library
|
||||
* Build the test binary with the full profile
|
||||
```
|
||||
mkdir cmake_build && cd cmake_build && cmake .. -G Ninja -D"MBED_TEST_LINK_LIBRARIES=mbed-os XYZ" && cmake --build .
|
||||
cd cmake_build/<MBED_TARGET>/<PROFILE>/<TOOLCHAIN>/ && cmake ../../../.. -G Ninja -DMBED_TEST_LINK_LIBRARIES=mbed-os && cmake --build .
|
||||
```
|
||||
To build the test binary with the baremetal profile
|
||||
```
|
||||
cd cmake_build/<MBED_TARGET>/<PROFILE>/<TOOLCHAIN>/ && cmake ../../../.. -G Ninja -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal && cmake --build .
|
||||
```
|
||||
To build the test binary with the full profile and a "XYZ" library
|
||||
```
|
||||
cd cmake_build/<MBED_TARGET>/<PROFILE>/<TOOLCHAIN>/ && cmake ../../../.. -G Ninja -D"MBED_TEST_LINK_LIBRARIES=mbed-os XYZ" && cmake --build .
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "")
|
||||
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
|
||||
|
||||
include(${MBED_PATH}/tools/cmake/app.cmake)
|
||||
|
||||
|
|
Loading…
Reference in New Issue