diff options
author | stijn <stijn@ignitron.net> | 2020-10-21 11:13:47 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-10-29 15:30:42 +1100 |
commit | 25c4563f26c2270cde01b01dca0e8b801c9c8282 (patch) | |
tree | 893f7160c558bceb288f06642d2fae440d51014d /examples/usercmodule/cppexample/micropython.mk | |
parent | fad4079778f46bc21dd19a674b31b4c3c7eb6a91 (diff) | |
download | micropython-25c4563f26c2270cde01b01dca0e8b801c9c8282.tar.gz micropython-25c4563f26c2270cde01b01dca0e8b801c9c8282.zip |
examples: Add example code for user C modules, both C and C++.
Add working example code to provide a starting point for users with files
that they can just copy, and include the modules in the coverage test to
verify the complete user C module build functionality. The cexample module
uses the code originally found in cmodules.rst, which has been updated to
reflect this and partially rewritten with more complete information.
Diffstat (limited to 'examples/usercmodule/cppexample/micropython.mk')
-rw-r--r-- | examples/usercmodule/cppexample/micropython.mk | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/usercmodule/cppexample/micropython.mk b/examples/usercmodule/cppexample/micropython.mk new file mode 100644 index 0000000000..e10d965a00 --- /dev/null +++ b/examples/usercmodule/cppexample/micropython.mk @@ -0,0 +1,12 @@ +CPPEXAMPLE_MOD_DIR := $(USERMOD_DIR) + +# Add our source files to the respective variables. +SRC_USERMOD += $(CPPEXAMPLE_MOD_DIR)/examplemodule.c +SRC_USERMOD_CXX += $(CPPEXAMPLE_MOD_DIR)/example.cpp + +# Add our module directory to the include path. +CFLAGS_USERMOD += -I$(CPPEXAMPLE_MOD_DIR) +CXXFLAGS_USERMOD += -I$(CPPEXAMPLE_MOD_DIR) + +# We use C++ features so have to link against the standard library. +LDFLAGS_USERMOD += -lstdc++ |