Add Abseil to third_party.

At present, this is a proof-of-concept which only supports a small
subset of absl modules:
- Base
- Hash
- Numeric
- String

This is only used by one unit test, which builds a string and then
hashes it.

Bug: skia:10165
Bug: b/154848688

Change-Id: I016250bf700b522c7a6bc78cf1844abff2260c35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284805
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2020-04-24 08:37:42 -07:00 committed by Skia Commit-Bot
parent d59a91df4d
commit 816226e822
5 changed files with 164 additions and 0 deletions

View File

@ -1564,6 +1564,7 @@ if (skia_enable_tools) {
if (!(skia_use_freetype && skia_use_fontconfig)) {
sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
}
include_dirs = [ "third_party/externals/abseil-cpp" ]
deps = [
":experimental_svg_model",
":flags",
@ -1574,6 +1575,7 @@ if (skia_enable_tools) {
"modules/skparagraph:tests",
"modules/sksg:tests",
"modules/skshaper",
"//third_party/absl",
"//third_party/libpng",
"//third_party/libwebp",
"//third_party/zlib",

1
DEPS
View File

@ -7,6 +7,7 @@ vars = {
deps = {
"buildtools" : "https://chromium.googlesource.com/chromium/buildtools.git@505de88083136eefd056e5ee4ca0f01fe9b33de8",
"common" : "https://skia.googlesource.com/common.git@9737551d7a52c3db3262db5856e6bcd62c462b92",
"third_party/externals/abseil-cpp" : "https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp.git@1a02b7a2054c24f900dab796edb812f9260b51a6",
"third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@21c5af3151fb986a25ab491a4dc768c3645c764b",
# Dawn requires jinja2 and markupsafe for the code generator, and glslang and shaderc for SPIRV compilation.
# When the Dawn revision is updated these should be updated from the Dawn DEPS as well.

View File

@ -8,6 +8,7 @@ _tests = get_path_info("../tests", "abspath")
tests_sources = [
"$_tests/AAClipTest.cpp",
"$_tests/AbseilTest.cpp",
"$_tests/AdvancedBlendTest.cpp",
"$_tests/AndroidCodecTest.cpp",
"$_tests/AnimatedImageTest.cpp",

25
tests/AbseilTest.cpp Normal file
View File

@ -0,0 +1,25 @@
/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "tests/Test.h"
#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
#include "absl/hash/hash.h"
#include "absl/strings/substitute.h"
DEF_TEST(AbseilTest, reporter) {
// Tests that Abseil can be compiled, linked and run. Can be removed once Abseil is in use
// elsewhere.
const void* nullVoid = nullptr;
const std::string kStringToHash = absl::Substitute("$0 $1 $2 $3", "absl", 0, false, nullVoid);
REPORTER_ASSERT(reporter, kStringToHash == "absl 0 false NULL");
const size_t hashValue = absl::Hash<std::string>{}(kStringToHash);
REPORTER_ASSERT(reporter, hashValue != 0);
}
#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK

135
third_party/absl/BUILD.gn vendored Normal file
View File

@ -0,0 +1,135 @@
# Copyright 2020 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../third_party.gni")
third_party("absl") {
public_include_dirs = [ "../externals/abseil-cpp" ]
sources = [
# Base
"../externals/abseil-cpp/absl/base/attributes.h",
"../externals/abseil-cpp/absl/base/call_once.h",
"../externals/abseil-cpp/absl/base/casts.h",
"../externals/abseil-cpp/absl/base/config.h",
"../externals/abseil-cpp/absl/base/const_init.h",
"../externals/abseil-cpp/absl/base/dynamic_annotations.cc",
"../externals/abseil-cpp/absl/base/dynamic_annotations.h",
"../externals/abseil-cpp/absl/base/internal/atomic_hook.h",
"../externals/abseil-cpp/absl/base/internal/bits.h",
"../externals/abseil-cpp/absl/base/internal/cycleclock.cc",
"../externals/abseil-cpp/absl/base/internal/cycleclock.h",
"../externals/abseil-cpp/absl/base/internal/direct_mmap.h",
"../externals/abseil-cpp/absl/base/internal/endian.h",
"../externals/abseil-cpp/absl/base/internal/errno_saver.h",
"../externals/abseil-cpp/absl/base/internal/exponential_biased.cc",
"../externals/abseil-cpp/absl/base/internal/exponential_biased.h",
"../externals/abseil-cpp/absl/base/internal/fast_type_id.h",
"../externals/abseil-cpp/absl/base/internal/hide_ptr.h",
"../externals/abseil-cpp/absl/base/internal/identity.h",
"../externals/abseil-cpp/absl/base/internal/inline_variable.h",
"../externals/abseil-cpp/absl/base/internal/invoke.h",
"../externals/abseil-cpp/absl/base/internal/low_level_alloc.h",
"../externals/abseil-cpp/absl/base/internal/low_level_scheduling.h",
"../externals/abseil-cpp/absl/base/internal/per_thread_tls.h",
"../externals/abseil-cpp/absl/base/internal/periodic_sampler.cc",
"../externals/abseil-cpp/absl/base/internal/periodic_sampler.h",
"../externals/abseil-cpp/absl/base/internal/pretty_function.h",
"../externals/abseil-cpp/absl/base/internal/raw_logging.cc",
"../externals/abseil-cpp/absl/base/internal/raw_logging.h",
"../externals/abseil-cpp/absl/base/internal/scheduling_mode.h",
"../externals/abseil-cpp/absl/base/internal/scoped_set_env.cc",
"../externals/abseil-cpp/absl/base/internal/scoped_set_env.h",
"../externals/abseil-cpp/absl/base/internal/spinlock.cc",
"../externals/abseil-cpp/absl/base/internal/spinlock.h",
"../externals/abseil-cpp/absl/base/internal/spinlock_wait.cc",
"../externals/abseil-cpp/absl/base/internal/spinlock_wait.h",
"../externals/abseil-cpp/absl/base/internal/strerror.cc",
"../externals/abseil-cpp/absl/base/internal/strerror.h",
"../externals/abseil-cpp/absl/base/internal/sysinfo.cc",
"../externals/abseil-cpp/absl/base/internal/sysinfo.h",
"../externals/abseil-cpp/absl/base/internal/thread_annotations.h",
"../externals/abseil-cpp/absl/base/internal/thread_identity.cc",
"../externals/abseil-cpp/absl/base/internal/thread_identity.h",
"../externals/abseil-cpp/absl/base/internal/throw_delegate.h",
"../externals/abseil-cpp/absl/base/internal/tsan_mutex_interface.h",
"../externals/abseil-cpp/absl/base/internal/unaligned_access.h",
"../externals/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
"../externals/abseil-cpp/absl/base/internal/unscaledcycleclock.h",
"../externals/abseil-cpp/absl/base/log_severity.cc",
"../externals/abseil-cpp/absl/base/log_severity.h",
"../externals/abseil-cpp/absl/base/macros.h",
"../externals/abseil-cpp/absl/base/optimization.h",
"../externals/abseil-cpp/absl/base/options.h",
"../externals/abseil-cpp/absl/base/policy_checks.h",
"../externals/abseil-cpp/absl/base/port.h",
"../externals/abseil-cpp/absl/base/thread_annotations.h",
# Base (disabled)
# "../externals/abseil-cpp/absl/base/internal/low_level_alloc.cc",
# "../externals/abseil-cpp/absl/base/internal/throw_delegate.cc",
# Hash
"../externals/abseil-cpp/absl/hash/hash.h",
"../externals/abseil-cpp/absl/hash/internal/city.cc",
"../externals/abseil-cpp/absl/hash/internal/city.h",
"../externals/abseil-cpp/absl/hash/internal/hash.cc",
"../externals/abseil-cpp/absl/hash/internal/hash.h",
"../externals/abseil-cpp/absl/hash/internal/spy_hash_state.h",
# Numeric
"../externals/abseil-cpp/absl/numeric/int128.cc",
"../externals/abseil-cpp/absl/numeric/int128.h",
# Strings
"../externals/abseil-cpp/absl/strings/ascii.cc",
"../externals/abseil-cpp/absl/strings/ascii.h",
"../externals/abseil-cpp/absl/strings/charconv.cc",
"../externals/abseil-cpp/absl/strings/charconv.h",
"../externals/abseil-cpp/absl/strings/cord.cc",
"../externals/abseil-cpp/absl/strings/cord.h",
"../externals/abseil-cpp/absl/strings/escaping.cc",
"../externals/abseil-cpp/absl/strings/escaping.h",
"../externals/abseil-cpp/absl/strings/internal/char_map.h",
"../externals/abseil-cpp/absl/strings/internal/charconv_bigint.cc",
"../externals/abseil-cpp/absl/strings/internal/charconv_bigint.h",
"../externals/abseil-cpp/absl/strings/internal/charconv_parse.cc",
"../externals/abseil-cpp/absl/strings/internal/charconv_parse.h",
"../externals/abseil-cpp/absl/strings/internal/cord_internal.h",
"../externals/abseil-cpp/absl/strings/internal/escaping.cc",
"../externals/abseil-cpp/absl/strings/internal/escaping.h",
"../externals/abseil-cpp/absl/strings/internal/escaping_test_common.h",
"../externals/abseil-cpp/absl/strings/internal/memutil.cc",
"../externals/abseil-cpp/absl/strings/internal/memutil.h",
"../externals/abseil-cpp/absl/strings/internal/numbers_test_common.h",
"../externals/abseil-cpp/absl/strings/internal/ostringstream.cc",
"../externals/abseil-cpp/absl/strings/internal/ostringstream.h",
"../externals/abseil-cpp/absl/strings/internal/pow10_helper.cc",
"../externals/abseil-cpp/absl/strings/internal/pow10_helper.h",
"../externals/abseil-cpp/absl/strings/internal/resize_uninitialized.h",
"../externals/abseil-cpp/absl/strings/internal/stl_type_traits.h",
"../externals/abseil-cpp/absl/strings/internal/str_join_internal.h",
"../externals/abseil-cpp/absl/strings/internal/str_split_internal.h",
"../externals/abseil-cpp/absl/strings/internal/utf8.cc",
"../externals/abseil-cpp/absl/strings/internal/utf8.h",
"../externals/abseil-cpp/absl/strings/match.cc",
"../externals/abseil-cpp/absl/strings/match.h",
"../externals/abseil-cpp/absl/strings/numbers.cc",
"../externals/abseil-cpp/absl/strings/numbers.h",
"../externals/abseil-cpp/absl/strings/str_cat.cc",
"../externals/abseil-cpp/absl/strings/str_cat.h",
"../externals/abseil-cpp/absl/strings/str_format.h",
"../externals/abseil-cpp/absl/strings/str_join.h",
"../externals/abseil-cpp/absl/strings/str_replace.cc",
"../externals/abseil-cpp/absl/strings/str_replace.h",
"../externals/abseil-cpp/absl/strings/str_split.cc",
"../externals/abseil-cpp/absl/strings/str_split.h",
"../externals/abseil-cpp/absl/strings/string_view.cc",
"../externals/abseil-cpp/absl/strings/string_view.h",
"../externals/abseil-cpp/absl/strings/strip.h",
"../externals/abseil-cpp/absl/strings/substitute.cc",
"../externals/abseil-cpp/absl/strings/substitute.h",
]
}