blob: f2e002858a2462b38649d265711f8d5aa36319eb [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")
if (current_os == "mac") {
import("${build_root}/config/mac/mac_sdk.gni")
}
config("controller_wno_deprecate") {
cflags = [ "-Wno-deprecated-declarations" ]
}
shared_library("ChipDeviceCtrl") {
output_name = "_ChipDeviceCtrl"
output_dir = "${target_out_dir}/chip"
include_dirs = [ "." ]
sources = [
"ChipDeviceController-ScriptBinding.cpp",
"ChipDeviceController-ScriptDeviceAddressUpdateDelegate.cpp",
"ChipDeviceController-ScriptDeviceAddressUpdateDelegate.h",
"ChipDeviceController-ScriptDevicePairingDelegate.cpp",
"ChipDeviceController-ScriptDevicePairingDelegate.h",
"ChipDeviceController-StorageDelegate.cpp",
"ChipDeviceController-StorageDelegate.h",
"chip/clusters/CHIPClusters.cpp",
"chip/discovery/NodeResolution.cpp",
"chip/interaction_model/Delegate.cpp",
"chip/interaction_model/Delegate.h",
"chip/internal/ChipThreadWork.cpp",
"chip/internal/ChipThreadWork.h",
"chip/internal/CommissionerImpl.cpp",
"chip/logging/LoggingRedirect.cpp",
"chip/native/StackInit.cpp",
"chip/setup_payload/Parser.cpp",
]
if (chip_enable_ble) {
if (current_os == "linux") {
sources += [ "chip/ble/LinuxImpl.cpp" ]
} else if (current_os == "mac") {
sources += [
"chip/ble/darwin/AdapterListing.mm",
"chip/ble/darwin/Scanning.mm",
]
} else {
assert(false, "No BLE implementation available for the current OS.")
}
}
public_deps = [
"${chip_root}/src/app",
"${chip_root}/src/controller/data_model",
"${chip_root}/src/lib",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/mdns",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform",
"${chip_root}/src/setup_payload",
"${chip_root}/src/transport",
]
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/ChipCoreBluetoothMgr.py",
"chip/ChipDeviceCtrl.py",
"chip/ChipStack.py",
"chip/ChipUtility.py",
"chip/__init__.py",
"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",
"chip/clusters/CHIPClusters.py",
"chip/clusters/__init__.py",
"chip/configuration/__init__.py",
"chip/discovery/__init__.py",
"chip/discovery/library_handle.py",
"chip/discovery/types.py",
"chip/exceptions/__init__.py",
"chip/interaction_model/delegate.py",
"chip/internal/__init__.py",
"chip/internal/commissioner.py",
"chip/internal/thread.py",
"chip/internal/types.py",
"chip/logging/__init__.py",
"chip/logging/library_handle.py",
"chip/logging/types.py",
"chip/native/__init__.py",
"chip/setup_payload/__init__.py",
"chip/setup_payload/setup_payload.py",
"chip/tlv/__init__.py",
]
},
{
src_dir = target_out_dir
sources = [ "${target_out_dir}/chip/_ChipDeviceCtrl.so" ]
},
{
src_dir = "//"
sources = [ "//LICENSE" ]
},
]
_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"
if (current_cpu == "x64") {
cpu_tag = "x86_64"
} else if (current_cpu == "arm64") {
cpu_tag = "aarch64"
} else {
cpu_tag = current_cpu
}
if (current_os == "mac") {
platform_tag = "macosx_" + string_replace(mac_deployment_target, ".", "_")
} else {
platform_tag = current_os
}
platform_tag = platform_tag + "_" + cpu_tag
tags = "cp37-abi3-" + platform_tag
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),
"--plat-name",
platform_tag,
]
public_deps = [ ":ChipDeviceCtrl" ]
output_name = "chip-0.0-${tags}.whl"
outputs = [ "${_dist_dir}/$output_name" ]
}