blob: 03b3880e0b128c50e12a58ce9dcbd6d38e732144 [file] [log] [blame]
# 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/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/python.gni")
import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/platform/device.gni")
import("${dir_pw_unit_test}/test.gni")
config("controller_wno_deprecate") {
cflags = [ "-Wno-deprecated-declarations" ]
}
config("includes") {
include_dirs =
[ "${chip_root}/src/controller/CHIPDeviceController_deprecated.h" ]
}
shared_library("ChipDeviceCtrl") {
output_name = "_ChipDeviceCtrl"
output_dir = "${target_out_dir}/chip"
include_dirs = [ "." ]
sources = [
"ChipDeviceController-ClusterCommands.cpp",
"ChipDeviceController-ScriptBinding.cpp",
"ChipDeviceController-ScriptDeviceAddressUpdateDelegate.cpp",
"ChipDeviceController-ScriptDeviceAddressUpdateDelegate.h",
"ChipDeviceController-ScriptDevicePairingDelegate.cpp",
"ChipDeviceController-ScriptDevicePairingDelegate.h",
"ChipDeviceController-StorageDelegate.cpp",
"ChipDeviceController-StorageDelegate.h",
"chip/internal/ChipThreadWork.cpp",
"chip/internal/ChipThreadWork.h",
"chip/internal/CommissionerImpl.cpp",
"chip/logging/LoggingRedirect.cpp",
"chip/native/StackInit.cpp",
]
if (current_os == "linux" && chip_enable_ble) {
sources += [ "chip/ble/LinuxImpl.cpp" ]
}
public_deps = [
"${chip_root}/src/app",
"${chip_root}/src/controller",
"${chip_root}/src/lib",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform",
"${chip_root}/src/transport",
]
allow_circular_includes_from = [ "${chip_root}/src/controller" ]
configs += [ ":controller_wno_deprecate" ]
}
pw_python_action("python") {
script = "build-chip-wheel.py"
_py_manifest_files = [
{
src_dir = "."
sources = [
"chip-device-ctrl.py",
"chip-repl.py",
"chip/ChipBleBase.py",
"chip/ChipBleUtility.py",
"chip/ChipBluezMgr.py",
"chip/ChipCluster.py",
"chip/ChipCoreBluetoothMgr.py",
"chip/ChipDeviceCtrl.py",
"chip/ChipStack.py",
"chip/ChipUtility.py",
"chip/__init__.py",
"chip/configuration/__init__.py",
"chip/exceptions/__init__.py",
"chip/internal/__init__.py",
"chip/internal/commissioner.py",
"chip/internal/types.py",
"chip/logging/__init__.py",
"chip/logging/library_handle.py",
"chip/logging/types.py",
"chip/native/__init__.py",
"chip/tlv/__init__.py",
]
},
{
src_dir = target_out_dir
sources = [ "${target_out_dir}/chip/_ChipDeviceCtrl.so" ]
},
{
src_dir = "//"
sources = [ "//LICENSE" ]
},
]
if (chip_enable_ble) {
_py_manifest_files += [
{
src_dir = "."
sources = [
"chip/ble/__init__.py",
"chip/ble/commissioning/__init__.py",
"chip/ble/get_adapters.py",
"chip/ble/library_handle.py",
"chip/ble/scan_devices.py",
"chip/ble/types.py",
]
},
]
}
_py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json"
inputs = []
_py_manifest_files_rebased = []
foreach(_manifest_entry, _py_manifest_files) {
inputs += _manifest_entry.sources
_py_manifest_files_rebased += [
{
src_dir = rebase_path(_manifest_entry.src_dir,
get_path_info(_py_manifest_file, "dir"))
sources = rebase_path(_manifest_entry.sources, _manifest_entry.src_dir)
},
]
}
_py_manifest = {
files = _py_manifest_files_rebased
}
write_file(_py_manifest_file, _py_manifest, "json")
_dist_dir = "${root_out_dir}/controller/python"
args = [
"--package_name",
"chip",
"--build_number",
"0.0",
"--build_dir",
rebase_path("${target_gen_dir}/${target_name}.py_build", root_build_dir),
"--dist_dir",
rebase_path(_dist_dir, root_build_dir),
"--manifest",
rebase_path(_py_manifest_file, root_build_dir),
]
public_deps = [ ":ChipDeviceCtrl" ]
pythontags = exec_script("${chip_root}/build/chip/python_gen_tags.py",
[],
"list lines",
[])
pythontagsStr = string_join("", pythontags)
output_name = "chip-0.0-$pythontagsStr.whl"
outputs = [ "${_dist_dir}/$output_name" ]
}