183 lines
4.6 KiB
Plaintext
183 lines
4.6 KiB
Plaintext
# 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_async/async.gni")
|
|
import("$dir_pw_async/fake_dispatcher_fixture.gni")
|
|
import("$dir_pw_async/fake_dispatcher_test.gni")
|
|
import("$dir_pw_bloat/bloat.gni")
|
|
import("$dir_pw_build/target_types.gni")
|
|
import("$dir_pw_chrono/backend.gni")
|
|
import("$dir_pw_docgen/docs.gni")
|
|
import("$dir_pw_sync/backend.gni")
|
|
import("$dir_pw_thread/backend.gni")
|
|
import("$dir_pw_unit_test/test.gni")
|
|
|
|
config("public_include_path") {
|
|
include_dirs = [ "public" ]
|
|
}
|
|
|
|
config("backend_config") {
|
|
include_dirs = [ "public_overrides" ]
|
|
visibility = [ ":*" ]
|
|
}
|
|
|
|
# Backend for //pw_async:task
|
|
pw_source_set("task") {
|
|
public_configs = [
|
|
":public_include_path",
|
|
":backend_config",
|
|
]
|
|
public = [
|
|
"public/pw_async_basic/task.h",
|
|
"public_overrides/pw_async_backend/task.h",
|
|
]
|
|
|
|
public_deps = [
|
|
"$dir_pw_async:task.facade",
|
|
"$dir_pw_containers:intrusive_list",
|
|
]
|
|
visibility = [
|
|
":*",
|
|
"$dir_pw_async:*",
|
|
"size_report:*",
|
|
] + pw_async_EXPERIMENTAL_MODULE_VISIBILITY
|
|
}
|
|
|
|
# Backend for //pw_async:fake_dispatcher
|
|
pw_source_set("fake_dispatcher") {
|
|
public_configs = [
|
|
":public_include_path",
|
|
":backend_config",
|
|
]
|
|
sources = [ "fake_dispatcher.cc" ]
|
|
public = [
|
|
"public/pw_async_basic/fake_dispatcher.h",
|
|
"public_overrides/pw_async_backend/fake_dispatcher.h",
|
|
]
|
|
public_deps = [
|
|
":task",
|
|
"$dir_pw_async:fake_dispatcher.facade",
|
|
]
|
|
deps = [ dir_pw_log ]
|
|
visibility = [
|
|
":*",
|
|
"$dir_pw_async:*",
|
|
] + pw_async_EXPERIMENTAL_MODULE_VISIBILITY
|
|
}
|
|
|
|
fake_dispatcher_test("fake_dispatcher_test") {
|
|
backend = ":fake_dispatcher"
|
|
}
|
|
|
|
fake_dispatcher_fixture("fake_dispatcher_fixture") {
|
|
backend = ":fake_dispatcher"
|
|
}
|
|
|
|
pw_test("fake_dispatcher_fixture_test") {
|
|
enable_if = pw_chrono_SYSTEM_CLOCK_BACKEND != ""
|
|
sources = [ "fake_dispatcher_fixture_test.cc" ]
|
|
deps = [ ":fake_dispatcher_fixture" ]
|
|
}
|
|
|
|
pw_source_set("dispatcher") {
|
|
public_configs = [ ":public_include_path" ]
|
|
public = [ "public/pw_async_basic/dispatcher.h" ]
|
|
sources = [ "dispatcher.cc" ]
|
|
public_deps = [
|
|
":task",
|
|
"$dir_pw_async:dispatcher",
|
|
"$dir_pw_containers:intrusive_list",
|
|
"$dir_pw_sync:interrupt_spin_lock",
|
|
"$dir_pw_sync:timed_thread_notification",
|
|
"$dir_pw_thread:thread_core",
|
|
dir_pw_log,
|
|
]
|
|
visibility = [
|
|
":*",
|
|
"size_report:*",
|
|
] + pw_async_EXPERIMENTAL_MODULE_VISIBILITY
|
|
}
|
|
|
|
pw_test("dispatcher_test") {
|
|
enable_if = pw_chrono_SYSTEM_CLOCK_BACKEND != "" &&
|
|
pw_thread_THREAD_BACKEND == "$dir_pw_thread_stl:thread"
|
|
public_deps = [
|
|
":dispatcher",
|
|
"$dir_pw_thread:thread",
|
|
dir_pw_log,
|
|
]
|
|
sources = [ "dispatcher_test.cc" ]
|
|
}
|
|
|
|
pw_test_group("tests") {
|
|
tests = [
|
|
":dispatcher_test",
|
|
":fake_dispatcher_test",
|
|
":fake_dispatcher_fixture_test",
|
|
]
|
|
}
|
|
|
|
pw_doc_group("docs") {
|
|
sources = [ "docs.rst" ]
|
|
report_deps = [ ":docs_size_report" ]
|
|
}
|
|
|
|
pw_size_diff("docs_size_report") {
|
|
title = "pw_async_basic Docs Size Report"
|
|
base = "$dir_pw_bloat:bloat_base"
|
|
|
|
binaries = []
|
|
|
|
if (pw_chrono_SYSTEM_CLOCK_BACKEND != "") {
|
|
binaries += [
|
|
{
|
|
target = "size_report:task"
|
|
label = "Construct a Task"
|
|
},
|
|
]
|
|
}
|
|
|
|
if (binaries == []) {
|
|
binaries += [
|
|
{
|
|
target = "$dir_pw_bloat:bloat_base"
|
|
label = "No backend is selected."
|
|
},
|
|
]
|
|
}
|
|
}
|
|
|
|
# This size report can't be included in docs because the docs build target uses
|
|
# the target-stm32f429i-disc1 toolchain, which does not support timed thread
|
|
# notifications (mutex & condition_variable headers are not available).
|
|
pw_size_diff("size_report") {
|
|
title = "pw_async_basic Size Report"
|
|
base = "$dir_pw_bloat:bloat_base"
|
|
|
|
binaries = []
|
|
|
|
if (pw_chrono_SYSTEM_CLOCK_BACKEND != "" &&
|
|
pw_sync_THREAD_NOTIFICATION_BACKEND != "" &&
|
|
pw_sync_TIMED_THREAD_NOTIFICATION_BACKEND != "") {
|
|
binaries += [
|
|
{
|
|
target = "size_report:post_1_task"
|
|
label = "Post 1 Task to BasicDispatcher"
|
|
},
|
|
]
|
|
}
|
|
}
|