2019-03-07 01:46:39 +00:00
|
|
|
# Copyright 2019 The Dawn Authors
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
import("../../scripts/dawn_overrides_with_defaults.gni")
|
|
|
|
|
|
|
|
import("//build_overrides/build.gni")
|
|
|
|
import("${dawn_root}/scripts/dawn_features.gni")
|
|
|
|
|
|
|
|
# Use Chromium's dcheck_always_on when available so that we respect it when
|
|
|
|
# running tests on the GPU builders
|
|
|
|
if (build_with_chromium) {
|
|
|
|
import("//build/config/dcheck_always_on.gni")
|
|
|
|
} else {
|
|
|
|
dcheck_always_on = false
|
|
|
|
}
|
|
|
|
|
2019-12-19 16:07:58 +00:00
|
|
|
if (build_with_chromium) {
|
|
|
|
import("//build/config/sanitizers/sanitizers.gni")
|
|
|
|
} else {
|
|
|
|
use_fuzzing_engine = false
|
|
|
|
}
|
|
|
|
|
2019-03-07 01:46:39 +00:00
|
|
|
###############################################################################
|
|
|
|
# Common dawn configs
|
|
|
|
###############################################################################
|
|
|
|
|
2019-03-26 17:16:28 +00:00
|
|
|
config("dawn_public_include_dirs") {
|
2019-03-07 01:46:39 +00:00
|
|
|
include_dirs = [
|
2019-09-18 04:33:12 +00:00
|
|
|
"${target_gen_dir}/../../src/include",
|
2019-03-26 17:16:28 +00:00
|
|
|
"${dawn_root}/src/include",
|
2019-03-07 01:46:39 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
config("dawn_internal") {
|
2019-09-18 04:33:12 +00:00
|
|
|
include_dirs = [
|
|
|
|
"${target_gen_dir}/../../src",
|
|
|
|
"${dawn_root}/src",
|
|
|
|
]
|
2019-03-07 01:46:39 +00:00
|
|
|
|
|
|
|
defines = []
|
2019-12-19 16:07:58 +00:00
|
|
|
if (dawn_always_assert || dcheck_always_on || is_debug ||
|
|
|
|
use_fuzzing_engine) {
|
2019-03-07 01:46:39 +00:00
|
|
|
defines += [ "DAWN_ENABLE_ASSERTS" ]
|
|
|
|
}
|
|
|
|
|
2019-12-19 16:07:58 +00:00
|
|
|
if (use_fuzzing_engine) {
|
|
|
|
# Does a hard abort when an assertion fails so that fuzzers catch and parse the failure.
|
|
|
|
defines += [ "DAWN_ABORT_ON_ASSERT" ]
|
|
|
|
}
|
|
|
|
|
2019-03-07 01:46:39 +00:00
|
|
|
if (dawn_enable_d3d12) {
|
|
|
|
defines += [ "DAWN_ENABLE_BACKEND_D3D12" ]
|
|
|
|
}
|
|
|
|
if (dawn_enable_metal) {
|
|
|
|
defines += [ "DAWN_ENABLE_BACKEND_METAL" ]
|
|
|
|
}
|
|
|
|
if (dawn_enable_null) {
|
|
|
|
defines += [ "DAWN_ENABLE_BACKEND_NULL" ]
|
|
|
|
}
|
|
|
|
if (dawn_enable_opengl) {
|
|
|
|
defines += [ "DAWN_ENABLE_BACKEND_OPENGL" ]
|
|
|
|
}
|
|
|
|
if (dawn_enable_vulkan) {
|
|
|
|
defines += [ "DAWN_ENABLE_BACKEND_VULKAN" ]
|
|
|
|
}
|
|
|
|
|
2020-01-15 13:14:12 +00:00
|
|
|
if (dawn_use_x11) {
|
2019-08-13 22:45:14 +00:00
|
|
|
defines += [ "DAWN_USE_X11" ]
|
|
|
|
}
|
|
|
|
|
2019-12-17 00:47:40 +00:00
|
|
|
if (dawn_enable_error_injection) {
|
|
|
|
defines += [ "DAWN_ENABLE_ERROR_INJECTION" ]
|
|
|
|
}
|
|
|
|
|
2019-03-07 01:46:39 +00:00
|
|
|
# Only internal Dawn targets can use this config, this means only targets in
|
|
|
|
# this BUILD.gn file.
|
|
|
|
visibility = [ ":*" ]
|
2020-04-30 22:05:38 +00:00
|
|
|
cflags = []
|
2020-04-08 16:04:32 +00:00
|
|
|
|
|
|
|
# Enable more warnings that were found when using Dawn in other projects
|
|
|
|
if (is_clang) {
|
2020-04-30 22:05:38 +00:00
|
|
|
cflags += [
|
2020-04-13 12:34:20 +00:00
|
|
|
"-Wconditional-uninitialized",
|
2020-04-24 17:02:53 +00:00
|
|
|
"-Wcstring-format-directive",
|
2020-04-13 12:34:20 +00:00
|
|
|
"-Wc++11-narrowing",
|
2020-04-24 17:02:53 +00:00
|
|
|
"-Wdeprecated-copy",
|
2020-04-14 16:20:14 +00:00
|
|
|
"-Wextra-semi-stmt",
|
2020-04-24 17:02:53 +00:00
|
|
|
"-Winconsistent-missing-destructor-override",
|
|
|
|
"-Winvalid-offsetof",
|
|
|
|
"-Wmissing-field-initializers",
|
|
|
|
"-Wpessimizing-move",
|
|
|
|
"-Wreturn-std-move-in-c++11",
|
|
|
|
"-Wshadow-field",
|
|
|
|
"-Wstrict-prototypes",
|
|
|
|
"-Wtautological-unsigned-zero-compare",
|
2020-04-08 16:04:32 +00:00
|
|
|
]
|
2020-04-27 18:09:40 +00:00
|
|
|
|
|
|
|
if (is_win) {
|
2020-05-13 08:01:55 +00:00
|
|
|
cflags += [
|
|
|
|
# clang-cl doesn't know -pedantic, pass it explicitly to the clang driver
|
|
|
|
"/clang:-pedantic",
|
|
|
|
|
|
|
|
# Allow the use of __uuidof()
|
|
|
|
"-Wno-language-extension-token",
|
|
|
|
]
|
2020-04-27 18:09:40 +00:00
|
|
|
} else {
|
|
|
|
cflags += [ "-pedantic" ]
|
|
|
|
}
|
2020-04-08 16:04:32 +00:00
|
|
|
}
|
2020-04-30 22:05:38 +00:00
|
|
|
|
|
|
|
if (!is_clang && is_win) {
|
|
|
|
# Dawn extends wgpu enums with internal enums.
|
|
|
|
# MSVC considers these invalid switch values. crbug.com/dawn/397.
|
|
|
|
cflags += [ "/wd4063" ]
|
|
|
|
}
|
2019-03-07 01:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Common dawn library
|
|
|
|
###############################################################################
|
|
|
|
|
2019-03-07 13:39:50 +00:00
|
|
|
# This GN file is discovered by all Chromium builds, but common doesn't support
|
|
|
|
# all of Chromium's OSes so we explicitly make the target visible only on
|
|
|
|
# systems we know Dawn is able to compile on.
|
2019-11-28 09:40:54 +00:00
|
|
|
if (is_win || is_linux || is_mac || is_fuchsia || is_android) {
|
2019-03-07 13:39:50 +00:00
|
|
|
static_library("common") {
|
|
|
|
sources = [
|
|
|
|
"Assert.cpp",
|
|
|
|
"Assert.h",
|
|
|
|
"BitSetIterator.h",
|
|
|
|
"Compiler.h",
|
2019-04-11 07:41:38 +00:00
|
|
|
"Constants.h",
|
2019-03-07 13:39:50 +00:00
|
|
|
"DynamicLib.cpp",
|
|
|
|
"DynamicLib.h",
|
2020-01-07 17:49:15 +00:00
|
|
|
"GPUInfo.cpp",
|
|
|
|
"GPUInfo.h",
|
2019-03-07 13:39:50 +00:00
|
|
|
"HashUtils.h",
|
2020-03-05 09:54:06 +00:00
|
|
|
"LinkedList.h",
|
2019-12-05 11:13:01 +00:00
|
|
|
"Log.cpp",
|
|
|
|
"Log.h",
|
2019-03-07 13:39:50 +00:00
|
|
|
"Math.cpp",
|
|
|
|
"Math.h",
|
2020-03-04 17:48:24 +00:00
|
|
|
"PlacementAllocated.h",
|
2019-03-07 13:39:50 +00:00
|
|
|
"Platform.h",
|
2020-04-20 17:36:22 +00:00
|
|
|
"RefCounted.cpp",
|
|
|
|
"RefCounted.h",
|
2019-07-17 19:01:50 +00:00
|
|
|
"Result.cpp",
|
2019-03-07 13:39:50 +00:00
|
|
|
"Result.h",
|
|
|
|
"Serial.h",
|
|
|
|
"SerialMap.h",
|
|
|
|
"SerialQueue.h",
|
|
|
|
"SerialStorage.h",
|
2020-03-04 17:48:24 +00:00
|
|
|
"SlabAllocator.cpp",
|
|
|
|
"SlabAllocator.h",
|
2019-03-07 13:39:50 +00:00
|
|
|
"SwapChainUtils.h",
|
2019-11-07 12:13:27 +00:00
|
|
|
"SystemUtils.cpp",
|
|
|
|
"SystemUtils.h",
|
2019-03-07 13:39:50 +00:00
|
|
|
"vulkan_platform.h",
|
|
|
|
"windows_with_undefs.h",
|
2019-09-17 21:36:15 +00:00
|
|
|
"xlib_with_undefs.h",
|
2019-03-07 13:39:50 +00:00
|
|
|
]
|
2019-03-26 17:16:28 +00:00
|
|
|
|
2019-07-17 08:54:18 +00:00
|
|
|
public_configs = [ ":dawn_internal" ]
|
2020-04-11 03:22:33 +00:00
|
|
|
deps = [ "${dawn_root}/src/dawn:dawn_headers" ]
|
2019-07-17 08:54:18 +00:00
|
|
|
if (dawn_enable_vulkan) {
|
2020-04-11 03:22:33 +00:00
|
|
|
public_deps = [ "${dawn_root}/third_party/khronos:vulkan_headers" ]
|
2019-07-17 08:54:18 +00:00
|
|
|
}
|
2019-12-05 11:13:01 +00:00
|
|
|
if (is_android) {
|
|
|
|
libs = [ "log" ]
|
|
|
|
}
|
2019-03-07 13:39:50 +00:00
|
|
|
}
|
2019-03-07 01:46:39 +00:00
|
|
|
}
|