# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/arm.gni") # TODO(richard.townsend@arm.com): Optimizations temporarily disabled for # Windows on Arm MSVC builds, see http://crbug.com/v8/10012. use_arm_neon_optimizations = (target_cpu == "arm" || target_cpu == "arm64") && arm_use_neon && !(is_win && !is_clang) config("lzma_sdk_config") { include_dirs = [ ".", "./C", ] } # Must be in a config for -Wno-self-assign because of how GN orders flags # (otherwise -Wall will appear after this, and turn it back on). config("lzma_build_config") { defines = [ "_7ZIP_ST", "_7Z_NO_METHODS_FILTERS", "_LZMA_PROB32", ] cflags = [] if (is_clang) { # Upstream uses self-assignment to avoid warnings. cflags += [ "-Wno-self-assign" ] } if (use_arm_neon_optimizations) { if (is_fuchsia) { defines += [ "ARMV8_OS_FUCHSIA" ] } if (target_cpu == "arm" && arm_version >= 8) { if (is_clang) { cflags += [ "-march=armv8-a", "-Xclang", "-target-feature", "-Xclang", "+crc", "-Xclang", "-target-feature", "-Xclang", "+crypto", ] } else { cflags += [ "-march=armv8-a+crc+crypto" ] } } } } static_library("lzma_sdk") { sources = [ "C/7z.h", "C/7zAlloc.c", "C/7zAlloc.h", "C/7zArcIn.c", "C/7zBuf.c", "C/7zBuf.h", "C/7zCrc.c", "C/7zCrc.h", "C/7zCrcOpt.c", "C/7zDec.c", "C/7zFile.c", "C/7zFile.h", "C/7zStream.c", "C/7zTypes.h", "C/Alloc.c", "C/Alloc.h", "C/Bcj2.c", "C/Bcj2.h", "C/Bra.c", "C/Bra.h", "C/Bra86.c", "C/Compiler.h", "C/CpuArch.c", "C/CpuArch.h", "C/Delta.c", "C/Delta.h", "C/DllSecur.c", "C/DllSecur.h", "C/LzFind.c", "C/LzFind.h", "C/LzHash.h", "C/Lzma2Dec.c", "C/Lzma2Dec.h", "C/LzmaDec.c", "C/LzmaDec.h", "C/LzmaEnc.c", "C/LzmaEnc.h", "C/LzmaLib.c", "C/LzmaLib.h", "C/Precomp.h", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", # Must be after no_chromium_code for warning flags to be ordered correctly. ":lzma_build_config", ] public_configs = [ ":lzma_sdk_config" ] } static_library("lzma_sdk_xz") { sources = [ "C/BraIA64.c", "C/RotateDefs.h", "C/Sha256.c", "C/Sha256.h", "C/Xz.c", "C/Xz.h", "C/XzCrc64.c", "C/XzCrc64.h", "C/XzCrc64Opt.c", "C/XzDec.c", ] # TODO(crbug.com/1338627): Enable ARM optimizations if (target_cpu == "x86" || target_cpu == "x64") { sources += [ "C/Sha256Opt.c" ] } deps = [ ":lzma_sdk" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", # Must be after no_chromium_code for warning flags to be ordered correctly. ":lzma_build_config", ] public_configs = [ ":lzma_sdk_config" ] }