forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuchsia_sdk_pkg.gni
102 lines (87 loc) · 2.96 KB
/
fuchsia_sdk_pkg.gni
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# 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")
import("//build/toolchain/toolchain.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 - FIDL namespace.
# 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)) {
namespace = invoker.namespace
}
sources = invoker.sources
}
}
# 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.
# shared_libs - List of precompiled shared libraries.
# static_libs - List of precompiled static libraries.
template("fuchsia_sdk_pkg") {
config("${target_name}_config") {
forward_variables_from(invoker, [ "include_dirs" ])
visibility = [ ":${invoker.target_name}" ]
}
if (defined(invoker.shared_libs)) {
if (defined(invoker.sdk_dist_dir)) {
sdk_dist_dir = invoker.sdk_dist_dir
} else {
sdk_dist_dir = "arch/${target_cpu}/dist"
}
copy("${target_name}_dist_libs") {
sources = []
foreach(lib, invoker.shared_libs) {
sources += [ "${sdk_dist_dir}/lib${lib}.so" ]
}
outputs = [
"${root_out_dir}${shlib_subdir}/{{source_file_part}}",
]
}
}
static_library(target_name) {
forward_variables_from(invoker,
[
"data",
"deps",
"public_deps",
"sources",
"testonly",
"visibility",
])
public_configs = [ ":${invoker.target_name}_config" ]
if (defined(invoker.shared_libs)) {
configs += [ "//third_party/fuchsia-sdk:sdk_lib_dirs_config" ]
libs = invoker.shared_libs
data_deps = [
":${target_name}_dist_libs",
]
} else if (defined(invoker.static_libs)) {
libs = invoker.static_libs
}
}
}