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