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 (ohos_kernel_type == "liteos_m") { 29 group("libsec_static") { 30 } 31 } else { 32 lite_library("libsec_static") { 33 target_type = "static_library" 34 sources = libsec_sources 35 public_configs = [ ":libsec_public_config" ] 36 } 37 } 38 lite_library("libsec_shared") { 39 target_type = "shared_library" 40 sources = libsec_sources 41 public_configs = [ ":libsec_public_config" ] 42 } 43 group("sec_shared") { 44 deps = [ ":libsec_shared" ] 45 } 46} else { 47 ohos_static_library("libsec_static") { 48 sources = libsec_sources 49 all_dependent_configs = [ ":libsec_public_config" ] 50 cflags = [ 51 "-D_INC_STRING_S", 52 "-D_INC_WCHAR_S", 53 "-D_SECIMP=//", 54 "-D_STDIO_S_DEFINED", 55 "-D_INC_STDIO_S", 56 "-D_INC_STDLIB_S", 57 "-D_INC_MEMORY_S", 58 ] 59 part_name = "bounds_checking_function" 60 subsystem_name = "thirdparty" 61 } 62 ohos_shared_library("libsec_shared") { 63 sources = libsec_sources 64 all_dependent_configs = [ ":libsec_public_config" ] 65 cflags = [ 66 "-D_INC_STRING_S", 67 "-D_INC_WCHAR_S", 68 "-D_SECIMP=//", 69 "-D_STDIO_S_DEFINED", 70 "-D_INC_STDIO_S", 71 "-D_INC_STDLIB_S", 72 "-D_INC_MEMORY_S", 73 ] 74 part_name = "bounds_checking_function" 75 subsystem_name = "thirdparty" 76 install_images = [ 77 "system", 78 "updater", 79 ] 80 } 81} 82