Replies: 3 comments
-
Sometime a limitaiton is a good thing because without limitation (or a standard way of doing things), the Zephyr build system can't integrate external libraries or it must be too complex to be maintained. But I can feel your pain of learning new things even though you are fluent of using plain CMake.
Regarding Kconfig option, you can directly check in your if(CONFIG_YOUR_LIBRARY_FEATURE)
:
endif() Zephyr build system handles Kconfig and options for you. If Zephyr build system alows user to use https://docs.zephyrproject.org/latest/build/kconfig/menuconfig.html Check picolibc or any other libraries Zephyr already uses and learn how they handle Kconfig and CMake. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the example of picolibc. The way picolibc handles zephyr is exactly what I came up with too. However, I also found some libraries doing it differently, what tells a lot about the unclearness of how to integrate existing libraries into zephyr and is very confusing when learning zephyr. |
Beta Was this translation helpful? Give feedback.
-
Btw. my request is not about learning something new - I have no problem with that. But abusing something existing for something it wasn't designed for is just odd and unintiuitive. cmake is and never was designed to compile whole systems. Nevertheless, I am sure, someone had his good reasons for this decision. |
Beta Was this translation helpful? Give feedback.
-
Currently, I'm porting an existing library to zephyr. The project I'm porting is cmake based and of course uses cmake as cmake should be used.
My first naive approach of proting the library was, to go the cmake way of doing stuff. I.e. I went over the CMakeLists.txt in the root folder and worked with
if architecture == zephyr then
.This way I was able to fully port the library. Now I'm able to use the library and fully configure the library by setting cmake options before fetching the library from github by using
FetchContent
. However, as it seems, this is not how things are done in zephyr. Zephyr requires a modules and Kconfig file in a folder calledzephyr/
and doesn't plan to fetch external modules usingFetchContent
.From here, I don't understand why and how I should proceed...
configure
-command. My current understanding ofKconfig
tells me, I would have to use macros generated fromKconfig
to configure the library instead of relying on theconfig.h
-file generated by the cmake-configure
-command.Kconfig
to theconfig.h.in
-file of the library?From my point of view, zephyr is limiting the user of cmake too hard. I can't see any reason why I shouldn't be able to pull the library using
FetchContent
or not relying onconfigure
instead of the output ofKconfig
.Is there any discussion on this topic?
Beta Was this translation helpful? Give feedback.
All reactions