blob: 7c734f71dd65fa597507dba117fd23bc6e4706b8 [file] [log] [blame]
# Copyright 2020 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/components.gni")
import("//build/rust/rustc_library.gni")
rustc_library("surpass") {
name = "surpass"
with_unit_tests = true
version = "0.1.0"
edition = "2021"
deps = [
"//third_party/rust_crates:crossbeam-utils",
"//third_party/rust_crates:rayon",
"//third_party/rust_crates:rustc-hash",
]
if (target_cpu == "x64" || target_cpu == "arm64") {
deps += [ "//third_party/rust_crates:zerocopy_0_0_0_alpha_0" ]
}
# TODO(https://fxbug.dev/42175080): Fix the leaks and remove this.
test_deps = [
"//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS",
"//third_party/rust_crates:half",
]
configs += [ ":surpass-performance" ]
sources = [
"src/affine_transform.rs",
"src/extend.rs",
"src/layer.rs",
"src/layout/mod.rs",
"src/layout/slice_cache.rs",
"src/lib.rs",
"src/lines.rs",
"src/order.rs",
"src/painter/layer_workbench/mod.rs",
"src/painter/layer_workbench/passes/mod.rs",
"src/painter/layer_workbench/passes/skip_fully_covered_layers.rs",
"src/painter/layer_workbench/passes/skip_trivial_clips.rs",
"src/painter/layer_workbench/passes/tile_unchanged.rs",
"src/painter/mod.rs",
"src/painter/style.rs",
"src/path.rs",
"src/point.rs",
"src/rasterizer/grouped_iter.rs",
"src/rasterizer/mod.rs",
"src/rasterizer/pixel_segment.rs",
"src/simd/aarch64.rs",
"src/simd/auto.rs",
"src/simd/avx.rs",
"src/simd/mod.rs",
"src/transform.rs",
]
}
config("surpass-performance") {
# Enable all optimizations that benefit speed, even if they increase size
configs = [ "//build/config:optimize_speed" ]
if (target_cpu == "x64") {
# TODO(https://fxbug.dev/42168719): not all x64 targets are haswell.
# Consider moving this to a board config.
configs += [ "//build/config/x64:haswell" ]
}
if (target_cpu == "arm64") {
# TODO(https://fxbug.dev/42168343): the flag below is not added by default.
# It's safe to remove the line below when //build/config/arm64:cortex-a53
# picks up this flag.
# Also note that not all arm64 targets are cortex-a53.
# Depending on your target board this optimization flag may actually
# cause a regression.
rustflags = [ "-Ctarget-cpu=cortex-a53" ]
}
}
fuchsia_unittest_package("surpass-tests") {
deps = [ ":surpass_test" ]
}