Skip to content

Commit bd375df

Browse files
committed
extmod/extmod.cmake: Require components to be explicitly enabled.
Otherwise include directories are added unconditionally to the build variables if the component (submodule) is checked out. This can lead to, eg, the esp32 build using lib/lwip header files, instead of lwip header files from the IDF. Fixes issue micropython#8727. Signed-off-by: Damien George <damien@micropython.org>
1 parent e8e8c7c commit bd375df

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

extmod/extmod.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ set(MICROPY_SOURCE_EXTMOD
5454

5555
# Library for btree module and associated code
5656

57-
set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx")
57+
if(MICROPY_PY_BTREE)
58+
set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx")
5859

59-
if(EXISTS "${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c")
6060
add_library(micropy_extmod_btree OBJECT
6161
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c
6262
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_conv.c
@@ -100,11 +100,11 @@ endif()
100100

101101
# Library for mbedtls
102102

103-
set(MICROPY_LIB_MBEDTLS_DIR "${MICROPY_DIR}/lib/mbedtls")
104-
105-
if(EXISTS "${MICROPY_LIB_MBEDTLS_DIR}/library/aes.c")
103+
if(MICROPY_SSL_MBEDTLS)
106104
add_library(micropy_lib_mbedtls INTERFACE)
107105

106+
set(MICROPY_LIB_MBEDTLS_DIR "${MICROPY_DIR}/lib/mbedtls")
107+
108108
target_include_directories(micropy_lib_mbedtls INTERFACE
109109
${MICROPY_LIB_MBEDTLS_DIR}/include
110110
)
@@ -194,11 +194,11 @@ endif()
194194

195195
# Library for lwIP network stack
196196

197-
set(MICROPY_LIB_LWIP_DIR "${MICROPY_DIR}/lib/lwip/src")
198-
199-
if(EXISTS "${MICROPY_LIB_LWIP_DIR}/core/def.c")
197+
if(MICROPY_PY_LWIP)
200198
add_library(micropy_lib_lwip INTERFACE)
201199

200+
set(MICROPY_LIB_LWIP_DIR "${MICROPY_DIR}/lib/lwip/src")
201+
202202
target_include_directories(micropy_lib_lwip INTERFACE
203203
${MICROPY_LIB_LWIP_DIR}/include
204204
)

ports/esp32/main/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ endif()
77
include(${MICROPY_DIR}/py/py.cmake)
88

99
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
10+
# Enable extmod components that will be configured by extmod.cmake.
11+
# A board may also have enabled additional components.
12+
set(MICROPY_PY_BTREE ON)
13+
1014
include(${MICROPY_DIR}/py/usermod.cmake)
1115
include(${MICROPY_DIR}/extmod/extmod.cmake)
1216
endif()

ports/rp2/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ if(NOT PICO_BOARD)
4343
string(TOLOWER ${MICROPY_BOARD} PICO_BOARD)
4444
endif()
4545

46+
# Enable extmod components that will be configured by extmod.cmake.
47+
# A board may also have enabled additional components.
48+
set(MICROPY_SSL_MBEDTLS ON)
49+
4650
# Include component cmake fragments
4751
include(${MICROPY_DIR}/py/py.cmake)
4852
include(${MICROPY_DIR}/extmod/extmod.cmake)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy