1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
# Copyright 2014 The Chromium Authors
# 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")
import("//build/config/compiler/compiler.gni")
# TODO(ritownsend@google.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)
# TODO(crbug.com/1341436) For Windows, to assemble lzma_sdk's assembly files,
# ml64.exe needs to be utilized as llvm-ml cannot yet assemble it. Once llvm-ml
# is able to assemble lzma_sdk assembly files, remove this.
# LzmaDecOpt.asm only works on x64 and not x86.
# https://sourceforge.net/p/sevenzip/discussion/45797/thread/768932e9dd/?limit=25#0d6c
# If enable_lzma_opt is enabled, disable_llvm_ml should be enabled as well.
enable_lzma_opt = host_os == "win" && target_cpu == "x64" && !is_msan
if (enable_lzma_opt) {
assert(disable_llvm_ml)
}
config("lzma_sdk_config") {
include_dirs = [
".",
"./C",
]
if (enable_lzma_opt) {
include_dirs += [ "./Asm/x86" ]
}
}
# 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 = [
"Z7_LZMA_PROB32",
"Z7_NO_METHODS_FILTERS",
"Z7_ST",
"_LZMA_PROB32",
]
if (enable_lzma_opt) {
defines += [ "Z7_LZMA_DEC_OPT" ]
}
cflags = []
if (is_clang) {
# Upstream uses self-assignment to avoid warnings.
cflags += [ "-Wno-self-assign" ]
}
if (use_arm_neon_optimizations) {
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/7zWindows.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",
"C/RotateDefs.h",
]
if (enable_lzma_opt) {
sources += [ "Asm/x86/LzmaDecOpt.asm" ]
}
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/Sha256.c",
"C/Sha256.h",
"C/Sha256Opt.c",
"C/Xz.c",
"C/Xz.h",
"C/XzCrc64.c",
"C/XzCrc64.h",
"C/XzCrc64Opt.c",
"C/XzDec.c",
"C/XzIn.c",
]
if (enable_lzma_opt) {
sources += [
"Asm/x86/Sha256Opt.asm",
"Asm/x86/XzCrc64Opt.asm",
]
sources -= [
"C/Sha256Opt.c",
"C/XzCrc64Opt.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" ]
}
|