blob: 90eb91de23c57bfce4c207dfced3395c896b81c8 [file] [log] [blame]
# Copyright 2023 The Pigweed 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
#
# https://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/pigweed.gni")
import("$dir_pw_build/python.gni")
import("$dir_pw_build/python_dist.gni")
import("$dir_pw_build/python_venv.gni")
import("$dir_pw_unit_test/test.gni")
# All the targets build by default with e.g. `ninja -C out`.
group("default") {
deps = [
":applications",
":gonk_python.lint",
":gonk_python.tests",
":python.install",
# TODO(tonymd): Enable the verilog build by default when the following tools
# are available in CIPD: yosys, nextpnr-ice40, icetime, icepack
# ":fpga",
]
}
group("applications") {
deps = [
"//applications/system_example(//targets/host:host_device_simulator.speed_optimized)",
"//applications/system_example(//targets/stm32f769i_disc0_stm32cube:stm32f769i_disc0_stm32cube.size_optimized)",
# Arduino targets
"//applications/fpga_config(//targets/stm32f730r8tx_arduino:arduino_size_optimized)",
"//applications/spi_flash_test(//targets/stm32f730r8tx_arduino:arduino_size_optimized)",
]
}
# This group requires the following tools for the FPGA build:
# yosys, nextpnr-ice40, icepack, icetime
group("fpga") {
deps = [
":pip_install_gonk_fpga",
"//fpga",
]
}
# Python Targets
_gonk_python_packages = [ "//tools" ]
_gonk_proto_packages = [ "//lib/adc:protos.python" ]
# Pigweed Python packages to include
_pigweed_python_packages = [ "$dir_pw_env_setup:core_pigweed_python_packages" ]
_all_python_packages =
_gonk_python_packages + _gonk_proto_packages + _pigweed_python_packages
# Group that defines all Python test and lint targets.
pw_python_group("gonk_python") {
python_deps = _gonk_python_packages
}
# The python virtualenv used for testing and linting.
pw_python_venv("gonk_build_venv") {
path = "$root_build_dir/python-venv"
source_packages = _all_python_packages
}
# Bundle of all Gonk Python packages and their Pigweed dependencies
pw_python_distribution("gonk_python_distribution") {
packages = _gonk_python_packages + _gonk_proto_packages
generate_setup_cfg = {
name = "gonk-dist"
version = "0.0.1"
append_date_to_version = true
include_default_pyproject_file = true
}
}
# Pip install target for Gonk Python tools and protos.
pw_python_pip_install("pip_install_gonk_dist") {
packages = [ ":gonk_python_distribution" ]
}
# Python data package for the FPGA build.
pw_python_distribution("gonk_fpga_distribution") {
packages = []
generate_setup_cfg = {
name = "gonk-fpga"
version = "0.0.1"
append_date_to_version = true
include_default_pyproject_file = true
include_extra_files_in_package_data = true
auto_create_package_data_init_py_files = true
}
public_deps = []
# The FPGA image is only built on Linux so far.
if (host_os == "linux") {
_fpga_artifacts_dir = "$root_build_dir/obj/fpga/toplevel"
public_deps += [ "//fpga:toplevel._bin($default_toolchain)" ]
extra_files =
[ "$_fpga_artifacts_dir/toplevel.bin > gonk_fpga/toplevel.bin" ]
}
}
# Pip install target for the FPGA datapackage only. This is sparate since the
# FPGA toolchain is an optional build component.
pw_python_pip_install("pip_install_gonk_fpga") {
packages = [ ":gonk_fpga_distribution" ]
}
# Python group used durring bootstrap.
pw_python_group("python") {
python_deps = [
":pip_install_gonk_dist",
"$dir_pw_env_setup:pip_install_pigweed_package",
]
}