• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021 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.
13template("ohos_source_set") {
14  source_set(target_name) {
15    if (defined(invoker.subsystem_name)) {
16      subsystem_name = invoker.subsystem_name
17      print("subsystem_name", subsystem_name)
18    }
19    if (defined(invoker.part_name)) {
20      part_name = invoker.part_name
21      print("part_name", part_name)
22    }
23    if (defined(invoker.sources)) {
24      sources = invoker.sources
25    }
26    if (defined(invoker.configs)) {
27      configs = invoker.configs
28    }
29    if (defined(invoker.cflags)) {
30      cflags = invoker.cflags
31    }
32    if (defined(invoker.include_dirs)) {
33      include_dirs = invoker.include_dirs
34    }
35    if (defined(invoker.deps)) {
36      deps = invoker.deps
37    }
38    if (defined(invoker.cflags_cc)) {
39      cflags_cc = invoker.cflags_cc
40    }
41    if (defined(invoker.ldflags)) {
42      ldflags = invoker.ldflags
43    }
44    if (defined(invoker.public_deps)) {
45      public_deps = invoker.public_deps
46    }
47    if (defined(invoker.public_configs)) {
48      public_configs = invoker.public_configs
49    }
50  }
51}
52template("ohos_shared_library") {
53  part_name = invoker.part_name
54  subsystem_name = invoker.subsystem_name
55  shared_library(target_name) {
56    sources = invoker.sources
57    if (defined(invoker.configs)) {
58      configs = invoker.configs
59    }
60    public_configs = invoker.public_configs
61    if (defined(invoker.defines)) {
62      defines = invoker.defines
63    }
64    if (defined(invoker.cflags)) {
65      cflags = invoker.cflags
66    }
67    if (defined(invoker.include_dirs)) {
68      include_dirs = invoker.include_dirs
69    }
70    if (defined(invoker.cflags_cc)) {
71      cflags_cc = invoker.cflags_cc
72    }
73    if (defined(invoker.deps)) {
74      deps = invoker.deps
75    }
76  }
77}
78template("ohos_static_library") {
79  if (defined(invoker.subsystem_name)) {
80    subsystem_name = invoker.subsystem_name
81    print("subsystem_name", subsystem_name)
82  }
83  if (defined(invoker.part_name)) {
84    part_name = invoker.part_name
85    print("part_name", part_name)
86  }
87  static_library(target_name) {
88    sources = invoker.sources
89    if (defined(invoker.configs)) {
90      configs = invoker.configs
91    }
92    public_configs = invoker.public_configs
93    if (defined(invoker.defines)) {
94      defines = invoker.defines
95    }
96    if (defined(invoker.cflags)) {
97      cflags = invoker.cflags
98    }
99    if (defined(invoker.include_dirs)) {
100      include_dirs = invoker.include_dirs
101    }
102    if (defined(invoker.cflags_cc)) {
103      cflags_cc = invoker.cflags_cc
104    }
105    if (defined(invoker.deps)) {
106      deps = invoker.deps
107    }
108  }
109}
110template("ohos_executable") {
111  if (defined(invoker.subsystem_name)) {
112    subsystem_name = invoker.subsystem_name
113    print("subsystem_name", subsystem_name)
114  }
115  if (defined(invoker.part_name)) {
116    part_name = invoker.part_name
117    print("part_name", part_name)
118  }
119  executable(target_name) {
120    if (defined(invoker.include_dirs)) {
121      include_dirs = invoker.include_dirs
122    }
123    sources = invoker.sources
124    if (defined(invoker.defines)) {
125      defines = invoker.defines
126    }
127    if (defined(invoker.cflags)) {
128      cflags = invoker.cflags
129    }
130    if (defined(invoker.deps)) {
131      deps = invoker.deps
132    }
133    if (defined(invoker.cflags_cc)) {
134      cflags_cc = invoker.cflags_cc
135    }
136    if (defined(invoker.output_name)) {
137      output_name = invoker.output_name
138    }
139    if (defined(invoker.testonly)) {
140      testonly = invoker.testonly
141    }
142    if (defined(invoker.ohos_test)) {
143      ohos_test = invoker.ohos_test
144    }
145  }
146}
147