# # Copyright (c) 2020-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. # import("//base/startup/init/begetd.gni") import("//build/lite/config/component/lite_component.gni") import("//build/lite/ndk/ndk.gni") if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { shared_library("token_shared") { include_dirs = [ "//base/startup/init/interfaces/innerkits/include", "//base/startup/init/interfaces/innerkits/include/token", "//commonlibrary/utils_lite/include", "//base/startup/init/interfaces/innerkits/token", ] sources = [ "src/token_impl_posix/token.c" ] public_deps = [ "$ohos_product_adapter_dir/utils/token:haltoken_shared", "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", ] } } if (ohos_kernel_type == "liteos_m") { static_library("token_static") { sources = [ "src/token_impl_hal/token.c" ] include_dirs = [ "//base/startup/init/interfaces/innerkits/include", "//base/startup/init/interfaces/innerkits/include/token", "//commonlibrary/utils_lite/include", "//base/startup/init/interfaces/innerkits/token", "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite", ] PRODUCT_HAL_TOKEN_PATH = rebase_path("${ohos_product_adapter_dir}/utils/token") cmd = "if [ -f ${PRODUCT_HAL_TOKEN_PATH}/BUILD.gn ]; then echo true; else echo false; fi" PRODUCT_HAL_TOKEN_EXISTS = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") if (PRODUCT_HAL_TOKEN_EXISTS) { deps += [ "$ohos_product_adapter_dir/utils/token:hal_token_static" ] } deps += [ "//base/startup/init/interfaces/hals/utils/token:static_hal_token" ] } } lite_component("token") { features = [] if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { features += [ ":token_shared" ] } if (ohos_kernel_type == "liteos_m") { features += [ ":token_static" ] } } ndk_lib("token_notes") { deps = [] head_files = [] if (ohos_kernel_type != "liteos_m") { lib_extension = ".so" } if (ohos_kernel_type != "liteos_m") { deps += [ "//base/startup/init/interfaces/innerkits/token:token_shared" ] } head_files += [ "//base/startup/init/interfaces/include/token" ] }