Split off common and libdawn / dawn_headers from BUILD.gn
This adds an option to dawn_generator to generate files in a different directory so the generated stay at the same place. Otherwise compilation errors occur because of stale versions of the headers on the CQ builders. BUG=dawn:61 Change-Id: I71ceb3172b5a4e35911973a03be29d90fa684416 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5304 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
abc753c9c9
commit
579cf621f3
173
BUILD.gn
173
BUILD.gn
|
@ -20,142 +20,12 @@ import("generator/dawn_generator.gni")
|
||||||
|
|
||||||
import("//testing/test.gni")
|
import("//testing/test.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
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Common dawn libraries and configs
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
config("dawn_public") {
|
|
||||||
include_dirs = [
|
|
||||||
target_gen_dir,
|
|
||||||
"src/include",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
config("dawn_internal") {
|
|
||||||
include_dirs = [ "src" ]
|
|
||||||
|
|
||||||
defines = []
|
|
||||||
if (dawn_always_assert || dcheck_always_on || is_debug) {
|
|
||||||
defines += [ "DAWN_ENABLE_ASSERTS" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
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" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
configs = [ ":dawn_public" ]
|
|
||||||
|
|
||||||
# Only internal Dawn targets can use this config, this means only targets in
|
|
||||||
# this BUILD.gn file.
|
|
||||||
visibility = [ ":*" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
static_library("dawn_common") {
|
|
||||||
sources = [
|
|
||||||
"src/common/Assert.cpp",
|
|
||||||
"src/common/Assert.h",
|
|
||||||
"src/common/BitSetIterator.h",
|
|
||||||
"src/common/Compiler.h",
|
|
||||||
"src/common/DynamicLib.cpp",
|
|
||||||
"src/common/DynamicLib.h",
|
|
||||||
"src/common/HashUtils.h",
|
|
||||||
"src/common/Math.cpp",
|
|
||||||
"src/common/Math.h",
|
|
||||||
"src/common/Platform.h",
|
|
||||||
"src/common/Result.h",
|
|
||||||
"src/common/Serial.h",
|
|
||||||
"src/common/SerialMap.h",
|
|
||||||
"src/common/SerialQueue.h",
|
|
||||||
"src/common/SerialStorage.h",
|
|
||||||
"src/common/SwapChainUtils.h",
|
|
||||||
"src/common/vulkan_platform.h",
|
|
||||||
"src/common/windows_with_undefs.h",
|
|
||||||
]
|
|
||||||
|
|
||||||
configs += [ ":dawn_internal" ]
|
|
||||||
deps = [
|
|
||||||
":dawn_headers",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Dawn headers
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
dawn_generator("dawn_headers_gen") {
|
|
||||||
target = "dawn_headers"
|
|
||||||
outputs = [
|
|
||||||
"dawn/dawncpp.h",
|
|
||||||
"dawn/dawn.h",
|
|
||||||
"dawn/dawncpp_traits.h",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
source_set("dawn_headers") {
|
|
||||||
public_configs = [ ":dawn_public" ]
|
|
||||||
deps = [
|
|
||||||
":dawn_headers_gen",
|
|
||||||
]
|
|
||||||
|
|
||||||
sources = get_target_outputs(":dawn_headers_gen")
|
|
||||||
sources += [
|
|
||||||
"src/include/dawn/EnumClassBitmasks.h",
|
|
||||||
"src/include/dawn/dawn_export.h",
|
|
||||||
"src/include/dawn/dawn_wsi.h",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# libdawn
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
dawn_generator("libdawn_gen") {
|
|
||||||
target = "libdawn"
|
|
||||||
outputs = [
|
|
||||||
"dawn/dawncpp.cpp",
|
|
||||||
"dawn/dawn.c",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
dawn_component("libdawn") {
|
|
||||||
DEFINE_PREFIX = "DAWN"
|
|
||||||
|
|
||||||
public_deps = [
|
|
||||||
":dawn_headers",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps = [
|
|
||||||
":libdawn_gen",
|
|
||||||
]
|
|
||||||
sources = get_target_outputs(":libdawn_gen")
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# libdawn_native
|
# libdawn_native
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
config("libdawn_native_internal") {
|
config("libdawn_native_internal") {
|
||||||
configs = [ ":dawn_internal" ]
|
configs = [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
|
|
||||||
# Suppress warnings that Metal isn't in the deployment target of Chrome
|
# Suppress warnings that Metal isn't in the deployment target of Chrome
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
|
@ -178,9 +48,9 @@ dawn_generator("libdawn_native_utils_gen") {
|
||||||
# dependencies of libdawn_native
|
# dependencies of libdawn_native
|
||||||
source_set("libdawn_native_headers") {
|
source_set("libdawn_native_headers") {
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":dawn_headers",
|
"${dawn_root}/src/dawn:dawn_headers",
|
||||||
]
|
]
|
||||||
public_configs = [ ":dawn_public" ]
|
public_configs = [ "${dawn_root}/src/common:dawn_public" ]
|
||||||
sources = [
|
sources = [
|
||||||
"src/include/dawn_native/DawnNative.h",
|
"src/include/dawn_native/DawnNative.h",
|
||||||
"src/include/dawn_native/dawn_native_export.h",
|
"src/include/dawn_native/dawn_native_export.h",
|
||||||
|
@ -200,9 +70,9 @@ source_set("libdawn_native_headers") {
|
||||||
# except those that define exported symbols.
|
# except those that define exported symbols.
|
||||||
source_set("libdawn_native_sources") {
|
source_set("libdawn_native_sources") {
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
|
||||||
":libdawn_native_headers",
|
":libdawn_native_headers",
|
||||||
":libdawn_native_utils_gen",
|
":libdawn_native_utils_gen",
|
||||||
|
"${dawn_root}/src/common",
|
||||||
"${dawn_spirv_tools_dir}:spvtools_val",
|
"${dawn_spirv_tools_dir}:spvtools_val",
|
||||||
"third_party:spirv_cross",
|
"third_party:spirv_cross",
|
||||||
]
|
]
|
||||||
|
@ -504,8 +374,8 @@ dawn_component("libdawn_native") {
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
|
||||||
":libdawn_native_sources",
|
":libdawn_native_sources",
|
||||||
|
"${dawn_root}/src/common",
|
||||||
]
|
]
|
||||||
sources = [
|
sources = [
|
||||||
"src/dawn_native/DawnNative.cpp",
|
"src/dawn_native/DawnNative.cpp",
|
||||||
|
@ -539,9 +409,9 @@ dawn_component("libdawn_native") {
|
||||||
# dependencies of libdawn_wire
|
# dependencies of libdawn_wire
|
||||||
source_set("libdawn_wire_headers") {
|
source_set("libdawn_wire_headers") {
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":dawn_headers",
|
"${dawn_root}/src/dawn:dawn_headers",
|
||||||
]
|
]
|
||||||
public_configs = [ ":dawn_public" ]
|
public_configs = [ "${dawn_root}/src/common:dawn_public" ]
|
||||||
sources = [
|
sources = [
|
||||||
"src/include/dawn_wire/Wire.h",
|
"src/include/dawn_wire/Wire.h",
|
||||||
"src/include/dawn_wire/WireClient.h",
|
"src/include/dawn_wire/WireClient.h",
|
||||||
|
@ -575,12 +445,12 @@ dawn_component("libdawn_wire") {
|
||||||
DEFINE_PREFIX = "DAWN_WIRE"
|
DEFINE_PREFIX = "DAWN_WIRE"
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
|
||||||
":libdawn_wire_gen",
|
":libdawn_wire_gen",
|
||||||
":libdawn_wire_headers",
|
":libdawn_wire_headers",
|
||||||
|
"${dawn_root}/src/common",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs = [ ":dawn_internal" ]
|
configs = [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
sources = get_target_outputs(":libdawn_wire_gen")
|
sources = get_target_outputs(":libdawn_wire_gen")
|
||||||
sources += [
|
sources += [
|
||||||
"src/dawn_wire/WireClient.cpp",
|
"src/dawn_wire/WireClient.cpp",
|
||||||
|
@ -619,7 +489,7 @@ dawn_component("libdawn_wire") {
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
static_library("dawn_utils") {
|
static_library("dawn_utils") {
|
||||||
configs += [ ":dawn_internal" ]
|
configs += [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"src/utils/BackendBinding.cpp",
|
"src/utils/BackendBinding.cpp",
|
||||||
|
@ -635,13 +505,13 @@ static_library("dawn_utils") {
|
||||||
]
|
]
|
||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":dawn_headers_gen",
|
"${dawn_root}/src/dawn:dawn_headers",
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
|
||||||
":libdawn_native",
|
":libdawn_native",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
|
"${dawn_root}/src/common",
|
||||||
"${dawn_shaderc_dir}:libshaderc",
|
"${dawn_shaderc_dir}:libshaderc",
|
||||||
"third_party:glfw",
|
"third_party:glfw",
|
||||||
]
|
]
|
||||||
|
@ -692,17 +562,16 @@ dawn_generator("mock_dawn_gen") {
|
||||||
}
|
}
|
||||||
|
|
||||||
test("dawn_unittests") {
|
test("dawn_unittests") {
|
||||||
configs += [ ":dawn_internal" ]
|
configs += [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
|
||||||
":dawn_headers",
|
|
||||||
":dawn_utils",
|
":dawn_utils",
|
||||||
":libdawn",
|
|
||||||
":libdawn_native",
|
":libdawn_native",
|
||||||
":libdawn_native_sources",
|
":libdawn_native_sources",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
":mock_dawn_gen",
|
":mock_dawn_gen",
|
||||||
|
"${dawn_root}/src/common",
|
||||||
|
"${dawn_root}/src/dawn:libdawn",
|
||||||
"third_party:gmock_and_gtest",
|
"third_party:gmock_and_gtest",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -768,14 +637,14 @@ test("dawn_unittests") {
|
||||||
}
|
}
|
||||||
|
|
||||||
test("dawn_end2end_tests") {
|
test("dawn_end2end_tests") {
|
||||||
configs += [ ":dawn_internal" ]
|
configs += [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":dawn_common",
|
|
||||||
":dawn_utils",
|
":dawn_utils",
|
||||||
":libdawn",
|
|
||||||
":libdawn_native",
|
":libdawn_native",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
|
"${dawn_root}/src/common",
|
||||||
|
"${dawn_root}/src/dawn:libdawn",
|
||||||
"third_party:glfw",
|
"third_party:glfw",
|
||||||
"third_party:gmock_and_gtest",
|
"third_party:gmock_and_gtest",
|
||||||
]
|
]
|
||||||
|
@ -852,14 +721,14 @@ if (dawn_standalone) {
|
||||||
|
|
||||||
# Export all of these as public deps so that `gn check` allows includes
|
# Export all of these as public deps so that `gn check` allows includes
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":dawn_common",
|
|
||||||
":dawn_utils",
|
":dawn_utils",
|
||||||
":libdawn",
|
|
||||||
":libdawn_native",
|
":libdawn_native",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
|
"${dawn_root}/src/common",
|
||||||
|
"${dawn_root}/src/dawn:libdawn",
|
||||||
"third_party:glfw",
|
"third_party:glfw",
|
||||||
]
|
]
|
||||||
public_configs = [ ":dawn_internal" ]
|
public_configs = [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Template for samples to avoid listing dawn_sample_utils as a dep every time
|
# Template for samples to avoid listing dawn_sample_utils as a dep every time
|
||||||
|
|
|
@ -28,6 +28,9 @@ import("../scripts/dawn_overrides_with_defaults.gni")
|
||||||
# "MyTarget.cpp",
|
# "MyTarget.cpp",
|
||||||
# "MyTarget.h",
|
# "MyTarget.h",
|
||||||
# ]
|
# ]
|
||||||
|
#
|
||||||
|
# # Optional, use a custom generated file directory.
|
||||||
|
# custom_gen_dir = "${target_gen_dir}/.."
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# Using the generated files is done like so:
|
# Using the generated files is done like so:
|
||||||
|
@ -41,11 +44,11 @@ template("dawn_generator") {
|
||||||
# The base arguments for the generator: from this dawn.json, generate this
|
# The base arguments for the generator: from this dawn.json, generate this
|
||||||
# target using templates in this directory.
|
# target using templates in this directory.
|
||||||
generator_args = [
|
generator_args = [
|
||||||
rebase_path("dawn.json", root_build_dir),
|
rebase_path("${dawn_root}/dawn.json", root_build_dir),
|
||||||
"--wire-json",
|
"--wire-json",
|
||||||
rebase_path("dawn_wire.json", root_build_dir),
|
rebase_path("${dawn_root}/dawn_wire.json", root_build_dir),
|
||||||
"--template-dir",
|
"--template-dir",
|
||||||
rebase_path("generator/templates", root_build_dir),
|
rebase_path("${dawn_root}/generator/templates", root_build_dir),
|
||||||
"--targets",
|
"--targets",
|
||||||
invoker.target,
|
invoker.target,
|
||||||
]
|
]
|
||||||
|
@ -58,13 +61,22 @@ template("dawn_generator") {
|
||||||
jinja2_python_path,
|
jinja2_python_path,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Chooses either the default gen_dir or the custom one required by the
|
||||||
|
# invoker. This allows moving the definition of code generators in different
|
||||||
|
# BUILD.gn files without changing the location of generated file. Without
|
||||||
|
# this generated headers could cause issues when old headers aren't removed.
|
||||||
|
gen_dir = target_gen_dir
|
||||||
|
if (defined(invoker.custom_gen_dir)) {
|
||||||
|
gen_dir = invoker.custom_gen_dir
|
||||||
|
}
|
||||||
|
|
||||||
# For build parallelism GN wants to know the exact inputs and outputs of
|
# For build parallelism GN wants to know the exact inputs and outputs of
|
||||||
# action targets like we use for our code generator. We avoid asking the
|
# action targets like we use for our code generator. We avoid asking the
|
||||||
# generator about its inputs by using the "depfile" feature of GN/Ninja.
|
# generator about its inputs by using the "depfile" feature of GN/Ninja.
|
||||||
#
|
#
|
||||||
# A ninja limitation is that the depfile is a subset of Makefile that can
|
# A ninja limitation is that the depfile is a subset of Makefile that can
|
||||||
# contain a single target, so we output a single "JSON-tarball" instead.
|
# contain a single target, so we output a single "JSON-tarball" instead.
|
||||||
json_tarball = "${target_gen_dir}/${target_name}.json_tarball"
|
json_tarball = "${gen_dir}/${target_name}.json_tarball"
|
||||||
json_tarball_depfile = "${json_tarball}.d"
|
json_tarball_depfile = "${json_tarball}.d"
|
||||||
|
|
||||||
generator_args += [
|
generator_args += [
|
||||||
|
@ -79,7 +91,7 @@ template("dawn_generator") {
|
||||||
# outputs. To make sure the list is in sync between the generator and the
|
# outputs. To make sure the list is in sync between the generator and the
|
||||||
# build files, we write it to a file and ask the generator to assert it is
|
# build files, we write it to a file and ask the generator to assert it is
|
||||||
# correct.
|
# correct.
|
||||||
expected_outputs_file = "${target_gen_dir}/${target_name}.expected_outputs"
|
expected_outputs_file = "${gen_dir}/${target_name}.expected_outputs"
|
||||||
write_file(expected_outputs_file, invoker.outputs)
|
write_file(expected_outputs_file, invoker.outputs)
|
||||||
|
|
||||||
generator_args += [
|
generator_args += [
|
||||||
|
@ -90,7 +102,7 @@ template("dawn_generator") {
|
||||||
# The code generator invocation that will write the JSON tarball, check the
|
# The code generator invocation that will write the JSON tarball, check the
|
||||||
# outputs are what's expected and write a depfile for Ninja.
|
# outputs are what's expected and write a depfile for Ninja.
|
||||||
action("${target_name}_json_tarball") {
|
action("${target_name}_json_tarball") {
|
||||||
script = "generator/main.py"
|
script = "${dawn_root}/generator/main.py"
|
||||||
outputs = [
|
outputs = [
|
||||||
json_tarball,
|
json_tarball,
|
||||||
]
|
]
|
||||||
|
@ -98,12 +110,12 @@ template("dawn_generator") {
|
||||||
args = generator_args
|
args = generator_args
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract the JSON tarball into the target_gen_dir
|
# Extract the JSON tarball into the gen_dir
|
||||||
action("${target_name}") {
|
action("${target_name}") {
|
||||||
script = "generator/extract_json.py"
|
script = "${dawn_root}/generator/extract_json.py"
|
||||||
args = [
|
args = [
|
||||||
rebase_path(json_tarball, root_build_dir),
|
rebase_path(json_tarball, root_build_dir),
|
||||||
rebase_path(target_gen_dir, root_build_dir),
|
rebase_path(gen_dir, root_build_dir),
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
@ -113,11 +125,11 @@ template("dawn_generator") {
|
||||||
json_tarball,
|
json_tarball,
|
||||||
]
|
]
|
||||||
|
|
||||||
# The expected output list is relative to the target_gen_dir but action
|
# The expected output list is relative to the gen_dir but action
|
||||||
# target outputs are from the root dir so we need to rebase them.
|
# target outputs are from the root dir so we need to rebase them.
|
||||||
outputs = []
|
outputs = []
|
||||||
foreach(source, invoker.outputs) {
|
foreach(source, invoker.outputs) {
|
||||||
outputs += [ "${target_gen_dir}/${source}" ]
|
outputs += [ "${gen_dir}/${source}" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
//* See the License for the specific language governing permissions and
|
//* See the License for the specific language governing permissions and
|
||||||
//* limitations under the License.
|
//* limitations under the License.
|
||||||
|
|
||||||
#include "dawncpp.h"
|
#include "dawn/dawncpp.h"
|
||||||
|
|
||||||
namespace dawn {
|
namespace dawn {
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,13 @@ template("dawn_component") {
|
||||||
defines = []
|
defines = []
|
||||||
}
|
}
|
||||||
defines += [ "${invoker.DEFINE_PREFIX}_IMPLEMENTATION" ]
|
defines += [ "${invoker.DEFINE_PREFIX}_IMPLEMENTATION" ]
|
||||||
|
|
||||||
|
# TODO(cwallez@chromium.org): Remove this when we are sure the bots have
|
||||||
|
# been clobbered. This is necessary because when moving generated files
|
||||||
|
# around we ended up with bad generated files in cached build
|
||||||
|
# directories that get picked up because of the default inclusion of
|
||||||
|
# target_gen_dir as an include directory.
|
||||||
|
configs -= [ "//build/config/compiler:default_include_dirs" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
static_library("${libname}_static") {
|
static_library("${libname}_static") {
|
||||||
|
@ -107,6 +114,13 @@ template("dawn_component") {
|
||||||
if (defined(invoker.configs)) {
|
if (defined(invoker.configs)) {
|
||||||
configs += invoker.configs
|
configs += invoker.configs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO(cwallez@chromium.org): Remove this when we are sure the bots have
|
||||||
|
# been clobbered. This is necessary because when moving generated files
|
||||||
|
# around we ended up with bad generated files in cached build
|
||||||
|
# directories that get picked up because of the default inclusion of
|
||||||
|
# target_gen_dir as an include directory.
|
||||||
|
configs -= [ "//build/config/compiler:default_include_dirs" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
group(libname) {
|
group(libname) {
|
||||||
|
|
|
@ -24,6 +24,10 @@ if (!defined(dawn_standalone)) {
|
||||||
dawn_standalone = false
|
dawn_standalone = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!defined(dawn_root)) {
|
||||||
|
dawn_root = get_path_info("..", "abspath")
|
||||||
|
}
|
||||||
|
|
||||||
if (!defined(dawn_jinja2_dir)) {
|
if (!defined(dawn_jinja2_dir)) {
|
||||||
dawn_jinja2_dir = "//third_party/jinja2"
|
dawn_jinja2_dir = "//third_party/jinja2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Common dawn configs
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
config("dawn_public") {
|
||||||
|
include_dirs = [
|
||||||
|
"${target_gen_dir}/../..",
|
||||||
|
"${dawn_root}/src/include"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
config("dawn_internal") {
|
||||||
|
include_dirs = [ "${dawn_root}/src" ]
|
||||||
|
|
||||||
|
defines = []
|
||||||
|
if (dawn_always_assert || dcheck_always_on || is_debug) {
|
||||||
|
defines += [ "DAWN_ENABLE_ASSERTS" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
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" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
configs = [ ":dawn_public" ]
|
||||||
|
|
||||||
|
# Only internal Dawn targets can use this config, this means only targets in
|
||||||
|
# this BUILD.gn file.
|
||||||
|
visibility = [ ":*" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Common dawn library
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
static_library("common") {
|
||||||
|
sources = [
|
||||||
|
"Assert.cpp",
|
||||||
|
"Assert.h",
|
||||||
|
"BitSetIterator.h",
|
||||||
|
"Compiler.h",
|
||||||
|
"DynamicLib.cpp",
|
||||||
|
"DynamicLib.h",
|
||||||
|
"HashUtils.h",
|
||||||
|
"Math.cpp",
|
||||||
|
"Math.h",
|
||||||
|
"Platform.h",
|
||||||
|
"Result.h",
|
||||||
|
"Serial.h",
|
||||||
|
"SerialMap.h",
|
||||||
|
"SerialQueue.h",
|
||||||
|
"SerialStorage.h",
|
||||||
|
"SwapChainUtils.h",
|
||||||
|
"vulkan_platform.h",
|
||||||
|
"windows_with_undefs.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
configs += [ ":dawn_internal" ]
|
||||||
|
deps = [
|
||||||
|
"${dawn_root}/src/dawn:dawn_headers",
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
# 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("${dawn_root}/scripts/dawn_component.gni")
|
||||||
|
import("${dawn_root}/generator/dawn_generator.gni")
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Dawn headers
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
dawn_generator("dawn_headers_gen") {
|
||||||
|
target = "dawn_headers"
|
||||||
|
|
||||||
|
# Generate as if we were in the main BUILD.gn because that was historically
|
||||||
|
# the case and we can't move generated files without clobbering the build.
|
||||||
|
custom_gen_dir = "${target_gen_dir}/../.."
|
||||||
|
outputs = [
|
||||||
|
"dawn/dawncpp.h",
|
||||||
|
"dawn/dawn.h",
|
||||||
|
"dawn/dawncpp_traits.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
source_set("dawn_headers") {
|
||||||
|
public_configs = [ "${dawn_root}/src/common:dawn_public" ]
|
||||||
|
deps = [
|
||||||
|
":dawn_headers_gen",
|
||||||
|
]
|
||||||
|
|
||||||
|
sources = get_target_outputs(":dawn_headers_gen")
|
||||||
|
sources += [
|
||||||
|
"${dawn_root}/src/include/dawn/EnumClassBitmasks.h",
|
||||||
|
"${dawn_root}/src/include/dawn/dawn_export.h",
|
||||||
|
"${dawn_root}/src/include/dawn/dawn_wsi.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# libdawn
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
dawn_generator("libdawn_gen") {
|
||||||
|
target = "libdawn"
|
||||||
|
outputs = [
|
||||||
|
"dawn/dawncpp.cpp",
|
||||||
|
"dawn/dawn.c",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_component("libdawn") {
|
||||||
|
DEFINE_PREFIX = "DAWN"
|
||||||
|
|
||||||
|
public_deps = [
|
||||||
|
":dawn_headers",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
":libdawn_gen",
|
||||||
|
]
|
||||||
|
sources = get_target_outputs(":libdawn_gen")
|
||||||
|
}
|
|
@ -15,8 +15,6 @@
|
||||||
import("../../scripts/dawn_overrides_with_defaults.gni")
|
import("../../scripts/dawn_overrides_with_defaults.gni")
|
||||||
import("//build_overrides/build.gni")
|
import("//build_overrides/build.gni")
|
||||||
|
|
||||||
dawn_top_level = "../.."
|
|
||||||
|
|
||||||
# We only have libfuzzer in Chromium builds but if we build fuzzer targets only
|
# We only have libfuzzer in Chromium builds but if we build fuzzer targets only
|
||||||
# there, we would risk breaking fuzzer targets all the time when making changes
|
# there, we would risk breaking fuzzer targets all the time when making changes
|
||||||
# to Dawn. To avoid that, we make fuzzer targets compile in standalone builds
|
# to Dawn. To avoid that, we make fuzzer targets compile in standalone builds
|
||||||
|
@ -165,11 +163,11 @@ dawn_fuzzer_test("dawn_wire_server_and_frontend_fuzzer") {
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"${dawn_top_level}:dawn_common",
|
"${dawn_root}/:libdawn_native_static",
|
||||||
"${dawn_top_level}:libdawn_native_static",
|
"${dawn_root}/:libdawn_wire_static",
|
||||||
"${dawn_top_level}:libdawn_static",
|
"${dawn_root}/src/common",
|
||||||
"${dawn_top_level}:libdawn_wire_static",
|
"${dawn_root}/src/dawn:libdawn_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
additional_configs = [ "${dawn_top_level}:dawn_internal" ]
|
additional_configs = [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue