Skip to content

Commit

Permalink
build: fix GN configuration for deps/base64
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Nov 13, 2023
1 parent 5e250bd commit e4a552d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deps/base64/base64/lib/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
#if defined (__x86_64__)
// This also works for the x32 ABI, which has a 64-bit word size.
# define BASE64_WORDSIZE 64
#elif defined (_INTEGRAL_MAX_BITS)
# define BASE64_WORDSIZE _INTEGRAL_MAX_BITS
#elif defined (__WORDSIZE)
# define BASE64_WORDSIZE __WORDSIZE
#elif defined (__SIZE_WIDTH__)
# define BASE64_WORDSIZE __SIZE_WIDTH__
#elif defined (_INTEGRAL_MAX_BITS) && !defined(_WIN32)
# define BASE64_WORDSIZE _INTEGRAL_MAX_BITS
#else
# error BASE64_WORDSIZE_NOT_DEFINED
#endif
Expand Down
18 changes: 18 additions & 0 deletions deps/base64/unofficial.gni
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template("base64_gn_build") {
"HAVE_SSE42=1",
"HAVE_AVX=1",
"HAVE_AVX2=1",
"HAVE_AVX512=1",
]
}
if (target_cpu == "arm") {
Expand Down Expand Up @@ -65,6 +66,7 @@ template("base64_gn_build") {
":base64_sse42",
":base64_avx",
":base64_avx2",
":base64_avx512",
":base64_neon32",
":base64_neon64",
]
Expand Down Expand Up @@ -111,6 +113,7 @@ template("base64_gn_build") {
}
}
}

source_set("base64_avx2") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/avx2/codec.c" ]
Expand All @@ -123,6 +126,21 @@ template("base64_gn_build") {
}
}

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" ]
Expand Down

0 comments on commit e4a552d

Please sign in to comment.