blob: 3e734f4132414752a660b8230415dcc509c627c1 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/rust/rustc_library.gni")
import("//build/test/test_package.gni")
import("//src/graphics/lib/compute/gn/build_settings.gni")
# Raw Spinel Rust bindings that offer little more than just access to Spinel's
# C types.
rustc_library("spinel-rs-sys") {
name = "spinel-rs-sys"
with_unit_tests = true
version = "0.1.0"
edition = "2018"
deps = [
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:vk-sys",
]
non_rust_deps = [
# We want to depend on the Spinel headers to trigger the hash check.
"//src/graphics/lib/compute/spinel:spinel_headers",
]
sources = [ "src/lib.rs" ]
}
group("tests") {
testonly = true
deps = [
":spinel-rs-sys-tests",
":spinel_c_api_header_hashes",
]
}
# Check whether Spinel header files have changed. If so, the
# spinel.c-api files needs to be updated:
#
# $ ../scripts/hash_dir.py \
# --header_paths ../spinel/include/spinel/* \
# --header_dir ../spinel/include \
# > spinel.c-api
#
# This change will then need to be approved by one of the OWNERS in
# of this library.
action("spinel_c_api_header_hashes") {
script = "${graphics_compute_dir}/scripts/hash_dir.py"
header_path = "${graphics_compute_dir}/spinel/include"
sources = [ "spinel.c-api" ]
inputs = [
"${header_path}/spinel/spinel.h",
"${header_path}/spinel/spinel_assert.h",
"${header_path}/spinel/spinel_opcodes.h",
"${header_path}/spinel/spinel_result.h",
"${header_path}/spinel/spinel_types.h",
"${header_path}/spinel/spinel_vk.h",
"${header_path}/spinel/spinel_vk_types.h",
]
stamp = "$target_gen_dir/$target_name.stamp"
outputs = [ stamp ]
args = [ "--header_paths" ] + rebase_path(inputs, root_build_dir) + [
"--header_dir",
rebase_path(header_path, root_build_dir),
"--compare",
rebase_path("spinel.c-api", root_build_dir),
"--stamp",
rebase_path(stamp, root_build_dir),
]
}
unittest_package("spinel-rs-sys-tests") {
deps = [ ":spinel-rs-sys_test" ]
tests = [
{
name = "spinel_rs_sys_lib_test"
},
]
}