Skip to content

Commit

Permalink
ESP32: Fix for rebuild using idf.py (CMake).
Browse files Browse the repository at this point in the history
  • Loading branch information
sweetymhaiske committed Apr 8, 2021
1 parent 107c126 commit b7634d8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,20 @@ endif()

set(GN_ROOT_TARGET ${CHIP_ROOT}/config/esp32)

set(chip_libraries "${CMAKE_CURRENT_BINARY_DIR}/lib/libCHIP.a")

if(CONFIG_ENABLE_PW_RPC)
list(APPEND chip_libraries "${CMAKE_CURRENT_BINARY_DIR}/lib/libPwRpc.a")
endif()

externalproject_add(
chip_gn
SOURCE_DIR ${CHIP_ROOT}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
CONFIGURE_COMMAND ${GN_EXECUTABLE} --root=${GN_ROOT_TARGET} gen --check --fail-on-unused-args ${CMAKE_CURRENT_BINARY_DIR}
BUILD_COMMAND ninja "esp32"
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${CHIP_LIBRARIES}
BUILD_BYPRODUCTS ${chip_libraries}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS args_gn
BUILD_ALWAYS 1
Expand Down Expand Up @@ -135,18 +141,11 @@ target_include_directories(${COMPONENT_LIB} INTERFACE

idf_component_get_property(esp32_mbedtls_lib esp32_mbedtls COMPONENT_LIB)

set(chip_libraries "-lCHIP")

if(CONFIG_ENABLE_PW_RPC)
list(APPEND chip_libraries "-lPwRpc")
endif()

if(CONFIG_BT_ENABLED)
idf_component_get_property(bt_lib bt COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}> -lbtdm_app)
endif()

target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_BINARY_DIR}/lib")
target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group
${chip_libraries}
$<TARGET_FILE:mbedcrypto> $<TARGET_FILE:${esp32_mbedtls_lib}>
Expand Down

0 comments on commit b7634d8

Please sign in to comment.