diff options
author | Wyatt Hepler <hepler@google.com> | 2022-02-14 09:11:27 -0800 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-02-16 01:37:30 +0000 |
commit | a91c08531487eaea8ef6da4cb745eb7eefae568d (patch) | |
tree | 82e89ff685c25412960d4edc78472a59b7cecd7f /pw_thread_freertos | |
parent | 67e1d804d72ad73a7eb04dbe78cd1b6c41f23038 (diff) | |
download | pigweed-a91c08531487eaea8ef6da4cb745eb7eefae568d.tar.gz |
pw_build: pw_build_assert template
Template for build-time asserts. These asserts are only evaluated if
they're depended on by another target. If they pass, nothing happens. If
they fail, they act like a pw_error.
Change-Id: Ic502966c7a9693abf6d8a89b0cb833e10c6acbbc
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/84360
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
Diffstat (limited to 'pw_thread_freertos')
-rw-r--r-- | pw_thread_freertos/BUILD.gn | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/pw_thread_freertos/BUILD.gn b/pw_thread_freertos/BUILD.gn index 01d0a1783..c1027cc66 100644 --- a/pw_thread_freertos/BUILD.gn +++ b/pw_thread_freertos/BUILD.gn @@ -14,6 +14,7 @@ import("//build_overrides/pigweed.gni") +import("$dir_pw_build/error.gni") import("$dir_pw_build/facade.gni") import("$dir_pw_build/module_config.gni") import("$dir_pw_build/target_types.gni") @@ -69,6 +70,17 @@ pw_source_set("id") { deps = [ "$dir_pw_thread:id.facade" ] } +pw_build_assert("check_system_clock_backend") { + condition = + pw_chrono_SYSTEM_CLOCK_BACKEND == "" || + pw_chrono_SYSTEM_CLOCK_BACKEND == "$dir_pw_chrono_freertos:system_clock" + message = "This FreeRTOS backend only works with the FreeRTOS " + + "pw::chrono::SystemClock backend " + + "(pw_chrono_SYSTEM_CLOCK_BACKEND = " + + "\"$dir_pw_chrono_freertos:system_clock\")" + visibility = [ ":*" ] +} + # This target provides the backend for pw::this_thread::sleep_{for,until}. pw_source_set("sleep") { public_configs = [ @@ -82,19 +94,13 @@ pw_source_set("sleep") { public_deps = [ "$dir_pw_chrono:system_clock" ] sources = [ "sleep.cc" ] deps = [ + ":check_system_clock_backend", "$dir_pw_assert", "$dir_pw_chrono_freertos:system_clock", "$dir_pw_third_party/freertos", "$dir_pw_thread:id", "$dir_pw_thread:sleep.facade", ] - assert(pw_chrono_SYSTEM_CLOCK_BACKEND == "" || - pw_chrono_SYSTEM_CLOCK_BACKEND == - "$dir_pw_chrono_freertos:system_clock", - "The FreeRTOS pw::this_thread::sleep_{for,until} backend only works " + - "with the FreeRTOS pw::chrono::SystemClock backend " + - "(pw_chrono_SYSTEM_CLOCK_BACKEND = " + - "\"$dir_pw_chrono_freertos:system_clock\")") } # This target provides the backend for pw::thread::Thread and the headers needed |