You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
4.2 KiB
173 lines
4.2 KiB
# 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.
|
|
|
|
import("//build_overrides/pigweed.gni")
|
|
|
|
import("$dir_pw_build/facade.gni")
|
|
import("$dir_pw_build/target_types.gni")
|
|
import("$dir_pw_docgen/docs.gni")
|
|
import("$dir_pw_unit_test/test.gni")
|
|
import("backend.gni")
|
|
|
|
config("public_include_path") {
|
|
include_dirs = [ "public" ]
|
|
visibility = [ ":*" ]
|
|
}
|
|
|
|
pw_facade("binary_semaphore") {
|
|
backend = pw_sync_BINARY_SEMAPHORE_BACKEND
|
|
public_configs = [ ":public_include_path" ]
|
|
public = [ "public/pw_sync/binary_semaphore.h" ]
|
|
public_deps = [
|
|
"$dir_pw_chrono:system_clock",
|
|
"$dir_pw_preprocessor",
|
|
]
|
|
sources = [ "binary_semaphore.cc" ]
|
|
}
|
|
|
|
pw_facade("counting_semaphore") {
|
|
backend = pw_sync_COUNTING_SEMAPHORE_BACKEND
|
|
public_configs = [ ":public_include_path" ]
|
|
public = [ "public/pw_sync/counting_semaphore.h" ]
|
|
public_deps = [
|
|
"$dir_pw_chrono:system_clock",
|
|
"$dir_pw_preprocessor",
|
|
]
|
|
sources = [ "counting_semaphore.cc" ]
|
|
}
|
|
|
|
pw_source_set("lock_annotations") {
|
|
public_configs = [ ":public_include_path" ]
|
|
public = [ "public/pw_sync/lock_annotations.h" ]
|
|
public_deps = [ "$dir_pw_preprocessor" ]
|
|
}
|
|
|
|
pw_facade("mutex") {
|
|
backend = pw_sync_MUTEX_BACKEND
|
|
public_configs = [ ":public_include_path" ]
|
|
public = [ "public/pw_sync/mutex.h" ]
|
|
public_deps = [
|
|
":lock_annotations",
|
|
"$dir_pw_preprocessor",
|
|
]
|
|
sources = [ "mutex.cc" ]
|
|
}
|
|
|
|
pw_facade("timed_mutex") {
|
|
backend = pw_sync_TIMED_MUTEX_BACKEND
|
|
public_configs = [ ":public_include_path" ]
|
|
public = [ "public/pw_sync/timed_mutex.h" ]
|
|
public_deps = [
|
|
":mutex",
|
|
"$dir_pw_chrono:system_clock",
|
|
"$dir_pw_preprocessor",
|
|
]
|
|
sources = [ "timed_mutex.cc" ]
|
|
}
|
|
|
|
pw_facade("interrupt_spin_lock") {
|
|
backend = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND
|
|
public_configs = [ ":public_include_path" ]
|
|
public = [ "public/pw_sync/interrupt_spin_lock.h" ]
|
|
public_deps = [
|
|
":lock_annotations",
|
|
"$dir_pw_preprocessor",
|
|
]
|
|
sources = [ "interrupt_spin_lock.cc" ]
|
|
}
|
|
|
|
pw_source_set("yield_core") {
|
|
public = [ "public/pw_sync/yield_core.h" ]
|
|
public_configs = [ ":public_include_path" ]
|
|
}
|
|
|
|
pw_test_group("tests") {
|
|
tests = [
|
|
":binary_semaphore_facade_test",
|
|
":counting_semaphore_facade_test",
|
|
":mutex_facade_test",
|
|
":timed_mutex_facade_test",
|
|
":interrupt_spin_lock_facade_test",
|
|
]
|
|
}
|
|
|
|
pw_test("binary_semaphore_facade_test") {
|
|
enable_if = pw_sync_BINARY_SEMAPHORE_BACKEND != ""
|
|
sources = [
|
|
"binary_semaphore_facade_test.cc",
|
|
"binary_semaphore_facade_test_c.c",
|
|
]
|
|
deps = [
|
|
":binary_semaphore",
|
|
"$dir_pw_preprocessor",
|
|
pw_sync_BINARY_SEMAPHORE_BACKEND,
|
|
]
|
|
}
|
|
|
|
pw_test("counting_semaphore_facade_test") {
|
|
enable_if = pw_sync_COUNTING_SEMAPHORE_BACKEND != ""
|
|
sources = [
|
|
"counting_semaphore_facade_test.cc",
|
|
"counting_semaphore_facade_test_c.c",
|
|
]
|
|
deps = [
|
|
":counting_semaphore",
|
|
"$dir_pw_preprocessor",
|
|
pw_sync_COUNTING_SEMAPHORE_BACKEND,
|
|
]
|
|
}
|
|
|
|
pw_test("mutex_facade_test") {
|
|
enable_if = pw_sync_MUTEX_BACKEND != ""
|
|
sources = [
|
|
"mutex_facade_test.cc",
|
|
"mutex_facade_test_c.c",
|
|
]
|
|
deps = [
|
|
":mutex",
|
|
"$dir_pw_preprocessor",
|
|
pw_sync_MUTEX_BACKEND,
|
|
]
|
|
}
|
|
|
|
pw_test("timed_mutex_facade_test") {
|
|
enable_if = pw_sync_TIMED_MUTEX_BACKEND != ""
|
|
sources = [
|
|
"timed_mutex_facade_test.cc",
|
|
"timed_mutex_facade_test_c.c",
|
|
]
|
|
deps = [
|
|
":timed_mutex",
|
|
"$dir_pw_preprocessor",
|
|
pw_sync_TIMED_MUTEX_BACKEND,
|
|
]
|
|
}
|
|
|
|
pw_test("interrupt_spin_lock_facade_test") {
|
|
enable_if = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND != ""
|
|
sources = [
|
|
"interrupt_spin_lock_facade_test.cc",
|
|
"interrupt_spin_lock_facade_test_c.c",
|
|
]
|
|
deps = [
|
|
":interrupt_spin_lock",
|
|
"$dir_pw_preprocessor",
|
|
pw_sync_INTERRUPT_SPIN_LOCK_BACKEND,
|
|
]
|
|
}
|
|
|
|
pw_doc_group("docs") {
|
|
sources = [ "docs.rst" ]
|
|
}
|