# Copyright (c) 2021 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("//build/config/arm.gni") import("//build/ohos.gni") import("./lzma.gni") config("lzma_config_common") { include_dirs = [ "C" ] cflags = [ "-D_7ZIP_ST", "-Wall", "-Werror", "-Wno-empty-body", "-Wno-enum-conversion", "-Wno-logical-op-parentheses", "-Wno-self-assign", ] visibility = [ ":*" ] } config("lzma_config_host") { defines = [] defines += [ "target_cpu=${target_cpu}" ] defines += [ "host_toolchain=${host_toolchain}" ] defines += [ "current_toolchain=${current_toolchain}" ] defines += [ "default_toolchain=${default_toolchain}" ] } # on device ohos_source_set("lzma_source_arm") { configs = [ ":lzma_config_common" ] public_configs = [ ":lzma_config_common" ] include_dirs = [ "Asm/arm" ] cflags = [ "-march=armv7-a" ] sources = common_c_source } ohos_source_set("lzma_source_riscv64") { configs = [ ":lzma_config_common" ] public_configs = [ ":lzma_config_common" ] cflags = [ "-march=rv64gc" ] sources = common_c_source } # on device ohos_source_set("lzma_source_arm64") { configs = [ ":lzma_config_common" ] public_configs = [ ":lzma_config_common" ] include_dirs = [ "Asm/arm64" ] cflags = [ "-march=armv8-a+crc" ] sources = common_c_source sources += arm64_asm_source } # on host ohos_source_set("lzma_source_x86_host") { configs = [ ":lzma_config_common", ":lzma_config_host", ] public_configs = [ ":lzma_config_common", ":lzma_config_host", ] include_dirs = [ "Asm/x86" ] sources = common_c_source } #on host ohos_source_set("lzma_source_arm64_host") { configs = [ ":lzma_config_common", ":lzma_config_host", ] public_configs = [ ":lzma_config_common", ":lzma_config_host", ] include_dirs = [ "Asm/arm64" ] sources = common_c_source sources += arm64_asm_source } #on host ohos_source_set("lzma_source_riscv64_host") { configs = [ ":lzma_config_common", ":lzma_config_host", ] public_configs = [ ":lzma_config_common", ":lzma_config_host", ] sources = common_c_source } # on device ohos_shared_library("lzma_shared") { public_configs = [ ":lzma_config_common" ] if (target_cpu == "arm") { deps = [ ":lzma_source_arm" ] } else if (target_cpu == "arm64") { deps = [ ":lzma_source_arm64" ] } else if (target_cpu == "riscv64") { deps = [ ":lzma_source_riscv64" ] } innerapi_tags = [ "chipsetsdk_indirect", "platformsdk_indirect", ] output_name = "lzma" install_images = [ "system", "updater", ] part_name = "lzma" subsystem_name = "thirdparty" } #on host ohos_static_library("lzma_static") { public_configs = [ ":lzma_config_common", ":lzma_config_host", ] if (current_cpu == "arm64") { deps = [ ":lzma_source_arm64_host" ] } else if (current_cpu == "x86_64" || current_cpu == "x64") { deps = [ ":lzma_source_x86_host" ] } else if (current_cpu == "riscv64") { deps = [ ":lzma_source_riscv64_host" ] } part_name = "lzma" subsystem_name = "thirdparty" } group("lzma") { deps = [ ":lzma_shared", ":lzma_static", ] }