Recommended way to build MicroPython as a library? #10906
Unanswered
bogdanm
asked this question in
Core Development
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am looking at using MicroPython in a project, but not in its standalone variant. This means that the project has its own source tree (including its own
main
function) and will initialize and start MicroPython as needed, so I'm looking for a way to build MicroPython as a library that I can link with my own code. I managed to do that, but I'm wondering if there's a simpler (or "more standard") way to do this that I'm missing. My application uses Zephyr, so I'm using the Zephyr port or MicroPython as follows:CMakeLists.txt
:ports/zephyr/CMakeLists.txt
as follows:In other words:
target_sources
).CMAKE_BINARY_DIR
to the include path, because some tools from the build system (likegenhdr
) output intoCMAKE_BINARY_DIR
instead ofCMAKE_CURRENT_BINARY_DIR
(which is relevant whenadd_subdirectory
is used).While this seems to do the trick, I'm wondering if there's a way to achieve this that doesn't require me to patch
ports/zephyr/CMakeLists.txt
.Beta Was this translation helpful? Give feedback.
All reactions