naiveproxy/third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni

99 lines
2.9 KiB
Plaintext
Raw Normal View History

2018-12-10 05:59:24 +03:00
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
assert(is_fuchsia)
import("//build/config/fuchsia/fidl_library.gni")
# Templates for Fuchsia SDK packages.
# Declares a package specifying FIDL files and its dependencies.
#
# Parameters:
# package_name - Name of the library. target_name is used if name
# is not specified explicitly.
# namespace, namespace_path - FIDL namespace. See fidl_library.gni
# for details.
# sources - List of sources relative to sdk/fidl/${name}.
# deps - List of dependencies.
template("fuchsia_sdk_fidl_pkg") {
_package_name = target_name
if (defined(invoker.package_name)) {
_package_name = invoker.package_name
}
fidl_library(target_name) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"testonly",
"visibility",
])
library_name = _package_name
if (defined(invoker.namespace)) {
assert(defined(invoker.namespace_path),
"SDK packages with namespace must specify namespace_path")
namespace = invoker.namespace
namespace_path = invoker.namespace_path
_library_name = "${namespace}.${_package_name}"
} else {
_library_name = _package_name
}
sources = []
foreach(file, invoker.sources) {
sources += [ "sdk/fidl/${_library_name}/${file}" ]
}
}
}
# Declares a package containing uncompiled code and/or precompiled libraries.
#
# Parameters:
# package_name - Name of the library. target_name is used if name
# is not specified explicitly.
# sources - List of sources relative to sdk/pkg/${name}.
# deps - List of dependencies.
# libs - List of precompiled libraries.
template("fuchsia_sdk_pkg") {
_package_name = target_name
if (defined(invoker.package_name)) {
_package_name = invoker.package_name
}
config("${target_name}_config") {
visibility = [ ":${invoker.target_name}" ]
include_dirs = [ "sdk/pkg/${_package_name}/include" ]
}
static_library(target_name) {
forward_variables_from(invoker,
[
"data",
"deps",
"public_deps",
"testonly",
"visibility",
])
sources = []
if (defined(invoker.sources)) {
foreach(src, invoker.sources) {
sources += [ "sdk/pkg/${_package_name}/${src}" ]
}
}
public_configs = [ ":${invoker.target_name}_config" ]
if (defined(invoker.libs)) {
configs += [ ":sdk_lib_dirs_config" ]
libs = invoker.libs
}
}
}