Skip to content
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

CMake: Componentize Mbed OS into multiple CMake targets #13732

Merged
merged 109 commits into from
Oct 12, 2020

Conversation

hugueskamba
Copy link
Collaborator

@hugueskamba hugueskamba commented Oct 7, 2020

Summary of changes

Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using target_link_libraries.
See an example here: https://github.com/ARMmbed/mbed-os-example-kvstore/pull/55/files

Impact of changes

Requires the following PR: ARMmbed/mbed-tools#78

Migration actions required

The following PRs must also be merged for the Travis CMake CI job to pass:

Documentation

https://github.com/0xc0170/mbed-os/blob/40da67beba045d6a18a5b2c6d80f390a47b17c3b/docs/design-documents/tools/cmake_components.md


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[x] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom
Copy link
Member

ciarmcom commented Oct 7, 2020

@hugueskamba, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@Patater
Copy link
Contributor

Patater commented Oct 8, 2020

This has 112 commits. Is that correct or does this need rebasing on the latest feature-cmake?

Anything that is in Mbed OS it is treated as internal. Everything else as external.
Every component invokes set of these function. We should provide default implementation.
+ move components function to components module
Tricky part to use object libraries. If we want them on the right side in target_link,
we would need to have no circular deps. Not our case.

What I did here is to add object library and add its objects and includes to Mbed OS main lib.

This however breaks if for instance cmsis and events would have dependency on each other (we first
include cmsis then events). It should not happen but keep in mind, this is where static libs come
handy.
This is work in progress. Connectivity and storage contain multiple components.
We need to be aware what is in there to be able to add them.

Or maybe not, if we switch to STATIC lib for these?
fix some naming in the functionality as well
0xc0170 and others added 17 commits October 9, 2020 18:06
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
Remove component targets with board, manufacturer suffixes
to simply the user experience. The board specific files
are automatically added to the build based on the labels
of the mbed targets without using the custom utility function.
The utility function was not used as it relies on the
previous tools naming convention for including directories.

Includes: nfc, 802.15.4_RF, cellular
This was done as some targets are used across different directories.

For example mbed-os-mbedtls is used both in connectivity/drivers
and connectivity/mbedtls. However, as the target was created in the latter,
it was not visible in the former. The creation of the target had
therefore to be in a parent directory of both directories.

Similar issue as the example above for ble, nfc, etc.
It was made a separate component as it has dependencies on other Mbed OS components.
It was not suitable to add dependencies to the mbed-os target and made sense to have it as a separte CMake target.
* Add cellular as a depency.
* Add emac as a conditional depency.
Ensure nanostack-libservice is available to mbed-trace when the former
is included in the build.
Some applications refer the parent directory to include lorawan header files
@hugueskamba hugueskamba merged commit e8ce454 into ARMmbed:feature-cmake Oct 12, 2020
hugueskamba added a commit that referenced this pull request Oct 12, 2020
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
hugueskamba added a commit that referenced this pull request Oct 12, 2020
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
@0xc0170
Copy link
Contributor

0xc0170 commented Oct 13, 2020

💯 it's in!

@0xc0170 0xc0170 deleted the feature-cmake-interface-lib branch October 13, 2020 07:31
hugueskamba added a commit that referenced this pull request Oct 15, 2020
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
0xc0170 added a commit that referenced this pull request Oct 20, 2020
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
0xc0170 added a commit that referenced this pull request Oct 23, 2020
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
0xc0170 added a commit that referenced this pull request Nov 3, 2020
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
hugueskamba added a commit that referenced this pull request Nov 6, 2020
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.

Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants