1# Copyright 2022 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build/rust/rust_target.gni") 6 7# Rust dylibs should not be built outside of component builds. Non-component 8# builds use build configurations that conflict with the linking of dylibs. 9if (is_component_build) { 10 # Defines a shared_library containing just Rust code. Has the same variables 11 # available as a rust_static_library. See rust_static_library.gni for 12 # documentation. 13 template("rust_shared_library") { 14 rust_target(target_name) { 15 forward_variables_from(invoker, 16 "*", 17 TESTONLY_AND_VISIBILITY + [ "configs" ]) 18 forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) 19 shared_library_configs = invoker.configs 20 target_type = "shared_library" 21 crate_type = "cdylib" 22 } 23 } 24 25 set_defaults("rust_shared_library") { 26 configs = default_shared_library_configs 27 } 28} 29