diff --git a/BUILD.gn b/BUILD.gn index 7b7042961d..755200d046 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1559,6 +1559,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", @@ -1569,6 +1570,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", diff --git a/DEPS b/DEPS index c35e9be63c..602f858c91 100644 --- a/DEPS +++ b/DEPS @@ -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@3cb9c4bee9b369a2172d5c22e6eb70da49a799ed", # 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. diff --git a/gn/tests.gni b/gn/tests.gni index 0944a4fba8..b05b229686 100644 --- a/gn/tests.gni +++ b/gn/tests.gni @@ -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", diff --git a/tests/AbseilTest.cpp b/tests/AbseilTest.cpp new file mode 100644 index 0000000000..b024eea219 --- /dev/null +++ b/tests/AbseilTest.cpp @@ -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{}(kStringToHash); + REPORTER_ASSERT(reporter, hashValue != 0); +} + +#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK diff --git a/third_party/absl/BUILD.gn b/third_party/absl/BUILD.gn new file mode 100644 index 0000000000..f0b0e95400 --- /dev/null +++ b/third_party/absl/BUILD.gn @@ -0,0 +1,133 @@ +# 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.cc", + "../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.cc", + "../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", + + # 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", + ] +}