Add third_party/crc32c
Bug: 261600888 Test: no build files yet Change-Id: I07c3d818d8db6d0d6e5b83b32732ceac19e5bf68
This commit is contained in:
19
third_party/crc32c/Android.bp
vendored
Normal file
19
third_party/crc32c/Android.bp
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
package {
|
||||
default_applicable_licenses: [
|
||||
"external_webrtc_third_party_crc32c_license",
|
||||
],
|
||||
}
|
||||
|
||||
license {
|
||||
name: "external_webrtc_third_party_crc32c_license",
|
||||
visibility: [":__subpackages__"],
|
||||
license_kinds: [
|
||||
"SPDX-license-identifier-Apache-2.0",
|
||||
"legacy_notice",
|
||||
],
|
||||
license_text: [
|
||||
"src/LICENSE",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
179
third_party/crc32c/BUILD.gn
vendored
Normal file
179
third_party/crc32c/BUILD.gn
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
# Copyright 2017 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/features.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/google_benchmark/buildconfig.gni")
|
||||
|
||||
# Only applied to CRC32C source and tests. (not exported)
|
||||
config("crc32c_config") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
include_dirs = [
|
||||
"config",
|
||||
"src/include",
|
||||
]
|
||||
|
||||
defines = [
|
||||
"BYTE_ORDER_BIG_ENDIAN=0",
|
||||
"CRC32C_TESTS_BUILT_WITH_GLOG=0",
|
||||
]
|
||||
|
||||
# If we ever support big-endian builds, add logic to conditionally enable
|
||||
# BYTE_ORDER_BIG_ENDIAN.
|
||||
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
defines += [
|
||||
"HAVE_MM_PREFETCH=1",
|
||||
"HAVE_SSE42=1",
|
||||
]
|
||||
} else {
|
||||
defines += [
|
||||
"HAVE_MM_PREFETCH=0",
|
||||
"HAVE_SSE42=0",
|
||||
]
|
||||
}
|
||||
if (is_clang || !is_win) {
|
||||
defines += [ "HAVE_BUILTIN_PREFETCH=1" ]
|
||||
} else {
|
||||
defines += [ "HAVE_BUILTIN_PREFETCH=0" ]
|
||||
}
|
||||
|
||||
if (current_cpu == "arm64") {
|
||||
defines += [ "HAVE_ARM64_CRC32C=1" ]
|
||||
} else {
|
||||
defines += [ "HAVE_ARM64_CRC32C=0" ]
|
||||
}
|
||||
|
||||
# Android added <sys/auxv.h> in API level 18.
|
||||
if (is_linux || is_chromeos || is_android) {
|
||||
defines += [
|
||||
"HAVE_STRONG_GETAUXVAL=1",
|
||||
"HAVE_WEAK_GETAUXVAL=1",
|
||||
]
|
||||
} else {
|
||||
defines += [
|
||||
"HAVE_STRONG_GETAUXVAL=0",
|
||||
"HAVE_WEAK_GETAUXVAL=0",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
source_set("crc32c") {
|
||||
sources = [
|
||||
"src/include/crc32c/crc32c.h",
|
||||
"src/src/crc32c.cc",
|
||||
"src/src/crc32c_portable.cc",
|
||||
]
|
||||
|
||||
configs += [ ":crc32c_config" ]
|
||||
deps = [
|
||||
":crc32c_arm64",
|
||||
":crc32c_internal_headers",
|
||||
":crc32c_sse42",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("crc32c_sse42") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
sources = [
|
||||
"src/src/crc32c_sse42.cc",
|
||||
"src/src/crc32c_sse42.h",
|
||||
"src/src/crc32c_sse42_check.h",
|
||||
]
|
||||
|
||||
configs += [ ":crc32c_config" ]
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
if (is_win && !is_clang) {
|
||||
cflags = [ "/arch:AVX" ]
|
||||
} else {
|
||||
cflags = [ "-msse4.2" ]
|
||||
}
|
||||
}
|
||||
|
||||
deps = [ ":crc32c_internal_headers" ]
|
||||
}
|
||||
|
||||
source_set("crc32c_arm64") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
sources = [
|
||||
"src/src/crc32c_arm64.cc",
|
||||
"src/src/crc32c_arm64.h",
|
||||
"src/src/crc32c_arm64_check.h",
|
||||
]
|
||||
|
||||
configs += [ ":crc32c_config" ]
|
||||
if (current_cpu == "arm64") {
|
||||
if (is_clang) {
|
||||
cflags = [
|
||||
"-march=armv8-a",
|
||||
|
||||
# Some builds set -march to a different value from the above.
|
||||
# The specific feature flags below enable the instructions we need
|
||||
# in these cases. See https://crbug.com/934016 for example.
|
||||
"-Xclang",
|
||||
"-target-feature",
|
||||
"-Xclang",
|
||||
"+crc",
|
||||
"-Xclang",
|
||||
"-target-feature",
|
||||
"-Xclang",
|
||||
"+crypto",
|
||||
]
|
||||
} else {
|
||||
cflags = [ "-march=armv8-a+crc+crypto" ]
|
||||
}
|
||||
}
|
||||
|
||||
deps = [ ":crc32c_internal_headers" ]
|
||||
}
|
||||
|
||||
source_set("crc32c_internal_headers") {
|
||||
sources = [
|
||||
"config/crc32c/crc32c_config.h",
|
||||
"src/src/crc32c_internal.h",
|
||||
"src/src/crc32c_prefetch.h",
|
||||
"src/src/crc32c_read_le.h",
|
||||
"src/src/crc32c_round_up.h",
|
||||
]
|
||||
}
|
||||
|
||||
test("crc32c_tests") {
|
||||
sources = [
|
||||
"src/src/crc32c_arm64_unittest.cc",
|
||||
"src/src/crc32c_extend_unittests.h",
|
||||
"src/src/crc32c_portable_unittest.cc",
|
||||
"src/src/crc32c_prefetch_unittest.cc",
|
||||
"src/src/crc32c_read_le_unittest.cc",
|
||||
"src/src/crc32c_round_up_unittest.cc",
|
||||
"src/src/crc32c_sse42_unittest.cc",
|
||||
"src/src/crc32c_unittest.cc",
|
||||
]
|
||||
|
||||
configs += [ ":crc32c_config" ]
|
||||
deps = [
|
||||
":crc32c",
|
||||
":crc32c_arm64",
|
||||
":crc32c_internal_headers",
|
||||
":crc32c_sse42",
|
||||
"//testing/gtest:gtest_main",
|
||||
"//third_party/googletest:gtest",
|
||||
]
|
||||
}
|
||||
|
||||
if (enable_google_benchmarks) {
|
||||
test("crc32c_benchmark") {
|
||||
sources = [ "src/src/crc32c_benchmark.cc" ]
|
||||
configs += [ ":crc32c_config" ]
|
||||
deps = [
|
||||
":crc32c",
|
||||
":crc32c_arm64",
|
||||
":crc32c_internal_headers",
|
||||
":crc32c_sse42",
|
||||
"//third_party/google_benchmark",
|
||||
]
|
||||
}
|
||||
}
|
||||
4
third_party/crc32c/DIR_METADATA
vendored
Normal file
4
third_party/crc32c/DIR_METADATA
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
monorail {
|
||||
component: "Internals>Storage"
|
||||
}
|
||||
team_email: "storage-dev@chromium.org"
|
||||
6
third_party/crc32c/OWNERS.webrtc
vendored
Normal file
6
third_party/crc32c/OWNERS.webrtc
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
# Primary for bugs, reviews:
|
||||
asully@chromium.org
|
||||
|
||||
# Secondary:
|
||||
ayui@chromium.org
|
||||
jsbell@chromium.org
|
||||
16
third_party/crc32c/README.chromium
vendored
Normal file
16
third_party/crc32c/README.chromium
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
Name: CRC32C
|
||||
Short Name: crc32c
|
||||
URL: https://github.com/google/crc32c
|
||||
Version: 1.0.7.git-5998f8451548244de8cde7fab387a550e7c4497d
|
||||
License: New BSD
|
||||
License File: src/LICENSE
|
||||
Security Critical: yes
|
||||
|
||||
Description:
|
||||
CRC32C implementation with support for CPU-specific acceleration instructions
|
||||
|
||||
Local Additions:
|
||||
* gn file for building in chromium
|
||||
* Manually generated config/{android,mac,linux,win32,win64}/crc32c_config.h
|
||||
* Used the build commands in the README
|
||||
* Picked up the output in include/crc32c/crc32c_config.h
|
||||
6
third_party/crc32c/config/crc32c/crc32c_config.h
vendored
Normal file
6
third_party/crc32c/config/crc32c/crc32c_config.h
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
// Copyright 2017 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This is a stub. The preprocessor macros that are usually defined here are
|
||||
// supplied by BUILD.gn instead.
|
||||
Reference in New Issue
Block a user