| # 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_facade("mutex") { |
| backend = pw_sync_MUTEX_BACKEND |
| public_configs = [ ":public_include_path" ] |
| public = [ "public/pw_sync/mutex.h" ] |
| public_deps = [ |
| "$dir_pw_chrono:system_clock", |
| "$dir_pw_preprocessor", |
| ] |
| sources = [ "mutex.cc" ] |
| } |
| |
| pw_facade("spin_lock") { |
| backend = pw_sync_SPIN_LOCK_BACKEND |
| public_configs = [ ":public_include_path" ] |
| public = [ "public/pw_sync/spin_lock.h" ] |
| public_deps = [ "$dir_pw_preprocessor" ] |
| sources = [ "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", |
| ":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("spin_lock_facade_test") { |
| enable_if = pw_sync_SPIN_LOCK_BACKEND != "" |
| sources = [ |
| "spin_lock_facade_test.cc", |
| "spin_lock_facade_test_c.c", |
| ] |
| deps = [ |
| ":spin_lock", |
| "$dir_pw_preprocessor", |
| pw_sync_SPIN_LOCK_BACKEND, |
| ] |
| } |
| |
| pw_doc_group("docs") { |
| sources = [ "docs.rst" ] |
| } |