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 sources = invoker.sources 16 if (defined(invoker.configs)) { 17 configs = invoker.configs 18 } 19 if (defined(invoker.cflags)) { 20 cflags = invoker.cflags 21 } 22 if (defined(invoker.include_dirs)) { 23 include_dirs = invoker.include_dirs 24 } 25 if (defined(invoker.deps)) { 26 deps = invoker.deps 27 } 28 if (defined(invoker.cflags_cc)) { 29 cflags_cc = invoker.cflags_cc 30 } 31 if (defined(invoker.ldflags)) { 32 ldflags = invoker.ldflags 33 } 34 if (defined(invoker.public_deps)) { 35 public_deps = invoker.public_deps 36 } 37 if (defined(invoker.public_configs)) { 38 public_configs = invoker.public_configs 39 } 40 } 41} 42template("ohos_shared_library") { 43 shared_library(target_name) { 44 sources = invoker.sources 45 if (defined(invoker.configs)) { 46 configs = invoker.configs 47 } 48 public_configs = invoker.public_configs 49 if (defined(invoker.defines)) { 50 defines = invoker.defines 51 } 52 if (defined(invoker.cflags)) { 53 cflags = invoker.cflags 54 } 55 if (defined(invoker.include_dirs)) { 56 include_dirs = invoker.include_dirs 57 } 58 if (defined(invoker.cflags_cc)) { 59 cflags_cc = invoker.cflags_cc 60 } 61 if (defined(invoker.deps)) { 62 deps = invoker.deps 63 } 64 } 65} 66template("ohos_static_library") { 67 static_library(target_name) { 68 sources = invoker.sources 69 if (defined(invoker.configs)) { 70 configs = invoker.configs 71 } 72 public_configs = invoker.public_configs 73 if (defined(invoker.defines)) { 74 defines = invoker.defines 75 } 76 if (defined(invoker.cflags)) { 77 cflags = invoker.cflags 78 } 79 if (defined(invoker.include_dirs)) { 80 include_dirs = invoker.include_dirs 81 } 82 if (defined(invoker.cflags_cc)) { 83 cflags_cc = invoker.cflags_cc 84 } 85 if (defined(invoker.deps)) { 86 deps = invoker.deps 87 } 88 } 89} 90template("ohos_executable") { 91 executable(target_name) { 92 if (defined(invoker.include_dirs)) { 93 include_dirs = invoker.include_dirs 94 } 95 sources = invoker.sources 96 if (defined(invoker.defines)) { 97 defines = invoker.defines 98 } 99 if (defined(invoker.cflags)) { 100 cflags = invoker.cflags 101 } 102 if (defined(invoker.deps)) { 103 deps = invoker.deps 104 } 105 if (defined(invoker.cflags_cc)) { 106 cflags_cc = invoker.cflags_cc 107 } 108 if (defined(invoker.output_name)) { 109 output_name = invoker.output_name 110 } 111 if (defined(invoker.testonly)) { 112 testonly = invoker.testonly 113 } 114 if (defined(invoker.ohos_test)) { 115 ohos_test = invoker.ohos_test 116 } 117 } 118} 119