blob: 96ae72fbe9c8fb384ef1587bf73a1c6f7a936ef9 [file] [log] [blame]
Corentin Wallezb31015b2020-04-10 08:20:10 +00001# Copyright 2020 The Dawn Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("../scripts/dawn_overrides_with_defaults.gni")
16
17group("dawn_samples") {
18 deps = [
19 ":Animometer",
20 ":CHelloTriangle",
21 ":ComputeBoids",
22 ":CppHelloTriangle",
23 ":CubeReflection",
24 ":ManualSwapChainTest",
25 ]
26}
27
28# Static library to contain code and dependencies common to all samples
29static_library("dawn_sample_utils") {
30 sources = [
31 "SampleUtils.cpp",
32 "SampleUtils.h",
33 ]
34
35 # Export all of these as public deps so that `gn check` allows includes
36 public_deps = [
37 "${dawn_root}/src/common",
Corentin Wallez797fa622020-04-14 17:36:44 +000038 "${dawn_root}/src/dawn:dawn_proc",
Corentin Wallezb31015b2020-04-10 08:20:10 +000039 "${dawn_root}/src/dawn:dawncpp",
Corentin Wallezb31015b2020-04-10 08:20:10 +000040 "${dawn_root}/src/dawn_native",
41 "${dawn_root}/src/dawn_wire",
42 "${dawn_root}/src/utils:dawn_bindings",
43 "${dawn_root}/src/utils:dawn_glfw",
44 "${dawn_root}/src/utils:dawn_utils",
45 ]
46 public_configs = [ "${dawn_root}/src/common:dawn_internal" ]
47}
48
49# Template for samples to avoid listing dawn_sample_utils as a dep every time
50template("dawn_sample") {
51 executable(target_name) {
Kai Ninomiya2afea0c2020-07-10 20:33:08 +000052 deps = [ ":dawn_sample_utils" ]
Corentin Wallezb31015b2020-04-10 08:20:10 +000053 forward_variables_from(invoker, "*", [ "deps" ])
54
55 if (defined(invoker.deps)) {
56 deps += invoker.deps
57 }
58 }
59}
60
61dawn_sample("CppHelloTriangle") {
Kai Ninomiya2afea0c2020-07-10 20:33:08 +000062 sources = [ "CppHelloTriangle.cpp" ]
Corentin Wallezb31015b2020-04-10 08:20:10 +000063}
64
65dawn_sample("CHelloTriangle") {
Kai Ninomiya2afea0c2020-07-10 20:33:08 +000066 sources = [ "CHelloTriangle.cpp" ]
Corentin Wallezb31015b2020-04-10 08:20:10 +000067}
68
69dawn_sample("ComputeBoids") {
Kai Ninomiya2afea0c2020-07-10 20:33:08 +000070 sources = [ "ComputeBoids.cpp" ]
71 deps = [ "${dawn_root}/third_party/gn/glm" ]
Corentin Wallezb31015b2020-04-10 08:20:10 +000072}
73
74dawn_sample("Animometer") {
Kai Ninomiya2afea0c2020-07-10 20:33:08 +000075 sources = [ "Animometer.cpp" ]
Corentin Wallezb31015b2020-04-10 08:20:10 +000076}
77
78dawn_sample("CubeReflection") {
Kai Ninomiya2afea0c2020-07-10 20:33:08 +000079 sources = [ "CubeReflection.cpp" ]
80 deps = [ "${dawn_root}/third_party/gn/glm" ]
Corentin Wallezb31015b2020-04-10 08:20:10 +000081}
82
83dawn_sample("ManualSwapChainTest") {
Kai Ninomiya2afea0c2020-07-10 20:33:08 +000084 sources = [ "ManualSwapChainTest.cpp" ]
Corentin Wallezb31015b2020-04-10 08:20:10 +000085}