-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into darwin-xcode-m1-build
Showing
157 changed files
with
809 additions
and
2,994 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Run chip code generation. | ||
# | ||
# Example usage: | ||
# chip_codegen("app" | ||
# INPUT "some_file.matter" | ||
# GENERATOR "bridge" | ||
# OUTPUTS | ||
# "bridge/OnOff.h" | ||
# "bridge/LevelControl.h" | ||
# "bridge/Switch.h" | ||
# # ... more outputs | ||
# OUTPUT_PATH DIR_NAME_VAR | ||
# OUTPUT_FILES FILE_NAMES_VAR | ||
# ) | ||
# | ||
# Arguments: | ||
# INPUT - the name of the ".matter" file to use for generation | ||
# GENERATOR - generator to use for codegen.py | ||
# OUTPUTS - EXPECTED output names. MUST match actual outputs | ||
# | ||
# OUTPUT_PATH - [OUT] output variable will contain the directory where the | ||
# files will be generated | ||
# OUTPUT_FILES - [OUT] output variable will contain the path of generated files. | ||
# suitable to be added within a build target | ||
# | ||
function(chip_codegen TARGET_NAME) | ||
cmake_parse_arguments(ARG | ||
"" | ||
"INPUT;GENERATOR;OUTPUT_PATH;OUTPUT_FILES" | ||
"OUTPUTS" | ||
${ARGN} | ||
) | ||
|
||
set(GEN_FOLDER "${CMAKE_BINARY_DIR}/gen/${TARGET_NAME}/${ARG_GENERATOR}") | ||
|
||
string(REPLACE ";" "\n" OUTPUT_AS_NEWLINES "${ARG_OUTPUTS}") | ||
|
||
file(MAKE_DIRECTORY "${GEN_FOLDER}") | ||
file(GENERATE | ||
OUTPUT "${GEN_FOLDER}/expected.outputs" | ||
CONTENT "${OUTPUT_AS_NEWLINES}" | ||
) | ||
|
||
|
||
set(OUT_NAMES) | ||
foreach(NAME IN LISTS ARG_OUTPUTS) | ||
list(APPEND OUT_NAMES "${GEN_FOLDER}/${NAME}") | ||
endforeach() | ||
|
||
# Python is expected to be in the path | ||
# | ||
# find_package(Python3 REQUIRED) | ||
add_custom_command( | ||
OUTPUT "${OUT_NAMES}" | ||
COMMAND "${CHIP_ROOT}/scripts/codegen.py" | ||
ARGS "--generator" "${ARG_GENERATOR}" | ||
"--output-dir" "${GEN_FOLDER}" | ||
"--expected-outputs" "${GEN_FOLDER}/expected.outputs" | ||
"${ARG_INPUT}" | ||
DEPENDS | ||
"${ARG_INPUT}" | ||
VERBATIM | ||
) | ||
|
||
add_custom_target(${TARGET_NAME} DEPENDS "${OUT_NAMES}") | ||
|
||
# Forward outputs to the parent | ||
set(${ARG_OUTPUT_FILES} "${OUT_NAMES}" PARENT_SCOPE) | ||
set(${ARG_OUTPUT_PATH} "${GEN_FOLDER}" PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# Copyright (c) 2022 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# 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. | ||
# | ||
|
||
|
||
|
||
macro(chip_app_component_codegen IDL_NAME) | ||
include("${CHIP_ROOT}/build/chip/chip_codegen.cmake") | ||
|
||
# The IDF build system performs a two-pass expansion to determine | ||
# component expansion. The first pass runs in script-mode | ||
# to determine idf_component_register REQUIRES and PRIV_REQUIRES. | ||
# | ||
# We can only set up code generation during the 2nd pass | ||
# | ||
# see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html | ||
if (NOT CMAKE_BUILD_EARLY_EXPANSION) | ||
|
||
chip_codegen(app-codegen | ||
INPUT "${IDL_NAME}" | ||
GENERATOR "cpp-app" | ||
OUTPUTS | ||
"app/PluginApplicationCallbacks.h" | ||
OUTPUT_PATH APP_GEN_DIR | ||
OUTPUT_FILES APP_GEN_FILES | ||
) | ||
|
||
target_include_directories(${COMPONENT_LIB} PUBLIC "${APP_GEN_DIR}") | ||
|
||
add_dependencies(${COMPONENT_LIB} app-codegen) | ||
endif() | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.