mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
Revert "Create new src/tests BUILD.gn file."
This reverts commit 672d29d14c.
Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=913171
Original change's description:
> Create new src/tests BUILD.gn file.
>
> Move all test-related build stuff into its own BUILD.gn file. This
> required moving the dawn_generator template into a common file, so it
> can be called by both BUILD.gn and src/tests/BUILD.gn.
>
> [This is a reland of https://dawn-review.googlesource.com/c/dawn/+/2940
> with a fix for mock_dawn.]
>
> Bug: dawn:61
> Change-Id: Id1e6d0c2b07caa2610cebe206511e972ac18fe8d
> Reviewed-on: https://dawn-review.googlesource.com/c/3020
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Stephen White <senorblanco@chromium.org>
TBR=cwallez@chromium.org,kainino@chromium.org,senorblanco@chromium.org
Change-Id: I54cdc558b128935dc8a8d22ec2b5e879271c35ae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:61
Reviewed-on: https://dawn-review.googlesource.com/c/3080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
672d29d14c
commit
48a1923afb
@@ -1,122 +0,0 @@
|
||||
# Copyright 2018 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("//build_overrides/dawn.gni")
|
||||
import("../scripts/dawn_overrides_with_defaults.gni")
|
||||
|
||||
###############################################################################
|
||||
# Template to wrap the Dawn code generator
|
||||
###############################################################################
|
||||
|
||||
# Template to help with invocation of the Dawn code generator, looks like this:
|
||||
#
|
||||
# dawn_generator("my_target_gen") {
|
||||
# # Which generator target to output
|
||||
# target = "my_target"
|
||||
# # The list of expected outputs, generation fails if there's a mismatch
|
||||
# outputs = [
|
||||
# "MyTarget.cpp",
|
||||
# "MyTarget.h",
|
||||
# ]
|
||||
# }
|
||||
#
|
||||
# Using the generated files is done like so:
|
||||
#
|
||||
# shared_library("my_target") {
|
||||
# deps = [ ":my_target_gen "]
|
||||
# sources = get_target_outputs(":my_target_gen")
|
||||
# }
|
||||
#
|
||||
template("dawn_generator") {
|
||||
# The base arguments for the generator: from this dawn.json, generate this
|
||||
# target using templates in this directory.
|
||||
generator_args = [
|
||||
rebase_path("${dawn_root}/dawn.json", root_build_dir),
|
||||
"--template-dir",
|
||||
rebase_path("${dawn_root}/generator/templates", root_build_dir),
|
||||
"--targets",
|
||||
invoker.target,
|
||||
]
|
||||
|
||||
# Use the Jinja2 version pulled from the DEPS file. We do it so we don't
|
||||
# have version problems, and users don't have to install Jinja2.
|
||||
jinja2_python_path = rebase_path("${dawn_jinja2_dir}/..")
|
||||
generator_args += [
|
||||
"--extra-python-path",
|
||||
jinja2_python_path,
|
||||
]
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# contain a single target, so we output a single "JSON-tarball" instead.
|
||||
json_tarball = "${target_gen_dir}/${target_name}.json_tarball"
|
||||
json_tarball_depfile = "${json_tarball}.d"
|
||||
|
||||
generator_args += [
|
||||
"--output-json-tarball",
|
||||
rebase_path(json_tarball, root_build_dir),
|
||||
"--depfile",
|
||||
rebase_path(json_tarball_depfile, root_build_dir),
|
||||
]
|
||||
|
||||
# After the JSON tarball is created we need an action target to extract it
|
||||
# with a list of its outputs. The invoker provided a list of expected
|
||||
# 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
|
||||
# correct.
|
||||
expected_outputs_file = "${target_gen_dir}/${target_name}.expected_outputs"
|
||||
write_file(expected_outputs_file, invoker.outputs)
|
||||
|
||||
generator_args += [
|
||||
"--expected-outputs-file",
|
||||
rebase_path(expected_outputs_file, root_build_dir),
|
||||
]
|
||||
|
||||
# The code generator invocation that will write the JSON tarball, check the
|
||||
# outputs are what's expected and write a depfile for Ninja.
|
||||
action("${target_name}_json_tarball") {
|
||||
script = "${dawn_root}/generator/main.py"
|
||||
outputs = [
|
||||
json_tarball,
|
||||
]
|
||||
depfile = json_tarball_depfile
|
||||
args = generator_args
|
||||
}
|
||||
|
||||
# Extract the JSON tarball into the target_gen_dir
|
||||
action("${target_name}") {
|
||||
script = "${dawn_root}/generator/extract_json.py"
|
||||
args = [
|
||||
rebase_path(json_tarball, root_build_dir),
|
||||
rebase_path(target_gen_dir, root_build_dir),
|
||||
]
|
||||
|
||||
deps = [
|
||||
":${target_name}_json_tarball",
|
||||
]
|
||||
inputs = [
|
||||
json_tarball,
|
||||
]
|
||||
|
||||
# The expected output list is relative to the target_gen_dir but action
|
||||
# target outputs are from the root dir so we need to rebase them.
|
||||
outputs = []
|
||||
foreach(source, invoker.outputs) {
|
||||
outputs += [ "${target_gen_dir}/${source}" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -450,8 +450,8 @@ def get_renders_for_targets(api_params, targets):
|
||||
renders.append(FileRender('apicpp.cpp', 'dawn/dawncpp.cpp', [base_params, api_params, cpp_params]))
|
||||
|
||||
if 'mock_dawn' in targets:
|
||||
renders.append(FileRender('mock_api.h', 'mock/mock_dawn_.h', [base_params, api_params, c_params]))
|
||||
renders.append(FileRender('mock_api.cpp', 'mock/mock_dawn_.cpp', [base_params, api_params, c_params]))
|
||||
renders.append(FileRender('mock_api.h', 'mock/mock_dawn.h', [base_params, api_params, c_params]))
|
||||
renders.append(FileRender('mock_api.cpp', 'mock/mock_dawn.cpp', [base_params, api_params, c_params]))
|
||||
|
||||
if 'dawn_native_utils' in targets:
|
||||
frontend_params = [
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
#include "mock_dawn_.h"
|
||||
#include "mock_dawn.h"
|
||||
|
||||
namespace {
|
||||
{% for type in by_category["object"] %}
|
||||
|
||||
Reference in New Issue
Block a user