blob: 3fb3b1a57bbe4b73eacb6bf1e128f4494bcbfa3e [file]
# Copyright 2026 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.
load("@pigweed//pw_build:compatibility.bzl", "incompatible_with_mcu")
load("@rules_rust//rust:defs.bzl", "rust_library")
load("@zephyr//:cc.bzl", "zephyr_cc_library")
package(default_visibility = ["//visibility:public"])
rust_library(
name = "pw_thread",
srcs = [
"pw_thread.rs",
],
crate_name = "pw_thread",
edition = "2021",
deps = [
":pw_thread_backend",
"//pw_time/rust:pw_time",
],
)
label_flag(
name = "pw_thread_backend",
build_setting_default = ":pw_thread_backend_std",
)
rust_library(
name = "pw_thread_backend_std",
srcs = [
"pw_thread_backend_std.rs",
],
crate_name = "pw_thread_backend",
edition = "2021",
target_compatible_with = incompatible_with_mcu(),
deps = [
"//pw_time/rust:pw_time",
],
)
rust_library(
name = "pw_thread_backend_freertos",
srcs = [
"pw_thread_backend_freertos.rs",
],
crate_name = "pw_thread_backend",
edition = "2021",
target_compatible_with = ["//pw_build/constraints/rtos:freertos"],
deps = [
"//pw_assert/rust:pw_assert",
"//pw_time/rust:pw_time",
"//third_party/freertos/freertos_sys",
],
)
rust_library(
name = "pw_thread_backend_pigweed",
srcs = [
"pw_thread_backend_pigweed.rs",
],
aliases = {
"//pw_kernel/target:target_arch": "target_arch",
},
crate_name = "pw_thread_backend",
edition = "2021",
target_compatible_with = ["//pw_build/constraints/rtos:pigweed"],
deps = [
"//pw_kernel/kernel",
"//pw_kernel/target:target_arch",
"//pw_time/rust:pw_time",
],
)
rust_library(
name = "pw_thread_backend_zephyr",
srcs = [
"pw_thread_backend_zephyr.rs",
],
crate_name = "pw_thread_backend",
edition = "2021",
deps = [
":pw_thread_backend_zephyr_helper",
"//pw_assert/rust:pw_assert",
"//pw_time/rust:pw_time",
],
)
zephyr_cc_library(
name = "pw_thread_backend_zephyr_helper",
srcs = ["pw_thread_backend_zephyr_helper.cc"],
)