Skip to content

Commit

Permalink
Ability to create out-of-tree MEI clusters
Browse files Browse the repository at this point in the history
Matter allows for MEI clusters. Currently, there is an example of such a cluster in the tree:  sample-mei-server. If device vendors want to create their own MEI cluster, it currently needs to be included in tree, because app-common would not include information of the out-of-tree MEI cluster.

This commits:
* adds an example for an external MEI cluster
* adds an mei-template.json that creates app-common out-of-tree
* adds build system modifications so that app-common which includes the external MEI cluster is being used when EXTERNAL_APP_COMMON is given to chip_configure_data_model().
  • Loading branch information
markus-becker-tridonic-com committed Jan 14, 2025
1 parent 211d33a commit a20312b
Show file tree
Hide file tree
Showing 73 changed files with 175,116 additions and 15 deletions.
2 changes: 1 addition & 1 deletion config/common/cmake/chip_gn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ macro(matter_build target)
${CHIP_ROOT}/third_party/nlassert/repo/include
${CHIP_ROOT}/third_party/nlio/repo/include
${CHIP_ROOT}/third_party/nlfaultinjection/include
${CHIP_ROOT}/zzz_generated/app-common
# ${CHIP_ROOT}/zzz_generated/app-common
${CMAKE_CURRENT_BINARY_DIR}/gen/include
)

Expand Down
10 changes: 10 additions & 0 deletions config/common/cmake/chip_gn_args.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ endmacro()
# DEVICE_INFO_EXAMPLE_PROVIDER Add example device info provider support
# PROJECT_CONFIG Path to the project-specific configuration file
# PROJECT_CONFIG_INC_DIR Extra include dirs for project configurations
# PROJECT_APP_COMMON_INC_DIR Extra include dir for custom app-common
#
macro(matter_common_gn_args)
set(options)
Expand All @@ -171,6 +172,7 @@ macro(matter_common_gn_args)
LIB_PW_RPC
DEVICE_INFO_EXAMPLE_PROVIDER
PROJECT_CONFIG
PROJECT_APP_COMMON_INC_DIR
)
set(multiValueArgs
PROJECT_CONFIG_INC_DIR
Expand Down Expand Up @@ -215,6 +217,14 @@ macro(matter_common_gn_args)
if (ARG_PROJECT_CONFIG_INC_DIR)
matter_add_gn_arg_list("chip_project_config_include_dirs" ${ARG_PROJECT_CONFIG_INC_DIR})
endif()
if (ARG_PROJECT_APP_COMMON_INC_DIR)
get_filename_component(PROJECT_APP_COMMON_INC_DIR
${ARG_PROJECT_APP_COMMON_INC_DIR}
REALPATH
BASE_DIR ${CMAKE_SOURCE_DIR}
)
matter_add_gn_arg_string("chip_project_app_common_include_dir" "${PROJECT_APP_COMMON_INC_DIR}")
endif()
endmacro()

# Generate the temporary GN arguments file from the settings
Expand Down
1 change: 1 addition & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ matter_common_gn_args(
LIB_SHELL CONFIG_CHIP_LIB_SHELL
LIB_TESTS CONFIG_CHIP_BUILD_TESTS
PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG}
PROJECT_APP_COMMON_INC_DIR ${CONFIG_CHIP_PROJECT_APP_COMMON_INCLUDE_DIRS}
DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER
)
matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR})
Expand Down
5 changes: 5 additions & 0 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ config CHIP_PROJECT_CONFIG
configuration file that can be used to override any of Matter's default or
platform-specific settings.

config CHIP_PROJECT_APP_COMMON_INCLUDE_DIRS
string "Project specific app-common directory for MEI clusters"
help
Provides a directory to the app-common/ folder.

# Thread network features

config CHIP_ENABLE_DNSSD_SRP
Expand Down
42 changes: 42 additions & 0 deletions examples/external-mei-app/external-mei-common/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/src/app/chip_data_model.gni")

config("config") {
include_dirs = [ "include" ]
}

chip_data_model("lighting-common") {
zap_file = "lighting-app.zap"
is_server = true
}

source_set("color-format") {
public_configs = [ ":config" ]
sources = [
"include/ColorFormat.h",
"src/ColorFormat.cpp",
]
}

source_set("lighting-manager") {
deps = [ "${chip_root}/src/lib" ]
public_configs = [ ":config" ]
sources = [
"include/LightingManager.h",
"src/LightingManager.cpp",
]
}
Loading

0 comments on commit a20312b

Please sign in to comment.