xref: /arkcompiler/runtime_core/gn/build/ohos.gni (revision b1994897)
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14template("ohos_executable") {
15  executable("${target_name}") {
16    forward_variables_from(invoker,
17                           "*",
18                           [
19                             "configs",
20                             "remove_configs",
21                             "relative_install_dir",
22                             "subsystem_name",
23                             "install_enable",
24                           ])
25    if (defined(invoker.configs)) {
26      configs += invoker.configs
27    }
28
29    if (defined(invoker.remove_configs)) {
30      configs -= invoker.remove_configs
31    }
32  }
33}
34
35template("ohos_shared_library") {
36  shared_library("${target_name}") {
37    forward_variables_from(invoker,
38                           "*",
39                           [
40                             "configs",
41                             "remove_configs",
42                             "relative_install_dir",
43                             "subsystem_name",
44                             "install_enable",
45                             "part_name",
46                           ])
47
48    if (defined(invoker.configs)) {
49      configs += invoker.configs
50    }
51
52    if (defined(invoker.remove_configs)) {
53      configs -= invoker.remove_configs
54    }
55  }
56}
57
58template("ohos_static_library") {
59  static_library("${target_name}") {
60    forward_variables_from(invoker,
61                           "*",
62                           [
63                             "configs",
64                             "remove_configs",
65                             "relative_install_dir",
66                             "subsystem_name",
67                             "install_enable",
68                           ])
69
70    if (defined(invoker.configs)) {
71      configs += invoker.configs
72    }
73
74    if (defined(invoker.remove_configs)) {
75      configs -= invoker.remove_configs
76    }
77  }
78}
79
80template("ohos_prebuilt_etc") {
81  copy("${target_name}") {
82    forward_variables_from(invoker,
83                           "*",
84                           [
85                             "subsystem_name",
86                             "install_enable",
87                             "source",
88                             "module_install_dir",
89                             "part_name",
90                           ])
91    sources = [ invoker.source ]
92    outputs = [ "${target_out_dir}/${invoker.source}" ]
93  }
94}
95