node/deps/base64/unofficial.gni

154 lines
4.0 KiB
Plaintext

# 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",
"HAVE_AVX512=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_avx512",
":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_avx512") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/avx512/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [
"-mavx512vl",
"-mavx512vbmi",
]
} else if (is_win) {
cflags_c = [ "/arch:AVX512" ]
}
}
}
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
}
}