Added Abseil as a third-party dependency

Using the version in the Chromium repo in order to make use of the .gn
files it contains.

Doing so also appears to require us to switch where we pull googletest
from so that the directory structure matches what the Abseil build
config expects. Fortunately this doesn't seem to cause issues in our
tests.

Bug: dawn:563
Change-Id: I55831ad33f282b3d8b03b67826fd2776e5602d89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63780
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
This commit is contained in:
Brandon Jones 2021-09-14 16:56:15 +00:00 committed by Dawn LUCI CQ
parent 088071a5a7
commit 020d69905e
10 changed files with 69 additions and 6 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
build build
buildtools buildtools
testing testing
third_party/abseil-cpp/
third_party/angle/ third_party/angle/
third_party/clang-format/ third_party/clang-format/
third_party/glfw/ third_party/glfw/

View File

@ -94,6 +94,7 @@ option(DAWN_BUILD_EXAMPLES "Enables building Dawn's exmaples" ${BUILD_EXAMPLE})
set(DAWN_THIRD_PARTY_DIR "${Dawn_SOURCE_DIR}/third_party" CACHE STRING "Directory in which to find third-party dependencies.") set(DAWN_THIRD_PARTY_DIR "${Dawn_SOURCE_DIR}/third_party" CACHE STRING "Directory in which to find third-party dependencies.")
set(DAWN_ABSEIL_DIR "${DAWN_THIRD_PARTY_DIR}/abseil-cpp" CACHE STRING "Directory in which to find Abseil")
set(DAWN_GLFW_DIR "${DAWN_THIRD_PARTY_DIR}/glfw" CACHE STRING "Directory in which to find GLFW") set(DAWN_GLFW_DIR "${DAWN_THIRD_PARTY_DIR}/glfw" CACHE STRING "Directory in which to find GLFW")
set(DAWN_GLM_DIR "${DAWN_THIRD_PARTY_DIR}/glm" CACHE STRING "Directory in which to find GLM") set(DAWN_GLM_DIR "${DAWN_THIRD_PARTY_DIR}/glm" CACHE STRING "Directory in which to find GLM")
set(DAWN_JINJA2_DIR "${DAWN_THIRD_PARTY_DIR}/jinja2" CACHE STRING "Directory in which to find Jinja2") set(DAWN_JINJA2_DIR "${DAWN_THIRD_PARTY_DIR}/jinja2" CACHE STRING "Directory in which to find Jinja2")

23
DEPS
View File

@ -9,6 +9,21 @@ vars = {
'swiftshader_git': 'https://swiftshader.googlesource.com', 'swiftshader_git': 'https://swiftshader.googlesource.com',
'dawn_standalone': True, 'dawn_standalone': True,
# Current revision of googletest.
# Note: this dep cannot be auto-rolled b/c of nesting.
'googletest_revision': '2d924d7a971e9667d76ad09727fb2402b4f8a1e3',
# Current revision of Chrome's third_party googletest directory. This
# repository is mirrored as a separate repository, with separate git hashes
# that don't match the external googletest repository or Chrome. Mirrored
# patches will have a different git hash associated with them.
# To roll, first get the new hash for chromium_googletest_revision from the
# mirror of third_party/googletest located here:
# https://chromium.googlesource.com/chromium/src/third_party/googletest/
# Then get the new hash for googletest_revision from the root Chrome DEPS
# file: https://source.chromium.org/chromium/chromium/src/+/main:DEPS
'chromium_googletest_revision': '17bbed2084d3127bd7bcd27283f18d7a5861bea8',
} }
deps = { deps = {
@ -80,7 +95,7 @@ deps = {
'condition': 'dawn_standalone', 'condition': 'dawn_standalone',
}, },
'third_party/googletest': { 'third_party/googletest': {
'url': '{chromium_git}/external/github.com/google/googletest@2828773179fa425ee406df61890a150577178ea2', 'url': '{chromium_git}/chromium/src/third_party/googletest@{chromium_googletest_revision}',
'condition': 'dawn_standalone', 'condition': 'dawn_standalone',
}, },
@ -135,6 +150,11 @@ deps = {
'url': '{chromium_git}/chromium/src/third_party/zlib@c29ee8c9c3824ca013479bf8115035527967fe02', 'url': '{chromium_git}/chromium/src/third_party/zlib@c29ee8c9c3824ca013479bf8115035527967fe02',
'condition': 'dawn_standalone', 'condition': 'dawn_standalone',
}, },
'third_party/abseil-cpp': {
'url': '{chromium_git}/chromium/src/third_party/abseil-cpp@789af048b388657987c59d4da406859034fe310f',
'condition': 'dawn_standalone',
},
} }
hooks = [ hooks = [
@ -232,5 +252,6 @@ hooks = [
] ]
recursedeps = [ recursedeps = [
'third_party/googletest',
'third_party/vulkan-deps', 'third_party/vulkan-deps',
] ]

View File

@ -23,6 +23,10 @@ declare_args() {
# Android 32-bit non-component, non-clang builds cannot have symbol_level=2 # Android 32-bit non-component, non-clang builds cannot have symbol_level=2
# due to 4GiB file size limit, see https://crbug.com/648948. # due to 4GiB file size limit, see https://crbug.com/648948.
ignore_elf32_limitations = false ignore_elf32_limitations = false
# If true, it assumes that //third_party/abseil-cpp is an available
# dependency for googletest.
gtest_enable_absl_printers = false
} }
# Detect whether we can use the hermetic XCode like in Chromium and do so if # Detect whether we can use the hermetic XCode like in Chromium and do so if

View File

@ -27,6 +27,7 @@ dawn_has_build = true
# users of Dawn don't have to set dirs if they happen to use the same as Dawn. # users of Dawn don't have to set dirs if they happen to use the same as Dawn.
# The paths to Dawn's dependencies # The paths to Dawn's dependencies
dawn_abseil_dir = "//third_party/abseil-cpp"
dawn_angle_dir = "//third_party/angle" dawn_angle_dir = "//third_party/angle"
dawn_jinja2_dir = "//third_party/jinja2" dawn_jinja2_dir = "//third_party/jinja2"
dawn_glfw_dir = "//third_party/glfw" dawn_glfw_dir = "//third_party/glfw"

View File

@ -76,3 +76,7 @@ if (!defined(dawn_tint_dir)) {
# Default to Tint being Dawn's DEPS # Default to Tint being Dawn's DEPS
dawn_tint_dir = "${dawn_root}/third_party/tint" dawn_tint_dir = "${dawn_root}/third_party/tint"
} }
if (!defined(dawn_abseil_dir)) {
dawn_abseil_dir = "//third_party/abseil-cpp"
}

View File

@ -53,6 +53,32 @@ if (dawn_enable_vulkan) {
dawn_enable_vulkan_loader && dawn_vulkan_loader_dir != "" dawn_enable_vulkan_loader && dawn_vulkan_loader_dir != ""
} }
config("dawn_abseil_config") {
if (dawn_standalone && is_clang) {
cflags = [
# Allow the use of enable_if()
"-Wno-gcc-compat",
]
}
configs = [
"$dawn_abseil_dir:absl_define_config",
"$dawn_abseil_dir:absl_include_config",
]
}
group("dawn_abseil") {
# When build_with_chromium=true we need to include "//third_party/abseil-cpp:absl" while
# we can be more specific when building standalone Dawn.
if (build_with_chromium) {
public_deps = [ "$dawn_abseil_dir:absl" ]
} else {
public_deps = [ "$dawn_abseil_dir/absl/strings:str_format" ]
}
public_configs = [ ":dawn_abseil_config" ]
}
config("dawn_native_internal") { config("dawn_native_internal") {
configs = [ "${dawn_root}/src/common:dawn_internal" ] configs = [ "${dawn_root}/src/common:dawn_internal" ]
@ -142,6 +168,7 @@ source_set("dawn_native_headers") {
# except those that define exported symbols. # except those that define exported symbols.
source_set("dawn_native_sources") { source_set("dawn_native_sources") {
deps = [ deps = [
":dawn_abseil",
":dawn_native_headers", ":dawn_native_headers",
":dawn_native_utils_gen", ":dawn_native_utils_gen",
"${dawn_root}/src/common", "${dawn_root}/src/common",

View File

@ -14,6 +14,7 @@
#include "dawn_native/ShaderModule.h" #include "dawn_native/ShaderModule.h"
#include "absl/strings/str_format.h"
#include "common/Constants.h" #include "common/Constants.h"
#include "common/HashUtils.h" #include "common/HashUtils.h"
#include "dawn_native/BindGroupLayout.h" #include "dawn_native/BindGroupLayout.h"
@ -35,10 +36,8 @@ namespace dawn_native {
namespace { namespace {
std::string GetShaderDeclarationString(BindGroupIndex group, BindingNumber binding) { std::string GetShaderDeclarationString(BindGroupIndex group, BindingNumber binding) {
std::ostringstream ostream; return absl::StrFormat("the shader module declaration at set %u, binding %u",
ostream << "the shader module declaration at set " << static_cast<uint32_t>(group) static_cast<uint32_t>(group), static_cast<uint32_t>(binding));
<< " binding " << static_cast<uint32_t>(binding);
return ostream.str();
} }
tint::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) { tint::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) {

View File

@ -39,7 +39,7 @@ group("dawn_tests") {
if (!build_with_chromium) { if (!build_with_chromium) {
# When we aren't in Chromium we define out own targets based on the location # When we aren't in Chromium we define out own targets based on the location
# of the googletest repo. # of the googletest repo.
googletest_dir = dawn_googletest_dir googletest_dir = "${dawn_googletest_dir}/src"
config("gtest_config") { config("gtest_config") {
include_dirs = [ include_dirs = [

View File

@ -59,6 +59,11 @@ if (NOT TARGET libtint)
add_subdirectory(${DAWN_TINT_DIR}) add_subdirectory(${DAWN_TINT_DIR})
endif() endif()
if (NOT TARGET libabsl)
message(STATUS "Dawn: using Abseil at ${DAWN_ABSEIL_DIR}")
add_subdirectory(${DAWN_ABSEIL_DIR})
endif()
# Header-only library for khrplatform.h # Header-only library for khrplatform.h
add_library(dawn_khronos_platform INTERFACE) add_library(dawn_khronos_platform INTERFACE)
target_sources(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos/KHR/khrplatform.h") target_sources(dawn_khronos_platform INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos/KHR/khrplatform.h")