summaryrefslogtreecommitdiff
path: root/examples/usercmodule
diff options
context:
space:
mode:
Diffstat (limited to 'examples/usercmodule')
-rw-r--r--examples/usercmodule/cexample/examplemodule.c5
-rw-r--r--examples/usercmodule/cexample/micropython.cmake6
-rw-r--r--examples/usercmodule/cppexample/examplemodule.c5
-rw-r--r--examples/usercmodule/cppexample/micropython.cmake6
4 files changed, 8 insertions, 14 deletions
diff --git a/examples/usercmodule/cexample/examplemodule.c b/examples/usercmodule/cexample/examplemodule.c
index f608823c9..49ebc7aaa 100644
--- a/examples/usercmodule/cexample/examplemodule.c
+++ b/examples/usercmodule/cexample/examplemodule.c
@@ -31,4 +31,7 @@ const mp_obj_module_t example_user_cmodule = {
};
// Register the module to make it available in Python.
-MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule, MODULE_CEXAMPLE_ENABLED);
+// Note: the "1" in the third argument means this module is always enabled.
+// This "1" can be optionally replaced with a macro like MODULE_CEXAMPLE_ENABLED
+// which can then be used to conditionally enable this module.
+MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule, 1);
diff --git a/examples/usercmodule/cexample/micropython.cmake b/examples/usercmodule/cexample/micropython.cmake
index 371a3eefa..ba076a16b 100644
--- a/examples/usercmodule/cexample/micropython.cmake
+++ b/examples/usercmodule/cexample/micropython.cmake
@@ -11,11 +11,5 @@ target_include_directories(usermod_cexample INTERFACE
${CMAKE_CURRENT_LIST_DIR}
)
-# Enable the module automatically by adding the relevant compile definitions.
-target_compile_definitions(usermod_cexample INTERFACE
- MODULE_CEXAMPLE_ENABLED=1
-)
-
# Link our INTERFACE library to the usermod target.
target_link_libraries(usermod INTERFACE usermod_cexample)
-
diff --git a/examples/usercmodule/cppexample/examplemodule.c b/examples/usercmodule/cppexample/examplemodule.c
index ceb588bef..dfb785683 100644
--- a/examples/usercmodule/cppexample/examplemodule.c
+++ b/examples/usercmodule/cppexample/examplemodule.c
@@ -22,4 +22,7 @@ const mp_obj_module_t cppexample_user_cmodule = {
};
// Register the module to make it available in Python.
-MP_REGISTER_MODULE(MP_QSTR_cppexample, cppexample_user_cmodule, MODULE_CPPEXAMPLE_ENABLED);
+// Note: the "1" in the third argument means this module is always enabled.
+// This "1" can be optionally replaced with a macro like MODULE_CPPEXAMPLE_ENABLED
+// which can then be used to conditionally enable this module.
+MP_REGISTER_MODULE(MP_QSTR_cppexample, cppexample_user_cmodule, 1);
diff --git a/examples/usercmodule/cppexample/micropython.cmake b/examples/usercmodule/cppexample/micropython.cmake
index 43e8d887f..6da972c94 100644
--- a/examples/usercmodule/cppexample/micropython.cmake
+++ b/examples/usercmodule/cppexample/micropython.cmake
@@ -12,11 +12,5 @@ target_include_directories(usermod_cppexample INTERFACE
${CMAKE_CURRENT_LIST_DIR}
)
-# Enable the module automatically by adding the relevant compile definitions.
-target_compile_definitions(usermod_cppexample INTERFACE
- MODULE_CPPEXAMPLE_ENABLED=1
-)
-
# Link our INTERFACE library to the usermod target.
target_link_libraries(usermod INTERFACE usermod_cppexample)
-