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

Add oldconfig and olddefconfig custom targets to CMake #13086

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pietroalbini
Copy link
Contributor

Summary

The Fast configuration changes section of the documentation mentions the need to run make oldconfig and make olddefconfig after changing the configuration with kconfig-tweak, but those commands are not exposed through CMake. This PR adds them, and adds a note in the documentation pointing users to it.

Impact

This will allow users compiling with CMake to properly use kconfig-tweak.

Testing

cmake -Bbuild -GNinja -DBOARD_CONFIG=fvp-armv8r-aarch32:nsh
cd build
cat .config | grep MKFATFS  # Doesn't show anything :(
kconfig-tweak --enable CONFIG_FS_FAT
cat .config | grep MKFATFS  # Doesn't show anything :(
cmake --build . -t olddefconfig
cat .config | grep MKFATFS  # Show the newly available option!

In the quickstart/configuring.rst documentation page, it's mentioned
that `make olddefconfig` and `make oldconfig` need to be executed after
using `kconfig-tweak`, but they don't seem to be available in CMake.
This adds support for them.
cmake/menuconfig.cmake Outdated Show resolved Hide resolved
cmake/menuconfig.cmake Outdated Show resolved Hide resolved
@xuxin930
Copy link
Contributor

Hi @pietroalbini @xiaoxiang781216 nice question!
I think we should deal with an essential problem here.

First, I think the usage of kconfig-kweak in the description should be the lack of parameters.
when I use kconfig-kweak --file .config --enable XXXX, the configuration can be modified successfully.

But when doing cmake build, it is necessary to distinguish between original build and incremental build.

If we do original build, the tweak changes will take effect, but if it is incremental build, it will NOT.

This is because our config.h in cmake is an independent execution generation, not a target, which leads to no relationship dependency between .config and config.h. and this is why config.h needs to be deleted.

So I think the problem we should deal with is to make config.h independent and establish dependency?

@pietroalbini
Copy link
Contributor Author

@xuxin930 added a dependency relationship between .config and config.h!

Note that until now I never worked on CMake configuration files, so there is probably a better way to do it than my approach. I ended up invoking nuttx_mkconfig with cmake -P as a separate invocation, which doesn't feel "right" to me. But from what I could see online, the solution I would've intuitively done (wrapping the config.h generation into a function and calling that function from add_custom_command) doesn't seem to be possible in CMake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants