Skip to content

Commit 116d0d4

Browse files
committed
esp32/esp32_common.cmake: Allow adding defines and compiler flags.
This commit introduces two extra CMake variables, MICROPY_DEF_COMPONENT and MICROPY_COMPILE_COMPONENT, that make it easier to integrate MicroPython as a custom ESP-IDF component. Whilst there is no official MicroPython component available for ESP-IDF, integration can be achieved with some minor CMake scripting outside the MicroPython tree - except for customisation of compilation defines and build flags, which is what this commit tries to provide. Compilation defines customisation is especially important for MicroPython configuration, as it is not possible to inject a value for MP_CONFIGFILE otherwise. This means that unless MicroPython itself is forked first to edit ports/esp32/mpconfigport.h, it is not possible to perform any meaningful configuration of the interpreter/runtime when included as a component. Signed-off-by: Alessandro Gatti <[email protected]>
1 parent 1d4bf8a commit 116d0d4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ports/esp32/esp32_common.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ endif()
242242

243243
# Set compile options for this port.
244244
target_compile_definitions(${MICROPY_TARGET} PUBLIC
245+
${MICROPY_DEF_COMPONENT}
245246
${MICROPY_DEF_CORE}
246247
${MICROPY_DEF_BOARD}
247248
${MICROPY_DEF_TINYUSB}
@@ -254,6 +255,7 @@ target_compile_definitions(${MICROPY_TARGET} PUBLIC
254255

255256
# Disable some warnings to keep the build output clean.
256257
target_compile_options(${MICROPY_TARGET} PUBLIC
258+
${MICROPY_COMPILE_COMPONENT}
257259
-Wno-clobbered
258260
-Wno-deprecated-declarations
259261
-Wno-missing-field-initializers

0 commit comments

Comments
 (0)