File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (172 lines) | stat: -rw-r--r-- 3,993 bytes parent folder | download | duplicates (3)
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" ]
}