blob: 8d96877cfcdeb9d5bce22d56b50aada13a665f5f [file] [log] [blame]
# Copyright 2022 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/pi_pico.gni")
import("//build_overrides/pigweed.gni")
import("$dir_pw_arduino_build/arduino.gni")
import("$dir_pw_build/python.gni")
import("$dir_pw_build/python_dist.gni")
import("$dir_pw_third_party/stm32cube/stm32cube.gni")
import("$dir_pw_tokenizer/database.gni")
import("$dir_pw_unit_test/test.gni")
# Lists all the targets build by default with e.g. `ninja -C out`.
group("default") {
deps = [
":applications",
":arduino",
":host",
":pico",
":python.lint",
":python.tests",
]
}
# Group all targets that run on host only, e.g. tests, utils.
group("host") {
deps = [
":host_tests(//targets/host:host_debug_tests)",
"$dir_pw_color:tests.run(//targets/host:host_debug_tests)",
"$dir_pw_draw:tests.run(//targets/host:host_debug_tests)",
"$dir_pw_framebuffer:tests.run(//targets/host:host_debug_tests)",
# See //applications/pw_lcd_display_host_imgui/README.md for instructions.
"//applications/terminal_display:all(//targets/host:host_debug)",
]
# If building Pi Pico builds compile the elf2uf2 utility.
if (PICO_SRC_DIR != "") {
deps += [ "//targets/rp2040:elf2uf2(//targets/host:host_debug)" ]
}
}
# Arduino specific targets.
group("arduino") {
if (pw_arduino_build_CORE_PATH != "") {
deps = [ ":arduino_tests(//targets/arduino:arduino_debug_tests)" ]
if (pw_arduino_build_CORE_NAME == "teensy") {
deps += [
# See //pw_lcd_display_teensy_ili9341/README.md for instructions.
"//applications/terminal_display:all(//targets/arduino:arduino_debug)",
]
}
}
}
# This gn arg must be set to build for the rp2040
# PICO_SRC_DIR = "$HOME/pico-sdk"
group("pico") {
if (PICO_SRC_DIR != "") {
deps = [
":pico_tests(//targets/rp2040)",
"//applications/terminal_display:all(//targets/rp2040)",
]
}
}
# stm32f429i_disc1 specific targets.
group("stm32f429i_disc1") {
_default_toolchain = "//targets/stm32f429i_disc1:stm32f429i_disc1_debug"
_testing_toolchain = "${_default_toolchain}_tests"
deps = [
# ":app(${_default_toolchain})",
":tests(${_testing_toolchain})",
]
}
# Python packages are built using the host toolchain.
pw_python_group("python") {
# This depends on the 'tools' target in //tools/BUILD.gn
python_deps = [
":pip_install_experimental_tools",
"//third_party/pigweed/pw_env_setup:python",
"//third_party/pigweed/pw_env_setup:target_support_packages",
]
}
pw_internal_pip_install("pip_install_experimental_tools") {
packages = [
"//applications/tls_example/trust_store/py",
"//tools:tools",
"//pw_graphics/py",
]
editable = true
}
group("applications") {
deps = []
# Teensy 3.0/4.0 applications steps.
if (pw_arduino_build_CORE_PATH != "") {
deps += [
":applications_tests(//targets/arduino:arduino_debug_tests)",
"//applications/blinky:blinky(//targets/arduino:arduino_debug)",
"//applications/rpc:all(//targets/arduino:arduino_debug)",
"//applications/strings:all(//targets/arduino:arduino_debug)",
]
if (pw_arduino_build_CORE_NAME == "teensy") {
deps += [
"//applications/tls_example:boringssl_teensy_ethernet(//targets/arduino:arduino_debug)",
"//applications/tls_example:mbedtls_teensy_ethernet(//targets/arduino:arduino_debug)",
"//applications/tls_example:picotls_teensy_ethernet(//targets/arduino:arduino_debug)",
]
}
}
# Raspberry Pi Pico
if (PICO_SRC_DIR != "") {
deps += [
":applications_tests(//targets/rp2040)",
"//applications/blinky:blinky(//targets/rp2040)",
"//applications/rpc:all(//targets/rp2040)",
"//applications/strings:all(//targets/rp2040)",
]
}
# STMicroelectronics STM32F429I-DISC1 applications steps.
deps += [
":applications_tests(//targets/stm32f429i_disc1:stm32f429i_disc1_debug_tests)",
"//applications/blinky:blinky(//targets/stm32f429i_disc1:stm32f429i_disc1_debug)",
"//applications/rpc:all(//targets/stm32f429i_disc1:stm32f429i_disc1_debug)",
"//applications/strings:all(//targets/stm32f429i_disc1:stm32f429i_disc1_debug)",
]
if (dir_pw_third_party_stm32cube_f4 != "") {
# STMicroelectronics STM32F429I-DISC1 STM32Cube applications steps.
deps += [
":applications_tests(//targets/stm32f429i_disc1_stm32cube:stm32f429i_disc1_stm32cube_debug)",
"//applications/blinky:blinky(//targets/stm32f429i_disc1_stm32cube:stm32f429i_disc1_stm32cube_debug)",
"//applications/terminal_display:all(//targets/stm32f429i_disc1_stm32cube:stm32f429i_disc1_stm32cube_debug)",
]
# STMicroelectronics STM32F439ZI-Nucleo applications steps.
deps += [
":applications_tests(//targets/stm32f439zi_nucleo:stm32f439zi_nucleo_debug)",
"//applications/blinky:blinky(//targets/stm32f439zi_nucleo:stm32f439zi_nucleo_debug)",
]
}
if (dir_pw_third_party_stm32cube_f2 != "") {
deps += [ "//applications/blinky:blinky(//targets/stm32f207zg-nucleo:stm32f207zg_nucleo_debug)" ]
}
if (dir_pw_third_party_stm32cube_l5 != "") {
deps += [ "//applications/blinky:blinky(//targets/stm32l552ze-nucleo:stm32l552ze_nucleo_debug)" ]
}
if (dir_pw_third_party_stm32cube_h7 != "") {
deps += [ "//applications/blinky:blinky(//targets/stm32h753zi-nucleo:stm32h753zi_nucleo_debug)" ]
}
# Host applications steps.
deps += [
":applications_tests(//targets/host:host_debug_tests)",
"//applications/blinky:blinky(//targets/host:host_debug)",
"//applications/strings:all(//targets/host:host_debug)",
]
}
# Group the different modules tests together.
pw_test_group("tests") {
group_deps = [ "//applications/strings:tests" ]
if (pw_arduino_build_CORE_NAME == "teensy") {
group_deps += []
}
}
# Test groups for each platform that will build and optionally run the tests.
foreach(test_group,
[
"arduino",
"pico",
"host",
"applications",
]) {
group("${test_group}_tests") {
deps = []
if (pw_unit_test_AUTOMATIC_RUNNER == "" || test_group != "host") {
# Without a test runner defined, build the tests but don't run them.
deps += [ ":tests" ]
} else {
# With a test runner, build and run tests.
deps += [ ":tests.run" ]
}
}
}