blob: 21e6bd9c70123f7cc76e5f6232a4f2f18cf6d417 [file] [log] [blame]
# Copyright 2020 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.
# Include this import first. Adding a comment prevents imports reordering.
import("//build_overrides/pigweed.gni")
import("$dir_pw_arduino_build/arduino.gni")
import("$dir_pw_tokenizer/database.gni")
import("$dir_pw_unit_test/test.gni")
# NOTE: All the `deps` listed in `//BUILD.gn` must either be instantiated with a
# toolchain, e.g. `":my_host_target(//path/to/host:toolchain)"`, or listed
# within an `if (current_toolchain != default_toolchain)` statement.
# It also prevents the default toolchain from parsing any unnecessary BUILD.gn
# files.
# Group the different modules tests together.
pw_test_group("tests") {
group_deps = [ "//source/simple_counter:tests" ]
}
group("app") {
deps = []
if (current_toolchain != default_toolchain) {
deps += [ "//source:hello_world" ]
}
}
# Will group all targets that run on host only, e.g. tests, utils. For example
# purposes it uses clang debug toolchain for building. It is recommended that
# the user adds their own toolchain.
group("host") {
deps = [
":app(//targets/host:host_clang_debug)",
":host_tests(//targets/host:host_clang_debug_tests)",
]
}
group("host_tests") {
deps = []
if (pw_unit_test_AUTOMATIC_RUNNER == "") {
# Without a test runner defined, build the tests but don't run them.
deps += [ ":tests" ]
} else {
# With a test runner, depend on the run targets so they run with the
# build.
deps += [ ":tests_run" ]
}
deps += [ "$dir_pw_trace" ]
}
group("arduino") {
if (dir_pw_third_party_arduino != "") {
deps = [
":app(//targets/arduino:arduino_debug)",
":arduino_tests(//targets/arduino:arduino_debug_tests)",
"//source/arduino_example:blink(//targets/arduino:arduino_debug)",
]
}
}
group("arduino_tests") {
deps = []
if (pw_unit_test_AUTOMATIC_RUNNER == "") {
# Without a test runner defined, build the tests but don't run them.
deps += [ ":tests" ]
} else {
# With a test runner, depend on the run targets so they run with the
# build.
deps += [ ":tests_run" ]
}
}
pw_tokenizer_database("tokenizer_database") {
database = "//source/tokenizer_database.csv"
if (host_os == "linux") {
targets = [ ":app(//targets/host:host_clang_debug)" ]
} else {
targets = []
}
if (dir_pw_third_party_arduino != "") {
targets += [
":app(//targets/arduino:arduino_debug)",
"//source/arduino_example:blink(//targets/arduino:arduino_debug)",
]
}
}
group("workshop") {
if (dir_pw_third_party_arduino != "") {
deps = [ "//workshop/01-blinky:blinky(//targets/arduino:arduino_debug)" ]
}
}
# Lists all the targets build by default with e.g. `ninja -C out`.
group("default") {
deps = [
":arduino",
":host",
":tokenizer_database",
":workshop",
]
}