Commit 0ccd9e08 authored by Michael O'Cleirigh's avatar Michael O'Cleirigh Committed by Damien George

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: default avatarMichael O'Cleirigh <michael.ocleirigh@rivulet.ca>
parent ca3d51f1
...@@ -18,7 +18,13 @@ GIT_SUBMODULES = lib/berkeley-db-1.xx ...@@ -18,7 +18,13 @@ GIT_SUBMODULES = lib/berkeley-db-1.xx
.PHONY: all clean deploy erase submodules FORCE .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: all:
idf.py $(IDFPY_FLAGS) build idf.py $(IDFPY_FLAGS) build
......
...@@ -5,6 +5,10 @@ get_filename_component(MICROPY_DIR ${PROJECT_DIR}/../.. ABSOLUTE) ...@@ -5,6 +5,10 @@ get_filename_component(MICROPY_DIR ${PROJECT_DIR}/../.. ABSOLUTE)
include(${MICROPY_DIR}/py/py.cmake) include(${MICROPY_DIR}/py/py.cmake)
include(${MICROPY_DIR}/extmod/extmod.cmake) include(${MICROPY_DIR}/extmod/extmod.cmake)
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
include(${MICROPY_DIR}/py/usermod.cmake)
endif()
set(MICROPY_QSTRDEFS_PORT set(MICROPY_QSTRDEFS_PORT
${PROJECT_DIR}/qstrdefsport.h ${PROJECT_DIR}/qstrdefsport.h
) )
...@@ -71,6 +75,7 @@ set(MICROPY_SOURCE_PORT ...@@ -71,6 +75,7 @@ set(MICROPY_SOURCE_PORT
set(MICROPY_SOURCE_QSTR set(MICROPY_SOURCE_QSTR
${MICROPY_SOURCE_PY} ${MICROPY_SOURCE_PY}
${MICROPY_SOURCE_EXTMOD} ${MICROPY_SOURCE_EXTMOD}
${MICROPY_SOURCE_USERMOD}
${MICROPY_SOURCE_LIB} ${MICROPY_SOURCE_LIB}
${MICROPY_SOURCE_PORT} ${MICROPY_SOURCE_PORT}
) )
...@@ -129,6 +134,7 @@ idf_component_register( ...@@ -129,6 +134,7 @@ idf_component_register(
${MICROPY_SOURCE_PORT} ${MICROPY_SOURCE_PORT}
INCLUDE_DIRS INCLUDE_DIRS
${MICROPY_DIR} ${MICROPY_DIR}
${MICROPY_INC_USERMOD}
${MICROPY_PORT_DIR} ${MICROPY_PORT_DIR}
${MICROPY_BOARD_DIR} ${MICROPY_BOARD_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
...@@ -159,6 +165,10 @@ target_compile_options(${MICROPY_TARGET} PUBLIC ...@@ -159,6 +165,10 @@ target_compile_options(${MICROPY_TARGET} PUBLIC
-Wno-missing-field-initializers -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. # Collect all of the include directories and compile definitions for the IDF components.
foreach(comp ${IDF_COMPONENTS}) foreach(comp ${IDF_COMPONENTS})
get_target_property(type __idf_${comp} TYPE) get_target_property(type __idf_${comp} TYPE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment