-
Notifications
You must be signed in to change notification settings - Fork 3k
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
mbed_create_distro() reborn: a function to make adding multiple targets easy #15126
Conversation
@multiplemonomials, thank you for your changes. |
Thanks @multiplemonomials! I'll try it asap :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for resubmitting this fix, let's get this in.
I only found some debug messages left, otherwise looks fine to me.
tools/cmake/create_distro.cmake
Outdated
endif() | ||
endforeach() | ||
|
||
#message("REMAINING_MODULES: ${REMAINING_MODULES}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we remove this debug messages (line 63 and 51 as well) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed!
tools/cmake/create_distro.cmake
Outdated
get_property(PROP_IS_DEFINED TARGET ${SOURCE} PROPERTY ${PROPERTY} SET) | ||
if(PROP_IS_DEFINED) | ||
get_property(PROP_VALUE TARGET ${SOURCE} PROPERTY ${PROPERTY}) | ||
#message("Copying ${PROPERTY} from ${SOURCE} -> ${DESTINATION}: ${PROP_VALUE} ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have missed one more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
I've tried it with my template project and I can confirm this works! ladislas/mbed-cmake-template#10 The good news is that it's not mandatory to do it, it won't break people's projects if they don't use the I can't try it now with our big project (https://github.com/leka/LekaOS) as it will need to change a lot of things but I think it's a good start. And we can start building from this PR. |
CI started, however waiting for one more approval from the core team |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
ping :) |
More and more people on the forum are moving to mbed cli2 and are experiencing the issue this PR is resolving in a elegant, easy and opt-in manner. It would be great if it could be merged so people could start using it and improve if needed. |
amazing! thank you! |
Summary of changes
This PR adds mbed_create_distro(), a function that lets you compile multiple apps in an Mbed OS project without waiting for Mbed OS to build multiple times.
You can use it like this:
Both myapp1 and myapp2 will act like they were linked to mbed-os, mbed-storage-kvstore, and mbed-storage-filesystem. Note that if you actually did
target_link_libraries(myapp1 PRIVATE mbed-os mbed-storage-kvstore mbed-storage-filesystem)
, it would compile a new version of the Mbed OS source files for each target. However, using mbed_create_distro(), Mbed OS will only be compiled once.Note that I originally submitted this like 6 months ago, this is an update of the original PR (#14274). At the time I closed that PR because it seemed like Mbed OS was going to switch to using object libraries for all targets, which would also fix the building-multiple-times problem. However, it's been close to 6 months and that change still hasn't happened, and Mbed CLI still isn't usable for RPL until this issue is fixed. So, I'd like to resubmit this PR as at least a stopgap measure until that change happens.
If merged, this will provide a satisfactory fix for #13981.
Impact of changes
mbed_create_distro() is now offered by the build system. This function replaces mbed_configure_app_target() and creates a separate "distribution" OBJECT library from the given Mbed OS libraries that only needs to be compiled once.
Migration actions required
None
Documentation
Docs provided in code comments.
Pull request type
Test results
Reviewers