# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. template("ohos_executable") { executable(target_name) { forward_variables_from(invoker, "*", [ "configs", "remove_configs", "subsystem_name", "install_enable", "part_name", "use_exceptions", "static_link", "output_dir", ]) if (defined(invoker.subsystem_name) && defined(invoker.part_name)) { subsystem_name = invoker.subsystem_name part_name = invoker.part_name } else if (defined(invoker.subsystem_name)) { subsystem_name = invoker.subsystem_name part_name = subsystem_name } else { subsystem_name = "arkcompiler" part_name = "common" } if (is_standard_system) { output_dir = "${root_out_dir}/${subsystem_name}/${part_name}" } else { output_dir = "${root_out_dir}" } if (defined(invoker.configs)) { configs += invoker.configs } if (defined(invoker.remove_configs)) { configs -= invoker.remove_configs } if (defined(invoker.use_exceptions) && invoker.use_exceptions) { configs += [ "//toolchain/build/config/compiler:exceptions" ] } } } template("ohos_static_library") { static_library(target_name) { forward_variables_from(invoker, "*", [ "configs", "remove_configs", "subsystem_name", "part_name", "use_exceptions", "external_deps", ]) if (defined(invoker.configs)) { configs += invoker.configs } if (defined(invoker.remove_configs)) { configs -= invoker.remove_configs } if (defined(invoker.use_exceptions) && invoker.use_exceptions) { configs += [ "//toolchain/build/config/compiler:exceptions" ] } } } template("ohos_shared_library") { shared_library(target_name) { forward_variables_from(invoker, "*", [ "relative_install_dir", "subsystem_name", "install_enable", "part_name", "install_images", "use_exceptions", "external_deps", ]) if (defined(invoker.subsystem_name) && defined(invoker.part_name)) { subsystem_name = invoker.subsystem_name part_name = invoker.part_name } else if (defined(invoker.subsystem_name)) { subsystem_name = invoker.subsystem_name part_name = subsystem_name } else { subsystem_name = "arkcompiler" part_name = "common" } if (is_standard_system) { output_dir = "${root_out_dir}/${subsystem_name}/${part_name}" } else { output_dir = "${root_out_dir}" } } } template("ohos_copy") { copy(target_name) { forward_variables_from(invoker, "*", [ "module_source_dir", "module_install_name", ]) } } template("ohos_source_set") { source_set(target_name) { forward_variables_from(invoker, "*", [ "configs", "remove_configs", "no_default_deps", "external_deps", "license_file", "license_as_sources", "use_exceptions", ]) } }