connectedhomeip: supports specifying CHIP_ROOT from the cmake parameter.

support CI compilation for the matter community
https://github.com/project-chip/connectedhomeip/pull/31236

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2024-05-06 12:58:25 +08:00 committed by Xiang Xiao
parent 943aa68069
commit c6051e4c41

View File

@ -65,8 +65,11 @@ if(CONFIG_MATTER)
endfunction()
get_filename_component(
CHIP_ROOT ${NUTTX_APPS_DIR}/netutils/connectedhomeip/connectedhomeip
LOCAL_CHIP_ROOT ${NUTTX_APPS_DIR}/netutils/connectedhomeip/connectedhomeip
REALPATH)
if(NOT CHIP_ROOT)
set(CHIP_ROOT ${LOCAL_CHIP_ROOT})
endif()
chip_download_and_patch(
NAME
@ -74,7 +77,7 @@ if(CONFIG_MATTER)
URL
https://github.com/project-chip/connectedhomeip/archive/refs/tags/v1.2.0.1.zip
SOURCE_DIR
${CMAKE_CURRENT_LIST_DIR}/connectedhomeip
${CHIP_ROOT}
BINARY_DIR
${CMAKE_BINARY_DIR}/apps/netutils/connectedhomeip
TIMEOUT
@ -166,16 +169,16 @@ if(CONFIG_MATTER)
inipp
nlio/include
nlassert/include
connectedhomeip/src
connectedhomeip/src/include
connectedhomeip/src/lib/dnssd
connectedhomeip/src/app/util/mock/include
connectedhomeip/zzz_generated
connectedhomeip/zzz_generated/lighting-app
connectedhomeip/zzz_generated/app-common
connectedhomeip/src/platform/Linux
connectedhomeip/examples/platform/linux
connectedhomeip/examples/lighting-app/lighting-common/include)
${CHIP_ROOT}/src
${CHIP_ROOT}/src/include
${CHIP_ROOT}/src/lib/dnssd
${CHIP_ROOT}/src/app/util/mock/include
${CHIP_ROOT}/zzz_generated
${CHIP_ROOT}/zzz_generated/lighting-app
${CHIP_ROOT}/zzz_generated/app-common
${CHIP_ROOT}/src/platform/Linux
${CHIP_ROOT}/examples/platform/linux
${CHIP_ROOT}/examples/lighting-app/lighting-common/include)
set(MATTER_FLAGS
-DCHIP_HAVE_CONFIG_H
@ -259,64 +262,67 @@ if(CONFIG_MATTER)
GN_DEPENDENCIES
mbedtls)
add_custom_command(
OUTPUT connectedhomeip/third_party/pigweed/repo
COMMAND rm ${CHIP_ROOT}/third_party/pigweed/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/pigweed
${CHIP_ROOT}/third_party/pigweed/repo)
if(${CHIP_ROOT} STREQUAL ${LOCAL_CHIP_ROOT})
add_custom_command(
OUTPUT connectedhomeip/third_party/pigweed/repo
COMMAND rm ${CHIP_ROOT}/third_party/pigweed/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/pigweed
${CHIP_ROOT}/third_party/pigweed/repo)
add_custom_target(chippigweed ALL
DEPENDS connectedhomeip/third_party/pigweed/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chippigweed)
add_custom_target(chippigweed ALL
DEPENDS connectedhomeip/third_party/pigweed/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chippigweed)
add_custom_command(
OUTPUT ${CHIP_ROOT}/build_overrides/pigweed_environment.gni
COMMAND touch ${CHIP_ROOT}/build_overrides/pigweed_environment.gni)
add_custom_command(
OUTPUT ${CHIP_ROOT}/build_overrides/pigweed_environment.gni
COMMAND touch ${CHIP_ROOT}/build_overrides/pigweed_environment.gni)
add_custom_target(
chipnpigweedenv ALL
DEPENDS ${CHIP_ROOT}/build_overrides/pigweed_environment.gni)
ExternalProject_Add_StepDependencies(chip-gn configure chipnpigweedenv)
add_dependencies(chippigweed chipnpigweedenv)
add_custom_target(
chipnpigweedenv ALL
DEPENDS ${CHIP_ROOT}/build_overrides/pigweed_environment.gni)
ExternalProject_Add_StepDependencies(chip-gn configure chipnpigweedenv)
add_dependencies(chippigweed chipnpigweedenv)
add_custom_command(
OUTPUT connectedhomeip/third_party/nlassert/repo
COMMAND rm ${CHIP_ROOT}/third_party/nlassert/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/nlassert
${CHIP_ROOT}/third_party/nlassert/repo)
add_custom_command(
OUTPUT connectedhomeip/third_party/nlassert/repo
COMMAND rm ${CHIP_ROOT}/third_party/nlassert/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/nlassert
${CHIP_ROOT}/third_party/nlassert/repo)
add_custom_target(chipnlassert ALL
DEPENDS connectedhomeip/third_party/nlassert/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipnlassert)
add_custom_target(chipnlassert ALL
DEPENDS connectedhomeip/third_party/nlassert/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipnlassert)
add_custom_command(
OUTPUT connectedhomeip/third_party/nlio/repo
COMMAND rm ${CHIP_ROOT}/third_party/nlio/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/nlio
${CHIP_ROOT}/third_party/nlio/repo)
add_custom_command(
OUTPUT connectedhomeip/third_party/nlio/repo
COMMAND rm ${CHIP_ROOT}/third_party/nlio/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/nlio
${CHIP_ROOT}/third_party/nlio/repo)
add_custom_target(chipnlio ALL DEPENDS connectedhomeip/third_party/nlio/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipnlio)
add_custom_target(chipnlio ALL
DEPENDS connectedhomeip/third_party/nlio/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipnlio)
add_custom_command(
OUTPUT connectedhomeip/third_party/nlunit-test/repo
COMMAND rm ${CHIP_ROOT}/third_party/nlunit-test/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/nlunit-test
${CHIP_ROOT}/third_party/nlunit-test/repo)
add_custom_command(
OUTPUT connectedhomeip/third_party/nlunit-test/repo
COMMAND rm ${CHIP_ROOT}/third_party/nlunit-test/repo -rf
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/connectedhomeip/nlunit-test
${CHIP_ROOT}/third_party/nlunit-test/repo)
add_custom_target(chipnlunit-test ALL
DEPENDS connectedhomeip/third_party/nlunit-test/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipnlunit-test)
add_custom_target(chipnlunit-test ALL
DEPENDS connectedhomeip/third_party/nlunit-test/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipnlunit-test)
add_custom_command(
OUTPUT connectedhomeip/third_party/jsoncpp/repo
COMMAND rm -rf ${CHIP_ROOT}/third_party/jsoncpp/repo
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/jsoncpp/jsoncpp
${CHIP_ROOT}/third_party/jsoncpp/repo)
add_custom_command(
OUTPUT connectedhomeip/third_party/jsoncpp/repo
COMMAND rm -rf ${CHIP_ROOT}/third_party/jsoncpp/repo
COMMAND ln -s ${NUTTX_APPS_DIR}/netutils/jsoncpp/jsoncpp
${CHIP_ROOT}/third_party/jsoncpp/repo)
add_custom_target(chipjsoncpp ALL
DEPENDS connectedhomeip/third_party/jsoncpp/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipjsoncpp)
add_custom_target(chipjsoncpp ALL
DEPENDS connectedhomeip/third_party/jsoncpp/repo)
ExternalProject_Add_StepDependencies(chip-gn configure chipjsoncpp)
endif()
set(DEMOSRC
${CHIP_ROOT}/examples/lighting-app/linux/main.cpp