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: zephyr_library_amend feature #19980
Merged
carlescufi
merged 1 commit into
zephyrproject-rtos:master
from
tejlmand:cmake_zephyr_library_amend
Oct 21, 2019
Merged
cmake: zephyr_library_amend feature #19980
carlescufi
merged 1 commit into
zephyrproject-rtos:master
from
tejlmand:cmake_zephyr_library_amend
Oct 21, 2019
Conversation
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
tejlmand
force-pushed
the
cmake_zephyr_library_amend
branch
from
October 21, 2019 11:55
eae3c09
to
2e1a2e0
Compare
tejlmand
force-pushed
the
cmake_zephyr_library_amend
branch
from
October 21, 2019 11:58
2e1a2e0
to
0b594de
Compare
aescolar
requested review from
daor-oti and
mped-oticon
and removed request for
aescolar
October 21, 2019 12:09
This commit introduces the cmake extension zephyr_library_amend. This function allows for adding files in an out-of-tree Zephyr module to a zephyr library created in zephyr repo CMake files. As example: drivers/entropy/CMakeLists.txt creates an zephyr library as: zephyr_library() only available to zephyr itself. The amend function allows to amend to such a lib, by creating a CMakeLists.txt file following identical folder structure in a Zephyr Module: <zephyr_module_oot>/drivers/entropy/CMakeLists.txt zephyr_library_amend() zephyr_library_sources() # Sources are amended to the original library Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
tejlmand
force-pushed
the
cmake_zephyr_library_amend
branch
from
October 21, 2019 12:51
0b594de
to
0f08864
Compare
SebastianBoe
approved these changes
Oct 21, 2019
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.
A minor comment, otherwise it looks good to me 👍
thomasstenersen
approved these changes
Oct 21, 2019
carlescufi
approved these changes
Oct 21, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
With module support in Zephyr: https://docs.zephyrproject.org/latest/guides/modules.html?highlight=modules#modules-external-projects
more code will be located out of tree.
This means that in some cases, Kconfig settings may be set to
yes
and thus create a zephyr_library, but no file is place in the lib.As example, high level settings for a driver might result in a zephyr_library is selected for creation, but the code for the specific driver is located out-of-tree.
This can result in an empty CMake library with the following error:
This commit introduces the cmake extension
zephyr_library_amend
which offersa generic way to add files from out-of-tree into a Zephyr library and still use the existing zephyr cmake extension functions.
This function allows for adding files in an out-of-tree Zephyr module
to a zephyr library created in zephyr repo CMake files.
As example:
drivers/entropy/CMakeLists.txt
creates an zephyr library as:only available to zephyr itself.
The amend function allows to amend to such a lib, by creating a
CMakeLists.txt file following identical folder structure in a Zephyr
Module:
<zephyr_module_oot>/drivers/entropy/CMakeLists.txt
Requirement when using
zephyr_library_amend
.CMakeList.txt
is located in:${ZEPHYR_BASE}/drivers/entropy
then the amending
CMakeLists.txt
must be located in<ZEPHYR_MODULE_DIR>/drivers/entropy
This PR is related to: #14527
Signed-off-by: Torsten Rasmussen Torsten.Rasmussen@nordicsemi.no