Skip to content

Commit

Permalink
[tint][gn] Only build 'cmd' targets when 'tint_standalone'
Browse files Browse the repository at this point in the history
Chromium builds all the targets it can find. We have build failures when targeting ios.
We don't need to build the tint executables in regular chromium builds, so just disable them.

Change-Id: I42a92e19ce483fcd0cba92222d4850a73ffd517b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/155701
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
  • Loading branch information
ben-clayton authored and Dawn LUCI CQ committed Oct 11, 2023
1 parent fc9b2c4 commit 49a564c
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 14 deletions.
5 changes: 1 addition & 4 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@ group("all") {
testonly = true
deps = [
":benchmarks",
":cmds",
":fuzzers",
":libs",
":tests",
]

if (dawn_standalone) {
deps += [ ":cmds" ]
}
}

# This target is built when no specific target is specified on the command line.
Expand Down
1 change: 1 addition & 0 deletions build_overrides/tint.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

# True if Tint can access build/, testing/ and other Chrome folders.
tint_standalone = true
tint_has_build = true

tint_spirv_tools_dir = "//third_party/vulkan-deps/spirv-tools/src"
Expand Down
12 changes: 12 additions & 0 deletions scripts/tint_overrides_with_defaults.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ import("//build_overrides/tint.gni")

# This file contains Tint-related build flags.

if (!defined(tint_standalone)) {
if (defined(dawn_standalone)) {
tint_standalone = dawn_standalone
} else {
tint_standalone = false
}
}

if (!defined(tint_has_build)) {
tint_has_build = true
}
Expand Down Expand Up @@ -48,6 +56,10 @@ declare_args() {
tint_spirv_headers_dir = "//third_party/vulkan-deps/spirv-headers/src"
}

if (!defined(tint_build_cmds)) {
tint_build_cmds = tint_standalone
}

# Build the SPIR-V input reader
if (!defined(tint_build_spv_reader)) {
tint_build_spv_reader = true
Expand Down
9 changes: 6 additions & 3 deletions src/tint/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,12 @@ group("libs") {
}

group("cmds") {
deps = [ "${tint_src_dir}/cmd/tint" ]
if (dawn_standalone) {
deps += [ "${tint_src_dir}/cmd/remote_compile" ]
deps = []
if (tint_build_cmds) {
deps += [
"${tint_src_dir}/cmd/remote_compile",
"${tint_src_dir}/cmd/tint",
]
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/tint/cmd/info/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import("../../../../scripts/tint_overrides_with_defaults.gni")

import("${tint_src_dir}/tint.gni")

executable("info") {
tint_executable("info") {
output_name = "tint_info"
sources = [ "main.cc" ]
deps = [
Expand Down
2 changes: 1 addition & 1 deletion src/tint/cmd/loopy/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import("../../../../scripts/tint_overrides_with_defaults.gni")

import("${tint_src_dir}/tint.gni")

executable("loopy") {
tint_executable("loopy") {
output_name = "tint_loopy"
sources = [ "main.cc" ]
deps = [
Expand Down
2 changes: 1 addition & 1 deletion src/tint/cmd/remote_compile/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import("../../../../scripts/tint_overrides_with_defaults.gni")

import("${tint_src_dir}/tint.gni")

executable("remote_compile") {
tint_executable("remote_compile") {
output_name = "tint_remote_compile"
sources = [ "main.cc" ]
deps = [
Expand Down
2 changes: 1 addition & 1 deletion src/tint/cmd/tint/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import("../../../../scripts/tint_overrides_with_defaults.gni")

import("${tint_src_dir}/tint.gni")

executable("tint") {
tint_executable("tint") {
output_name = "tint"
sources = [ "main.cc" ]
deps = [
Expand Down
15 changes: 13 additions & 2 deletions src/tint/tint.gni
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ template("libtint_source_set") {
}

###############################################################################
# Unit tests
# Executables - only built when tint_build_cmds is enabled
###############################################################################
template("tint_executable") {
if (tint_build_cmds) {
source_set(target_name) {
forward_variables_from(invoker, "*")
}
}
}

###############################################################################
# Unit tests - only built when tint_build_unittests is enabled
###############################################################################
template("tint_unittests_source_set") {
if (tint_build_unittests) {
Expand Down Expand Up @@ -74,7 +85,7 @@ template("tint_unittests_source_set") {
}

###############################################################################
# Fuzzers
# Fuzzers - only built when tint_has_fuzzers is enabled
###############################################################################
if (tint_has_fuzzers) {
import("//testing/libfuzzer/fuzzer_test.gni")
Expand Down
2 changes: 1 addition & 1 deletion tools/src/cmd/gen/build/BUILD.gn.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if({{$.Condition}}) {
{{ if $.Kind.IsLib -}}
libtint_source_set("{{$.Directory.Name}}") {
{{- else if $.Kind.IsCmd -}}
executable("{{$.Directory.Name}}") {
tint_executable("{{$.Directory.Name}}") {
{{- else if $.Kind.IsTest -}}
tint_unittests_source_set("unittests") {
{{- else if $.Kind.IsBench -}}
Expand Down

0 comments on commit 49a564c

Please sign in to comment.