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. 13import("//build/config/arm.gni") 14import("//build/ohos.gni") 15import("./lzma.gni") 16 17config("lzma_config_common") { 18 include_dirs = [ "C" ] 19 cflags = [ 20 "-DZ7_AFFINITY_DISABLE", 21 "-Wall", 22 "-Werror", 23 "-Wno-empty-body", 24 "-Wno-enum-conversion", 25 "-Wno-logical-op-parentheses", 26 "-Wno-self-assign", 27 "-Wno-implicit-function-declaration", 28 ] 29 visibility = [ ":*" ] 30} 31 32config("lzma_config_host") { 33 defines = [] 34 defines += [ "target_cpu=${target_cpu}" ] 35 defines += [ "host_toolchain=${host_toolchain}" ] 36 defines += [ "current_toolchain=${current_toolchain}" ] 37 defines += [ "default_toolchain=${default_toolchain}" ] 38} 39 40# on device 41ohos_source_set("lzma_source_arm") { 42 configs = [ ":lzma_config_common" ] 43 public_configs = [ ":lzma_config_common" ] 44 45 include_dirs = [ "Asm/arm" ] 46 cflags = [ "-march=armv7-a" ] 47 ldflags = [ "-lpthread" ] 48 49 sources = common_c_source 50} 51ohos_source_set("lzma_source_riscv64") { 52 configs = [ ":lzma_config_common" ] 53 public_configs = [ ":lzma_config_common" ] 54 cflags = [ "-march=rv64gc" ] 55 sources = common_c_source 56} 57 58# on device 59ohos_source_set("lzma_source_arm64") { 60 branch_protector_ret = "pac_ret" 61 configs = [ ":lzma_config_common" ] 62 public_configs = [ ":lzma_config_common" ] 63 64 include_dirs = [ "Asm/arm64" ] 65 cflags = [ "-march=armv8-a+crc" ] 66 67 sources = common_c_source 68 sources += arm64_asm_source 69} 70 71# on host 72ohos_source_set("lzma_source_x86_host") { 73 configs = [ 74 ":lzma_config_common", 75 ":lzma_config_host", 76 ] 77 public_configs = [ 78 ":lzma_config_common", 79 ":lzma_config_host", 80 ] 81 82 include_dirs = [ "Asm/x86" ] 83 84 sources = common_c_source 85} 86 87#on host 88ohos_source_set("lzma_source_arm64_host") { 89 configs = [ 90 ":lzma_config_common", 91 ":lzma_config_host", 92 ] 93 public_configs = [ 94 ":lzma_config_common", 95 ":lzma_config_host", 96 ] 97 98 include_dirs = [ "Asm/arm64" ] 99 100 sources = common_c_source 101 sources += arm64_asm_source 102} 103 104#on host 105ohos_source_set("lzma_source_riscv64_host") { 106 configs = [ 107 ":lzma_config_common", 108 ":lzma_config_host", 109 ] 110 public_configs = [ 111 ":lzma_config_common", 112 ":lzma_config_host", 113 ] 114 115 sources = common_c_source 116} 117 118# on device 119ohos_shared_library("lzma_shared") { 120 branch_protector_ret = "pac_ret" 121 public_configs = [ ":lzma_config_common" ] 122 123 if (target_cpu == "arm") { 124 deps = [ ":lzma_source_arm" ] 125 } else if (target_cpu == "arm64") { 126 deps = [ ":lzma_source_arm64" ] 127 } else if (target_cpu == "riscv64") { 128 deps = [ ":lzma_source_riscv64" ] 129 } 130 innerapi_tags = [ 131 "chipsetsdk_sp_indirect", 132 "platformsdk_indirect", 133 ] 134 output_name = "lzma" 135 install_images = [ 136 "system", 137 "updater", 138 ] 139 part_name = "lzma" 140 subsystem_name = "thirdparty" 141} 142 143#on host 144ohos_static_library("lzma_static") { 145 public_configs = [ 146 ":lzma_config_common", 147 ":lzma_config_host", 148 ] 149 150 if (current_cpu == "arm64") { 151 deps = [ ":lzma_source_arm64_host" ] 152 } else if (current_cpu == "x86_64" || current_cpu == "x64") { 153 deps = [ ":lzma_source_x86_host" ] 154 } else if (current_cpu == "riscv64") { 155 deps = [ ":lzma_source_riscv64_host" ] 156 } 157 158 part_name = "lzma" 159 subsystem_name = "thirdparty" 160} 161 162group("lzma") { 163 deps = [ 164 ":lzma_shared", 165 ":lzma_static", 166 ] 167} 168