mirror of
https://github.com/micropython/micropython.git
synced 2025-08-10 04:32:05 +02:00
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 <a.gatti@frob.it>
This commit is contained in:
@@ -242,6 +242,7 @@ endif()
|
||||
|
||||
# Set compile options for this port.
|
||||
target_compile_definitions(${MICROPY_TARGET} PUBLIC
|
||||
${MICROPY_DEF_COMPONENT}
|
||||
${MICROPY_DEF_CORE}
|
||||
${MICROPY_DEF_BOARD}
|
||||
${MICROPY_DEF_TINYUSB}
|
||||
@@ -254,6 +255,7 @@ target_compile_definitions(${MICROPY_TARGET} PUBLIC
|
||||
|
||||
# Disable some warnings to keep the build output clean.
|
||||
target_compile_options(${MICROPY_TARGET} PUBLIC
|
||||
${MICROPY_COMPILE_COMPONENT}
|
||||
-Wno-clobbered
|
||||
-Wno-deprecated-declarations
|
||||
-Wno-missing-field-initializers
|
||||
|
Reference in New Issue
Block a user