diff options
| author | Michael O'Cleirigh | 2021-03-27 17:10:39 -0400 |
|---|---|---|
| committer | Damien George | 2021-04-01 15:43:15 +1100 |
| commit | 0ccd9e08aad95f955ded0006cff67e2a50778c84 (patch) | |
| tree | c628ae498b7553edf57ee9183bbaaa69fcf49ed5 | |
| parent | ca3d51f12206a88463f2b2a2d27756a1b519cb6a (diff) | |
esp32: Restore USER_C_MODULE support with new CMake build system.
Support for User C and C++ modules was lost due to upgrading the esp32 to
the latest CMake based IDF from the GNUMakefile build process.
Restore the support for the esp32 port by integrating with the approach
recently added for the rp2 port.
Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
| -rw-r--r-- | ports/esp32/Makefile | 8 | ||||
| -rw-r--r-- | ports/esp32/main/CMakeLists.txt | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile index 9a3a15d6e..39b740ffa 100644 --- a/ports/esp32/Makefile +++ b/ports/esp32/Makefile @@ -18,7 +18,13 @@ GIT_SUBMODULES = lib/berkeley-db-1.xx .PHONY: all clean deploy erase submodules FORCE -IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -B $(BUILD) +CMAKE_ARGS = + +ifdef USER_C_MODULES + CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES} +endif + +IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -B $(BUILD) $(CMAKE_ARGS) all: idf.py $(IDFPY_FLAGS) build diff --git a/ports/esp32/main/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt index b6bccdde3..082410f4c 100644 --- a/ports/esp32/main/CMakeLists.txt +++ b/ports/esp32/main/CMakeLists.txt @@ -5,6 +5,10 @@ get_filename_component(MICROPY_DIR ${PROJECT_DIR}/../.. ABSOLUTE) include(${MICROPY_DIR}/py/py.cmake) include(${MICROPY_DIR}/extmod/extmod.cmake) +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + include(${MICROPY_DIR}/py/usermod.cmake) +endif() + set(MICROPY_QSTRDEFS_PORT ${PROJECT_DIR}/qstrdefsport.h ) @@ -71,6 +75,7 @@ set(MICROPY_SOURCE_PORT set(MICROPY_SOURCE_QSTR ${MICROPY_SOURCE_PY} ${MICROPY_SOURCE_EXTMOD} + ${MICROPY_SOURCE_USERMOD} ${MICROPY_SOURCE_LIB} ${MICROPY_SOURCE_PORT} ) @@ -129,6 +134,7 @@ idf_component_register( ${MICROPY_SOURCE_PORT} INCLUDE_DIRS ${MICROPY_DIR} + ${MICROPY_INC_USERMOD} ${MICROPY_PORT_DIR} ${MICROPY_BOARD_DIR} ${CMAKE_BINARY_DIR} @@ -159,6 +165,10 @@ target_compile_options(${MICROPY_TARGET} PUBLIC -Wno-missing-field-initializers ) +# add usermod +target_link_libraries(${MICROPY_TARGET} usermod) + + # Collect all of the include directories and compile definitions for the IDF components. foreach(comp ${IDF_COMPONENTS}) get_target_property(type __idf_${comp} TYPE) |
