1# 2# Copyright (c) 2020 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# 15if (defined(ohos_lite)) { 16 import("//build/lite/config/component/lite_component.gni") 17} else { 18 import("//build/ohos.gni") 19} 20import("libsec_src.gni") 21 22config("libsec_public_config") { 23 include_dirs = [ "include" ] 24} 25 26if (defined(ohos_lite)) { 27 # When the kernel is liteos_m, use //kernel/liteos_m/kal/libsec/BUILD.gn to compile. 28 if (current_toolchain == "//build/toolchain/linux:clang_x64" || 29 ohos_kernel_type != "liteos_m") { 30 lite_library("libsec_static") { 31 target_type = "static_library" 32 sources = libsec_sources 33 public_configs = [ ":libsec_public_config" ] 34 } 35 } else if (ohos_kernel_type == "liteos_m") { 36 group("libsec_static") { 37 } 38 } 39 lite_library("libsec_shared") { 40 target_type = "shared_library" 41 sources = libsec_sources 42 public_configs = [ ":libsec_public_config" ] 43 } 44 group("sec_shared") { 45 deps = [ ":libsec_shared" ] 46 } 47} else { 48 ohos_static_library("libsec_static") { 49 sources = libsec_sources 50 all_dependent_configs = [ ":libsec_public_config" ] 51 cflags = [ 52 "-D_INC_STRING_S", 53 "-D_INC_WCHAR_S", 54 "-D_SECIMP=//", 55 "-D_STDIO_S_DEFINED", 56 "-D_INC_STDIO_S", 57 "-D_INC_STDLIB_S", 58 "-D_INC_MEMORY_S", 59 ] 60 part_name = "bounds_checking_function" 61 subsystem_name = "thirdparty" 62 } 63 ohos_shared_library("libsec_shared") { 64 sources = libsec_sources 65 all_dependent_configs = [ ":libsec_public_config" ] 66 cflags = [ 67 "-D_INC_STRING_S", 68 "-D_INC_WCHAR_S", 69 "-D_SECIMP=//", 70 "-D_STDIO_S_DEFINED", 71 "-D_INC_STDIO_S", 72 "-D_INC_STDLIB_S", 73 "-D_INC_MEMORY_S", 74 ] 75 innerapi_tags = [ 76 "chipsetsdk", 77 "platformsdk", 78 ] 79 part_name = "bounds_checking_function" 80 subsystem_name = "thirdparty" 81 install_images = [ 82 "system", 83 "updater", 84 "ramdisk", 85 ] 86 } 87} 88