Skip to content
Commit ab3f6fbd authored by Lingkai Dong's avatar Lingkai Dong
Browse files

build: Detach examples and tests from the SDK



Remove `CMakePresets.json` and detach examples and tests from the SDK.
This is a first step towards converting every example and test into a
top-level project that adds the SDK as a dependency.

Remove fetching of toolchain files from `CMakeLists.txt` because
toolchain files need to be available before a top-level user project is
declared, which comes before the IoT SDK is added. Examples and tests,
like user projects, will fetch toolchain files directly.

Previously, examples and integration tests were part of the SDK's CMake
project, but this is not ideal for the following reasons:
* A real user project should have itself as the top level CMake project
and add the SDK with components as dependencies. If an example is under
the SDK's CMake logic, it loses the benefit of demonstrating proper
creation of a user project, and users will not be able to take that
example as a quick start of their own projects.
* Each example or test application requires its own set of config
options to be applied to the SDK and components. Examples and tests that
are part of the SDK project cannot directly set options in their own
`CMakeLists.txt`s, because options have to be set before components are
added but executables have to be added after components. We previously
used CMake presets to set options outside examples, but this adds
indirection, making code navigation and maintenance difficult.
* CMake presets are only available when CMake is invoked in the same
directory, so user projects can't use the presets we provide.
* To let users select which platform to build examples for, a new config
option would be needed if examples were under the SDK CMake. But such an
option might add confusion, because a user project can directly link the
MCU-Driver-HAL implementation for the particular platform it intends to
use without an extra option.

Signed-off-by: Lingkai Dong's avatarLingkai Dong <lingkai.dong@arm.com>
parent d4892002
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment