-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Add test for multiple-executable support
Add a test to build two executables in two directories under a single project.
- Loading branch information
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: test building multiple executables with CMake | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'CMakeLists.txt' | ||
- 'platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/**' | ||
- 'tools/cmake/**' | ||
|
||
jobs: | ||
multiple-executables-example: | ||
runs-on: ubuntu-latest | ||
container: mbedos/mbed-os-env:latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build the multiple_executables example | ||
run: | | ||
mbedtools compile \ | ||
-t GCC_ARM \ | ||
-m ARM_MUSCA_S1 \ | ||
--program-path tools/cmake/tests/multiple_executables/ \ | ||
--mbed-os-path . | ||
- name: Verify the post-build command has been run successfully on each image | ||
run: | | ||
APP1=tools/cmake/tests/multiple_executables/cmake_build/ARM_MUSCA_S1/develop/GCC_ARM/app1/app1.bin | ||
APP2=tools/cmake/tests/multiple_executables/cmake_build/ARM_MUSCA_S1/develop/GCC_ARM/app2/app2.bin | ||
BOOTLOADER=targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/bl2.bin | ||
BOOTLOADER_BYTES=`du -b targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/bl2.bin | cut -f1` | ||
cmp -n $BOOTLOADER_BYTES $APP1 $BOOTLOADER | ||
cmp -n $BOOTLOADER_BYTES $APP2 $BOOTLOADER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (c) 2021 Arm Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.19.0) | ||
|
||
set(MBED_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../..") | ||
set(MBED_CONFIG_PATH "${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
include("${MBED_PATH}/tools/cmake/app.cmake") | ||
|
||
project(multiple_executables) | ||
|
||
add_subdirectory("${MBED_PATH}" "mbed-os-build") | ||
|
||
add_subdirectory(app1) | ||
add_subdirectory(app2) |
10 changes: 10 additions & 0 deletions
10
tools/cmake/tests/multiple_executables/app1/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2021 Arm Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set(APP_TARGET app1) | ||
|
||
add_executable(${APP_TARGET} main.cpp) | ||
|
||
target_link_libraries(${APP_TARGET} mbed-os) | ||
|
||
mbed_set_post_build(${APP_TARGET}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2021 Arm Limited | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "mbed.h" | ||
|
||
int main() | ||
{ | ||
printf("Application 1\n"); | ||
return 0; | ||
} |
10 changes: 10 additions & 0 deletions
10
tools/cmake/tests/multiple_executables/app2/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2021 Arm Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set(APP_TARGET app2) | ||
|
||
add_executable(${APP_TARGET} main.cpp) | ||
|
||
target_link_libraries(${APP_TARGET} mbed-os) | ||
|
||
mbed_set_post_build(${APP_TARGET}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2021 Arm Limited | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "mbed.h" | ||
|
||
int main() | ||
{ | ||
printf("Application 2\n"); | ||
return 0; | ||
} |