mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14247 from rajkan01/refactor_greentea_cmakelist
CMake: Refactor Greentea test CMakeLists.txtpull/14286/head
commit
da34eecaf6
|
@ -94,14 +94,24 @@ $ 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.
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
touch mbed-os.lib && mkdir cmake_build && cd cmake_build && cmake .. -G Ninja && cmake --build .
|
||||
mkdir cmake_build && cd cmake_build && cmake .. -G Ninja -DMBED_TEST_LINK_LIBRARIES=mbed-os && cmake --build .
|
||||
```
|
||||
* Run the following command to build the test binary with the baremetal profile
|
||||
```
|
||||
touch mbed-os.lib && mkdir cmake_build && cd cmake_build && cmake .. -G Ninja -DMBED_BAREMETAL_GREENTEA_TEST=ON && cmake --build .
|
||||
mkdir cmake_build && cd cmake_build && cmake .. -G Ninja -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal && cmake --build .
|
||||
```
|
||||
* Run the following command to build the test binary with the full profile and XYZ library
|
||||
```
|
||||
mkdir cmake_build && cd cmake_build && cmake .. -G Ninja -D"MBED_TEST_LINK_LIBRARIES=mbed-os XYZ" && cmake --build .
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
|
|
@ -55,10 +55,17 @@ macro(mbed_greentea_add_test)
|
|||
${MBED_GREENTEA_TEST_SOURCES}
|
||||
)
|
||||
|
||||
if(MBED_BAREMETAL_GREENTEA_TEST)
|
||||
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-baremetal mbed-greentea)
|
||||
else()
|
||||
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-os mbed-greentea)
|
||||
# The CMake MBED_TEST_LINK_LIBRARIES command-line argument is to get greentea test all dependent libraries.
|
||||
# For example:
|
||||
# - To select mbed-os library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-os
|
||||
# - To select baremetal library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal
|
||||
# - To select baremetal with extra external error logging library to the test, use cmake with
|
||||
# -D "MBED_TEST_LINK_LIBRARIES=mbed-baremetal ext-errorlogging"
|
||||
if (DEFINED MBED_TEST_LINK_LIBRARIES)
|
||||
separate_arguments(MBED_TEST_LINK_LIBRARIES)
|
||||
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS ${MBED_TEST_LINK_LIBRARIES} mbed-greentea)
|
||||
else()
|
||||
list(APPEND MBED_GREENTEA_TEST_REQUIRED_LIBS mbed-greentea)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TEST_NAME}
|
||||
|
|
Loading…
Reference in New Issue