-
Notifications
You must be signed in to change notification settings - Fork 28.3k
/
unofficial.gni
141 lines (130 loc) Β· 3.82 KB
/
unofficial.gni
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
# Copyright (c) 2013-2022 GitHub Inc.
# Copyright 2022 the V8 project authors. All rights reserved.
# Copyright 2023 Microsoft Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please edit the gyp files if you are making changes to build system.
# The actual configurations are put inside a template in unofficial.gni to
# prevent accidental edits from contributors.
template("base64_gn_build") {
config("base64_external_config") {
include_dirs = [ "base64/include" ]
if (!is_component_build) {
defines = [ "BASE64_STATIC_DEFINE" ]
}
}
config("base64_internal_config") {
include_dirs = [ "base64/lib" ]
if (is_component_build) {
defines = [ "BASE64_EXPORTS" ]
} else {
defines = []
}
if (target_cpu == "x86" || target_cpu == "x64") {
defines += [
"HAVE_SSSE3=1",
"HAVE_SSE41=1",
"HAVE_SSE42=1",
"HAVE_AVX=1",
"HAVE_AVX2=1",
]
}
if (target_cpu == "arm") {
defines += [ "HAVE_NEON32=1" ]
}
if (target_cpu == "arm64") {
defines += [ "HAVE_NEON64=1" ]
}
if (is_clang || !is_win) {
cflags_c = [
"-Wno-implicit-fallthrough",
"-Wno-shadow",
"-Wno-unused-but-set-variable",
]
}
}
gypi_values = exec_script("../../tools/gypi_to_gn.py",
[ rebase_path("base64.gyp") ],
"scope",
[ "base64.gyp" ])
component(target_name) {
forward_variables_from(invoker, "*")
configs += [ ":base64_internal_config" ]
public_configs = [ ":base64_external_config" ]
sources = gypi_values.base64_sources_common
deps = [
":base64_ssse3",
":base64_sse41",
":base64_sse42",
":base64_avx",
":base64_avx2",
":base64_neon32",
":base64_neon64",
]
}
source_set("base64_ssse3") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/ssse3/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-mssse3" ]
}
}
}
source_set("base64_sse41") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/sse41/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-msse4.1" ]
}
}
}
source_set("base64_sse42") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/sse42/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-msse4.2" ]
}
}
}
source_set("base64_avx") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/avx/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-mavx" ]
} else if (is_win) {
cflags_c = [ "/arch:AVX" ]
}
}
}
source_set("base64_avx2") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/avx2/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-mavx2" ]
} else if (is_win) {
cflags_c = [ "/arch:AVX2" ]
}
}
}
source_set("base64_neon32") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/neon32/codec.c" ]
if (target_cpu == "arm") {
if (is_clang || !is_win) {
cflags_c = [ "-mfpu=neon" ]
}
}
}
source_set("base64_neon64") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/neon64/codec.c" ]
# NEON is required in arm64, so no -mfpu flag is needed
}
}