1# Copyright 2017 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("../gni/angle.gni") 6 7declare_args() { 8 # Determines if we build the capture_replay sample. Off by default. 9 angle_build_capture_replay_sample = false 10 11 # Decide which context to replay, starting with desktop default 12 angle_capture_replay_sample_context_id = 1 13} 14 15config("sample_util_config") { 16 include_dirs = [ "sample_util" ] 17} 18 19angle_source_set("sample_util") { 20 testonly = true 21 sources = [ 22 "sample_util/SampleApplication.cpp", 23 "sample_util/SampleApplication.h", 24 "sample_util/texture_utils.cpp", 25 "sample_util/texture_utils.h", 26 "sample_util/tga_utils.cpp", 27 "sample_util/tga_utils.h", 28 ] 29 data_deps = [ 30 "../:libEGL", 31 "../:libGLESv1_CM", 32 "../:libGLESv2", 33 ] 34 public_deps = [ 35 "../:angle_common", 36 "../util:angle_test_utils", 37 "../util:angle_util", 38 "../util:angle_util_loader_headers", 39 ] 40 configs += [ "../:library_name_config" ] 41 public_configs = [ 42 ":sample_util_config", 43 "../:no_gl_prototypes", 44 ] 45} 46 47template("angle_sample") { 48 if (defined(invoker.data)) { 49 copy(target_name + "_data") { 50 sources = invoker.data 51 outputs = [ "$root_out_dir/{{source_file_part}}" ] 52 } 53 } 54 55 angle_executable(target_name) { 56 testonly = true 57 forward_variables_from(invoker, 58 [ 59 "cflags", 60 "data", 61 "defines", 62 "deps", 63 "sources", 64 ]) 65 deps += [ ":sample_util" ] 66 if (defined(invoker.data)) { 67 deps += [ ":${target_name}_data" ] 68 } 69 70 if (defined(invoker.configs)) { 71 configs += invoker.configs 72 } 73 74 if (defined(invoker.suppressed_configs)) { 75 suppressed_configs += invoker.suppressed_configs 76 } 77 78 if ((is_linux || is_chromeos) && !is_component_build) { 79 # Set rpath to find shared libs in a non-component build. 80 configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] 81 } 82 } 83} 84 85set_defaults("angle_sample") { 86 deps = [] 87} 88 89angle_sample("hello_triangle") { 90 sources = [ "hello_triangle/HelloTriangle.cpp" ] 91} 92 93angle_sample("mip_map_2d") { 94 sources = [ "mip_map_2d/MipMap2D.cpp" ] 95} 96 97angle_sample("multi_texture") { 98 sources = [ "multi_texture/MultiTexture.cpp" ] 99 data = [ 100 "multi_texture/basemap.tga", 101 "multi_texture/lightmap.tga", 102 ] 103} 104 105angle_sample("multi_window") { 106 sources = [ "multi_window/MultiWindow.cpp" ] 107} 108 109angle_sample("multiple_draw_buffers") { 110 sources = [ "multiple_draw_buffers/MultipleDrawBuffers.cpp" ] 111 data = [ 112 "multiple_draw_buffers/multiple_draw_buffers_copy_fs.glsl", 113 "multiple_draw_buffers/multiple_draw_buffers_fs.glsl", 114 "multiple_draw_buffers/multiple_draw_buffers_vs.glsl", 115 ] 116} 117 118angle_sample("multiview") { 119 sources = [ "multiview/Multiview.cpp" ] 120} 121 122angle_sample("particle_system") { 123 sources = [ "particle_system/ParticleSystem.cpp" ] 124 data = [ "particle_system/smoke.tga" ] 125} 126 127angle_sample("post_sub_buffer") { 128 sources = [ "post_sub_buffer/PostSubBuffer.cpp" ] 129} 130 131angle_sample("simple_instancing") { 132 sources = [ "simple_instancing/SimpleInstancing.cpp" ] 133} 134 135angle_sample("simple_texture_2d") { 136 sources = [ "simple_texture_2d/SimpleTexture2D.cpp" ] 137} 138 139angle_sample("simple_texture_cubemap") { 140 sources = [ "simple_texture_cubemap/SimpleTextureCubemap.cpp" ] 141} 142 143angle_sample("simple_vertex_shader") { 144 sources = [ "simple_vertex_shader/SimpleVertexShader.cpp" ] 145} 146 147angle_sample("stencil_operations") { 148 sources = [ "stencil_operations/StencilOperations.cpp" ] 149} 150 151angle_sample("tex_redef_microbench") { 152 sources = [ "tex_redef_microbench/TexRedefMicroBench.cpp" ] 153} 154 155angle_sample("texture_wrap") { 156 sources = [ "texture_wrap/TextureWrap.cpp" ] 157} 158 159angle_sample("tri_fan_microbench") { 160 sources = [ "tri_fan_microbench/TriFanMicroBench.cpp" ] 161} 162 163angle_sample("window_test") { 164 sources = [ "WindowTest/WindowTest.cpp" ] 165} 166 167angle_sample("gles1_hello_triangle") { 168 sources = [ "gles1/HelloTriangle.cpp" ] 169} 170 171angle_sample("gles1_simple_texture_2d") { 172 sources = [ "gles1/SimpleTexture2D.cpp" ] 173} 174 175angle_sample("gles1_simple_lighting") { 176 sources = [ "gles1/SimpleLighting.cpp" ] 177} 178 179angle_sample("gles1_flat_shading") { 180 sources = [ "gles1/FlatShading.cpp" ] 181} 182 183angle_sample("gles1_draw_texture") { 184 sources = [ "gles1/DrawTexture.cpp" ] 185} 186 187angle_sample("gles1_torus_lighting") { 188 sources = [ 189 "torus_lighting/TorusLightingES1.cpp", 190 "torus_lighting/torus.h", 191 ] 192} 193 194angle_sample("gles2_torus_lighting") { 195 sources = [ 196 "torus_lighting/TorusLightingES2.cpp", 197 "torus_lighting/torus.h", 198 ] 199} 200 201angle_sample("gles3_torus_bufferstorage") { 202 sources = [ 203 "torus_lighting/TorusBufferStorage.cpp", 204 "torus_lighting/torus.h", 205 ] 206} 207 208angle_sample("multiple_contexts") { 209 sources = [ "multiple_contexts/MultipleContexts.cpp" ] 210} 211 212if (angle_build_capture_replay_sample) { 213 angle_sample("capture_replay_sample") { 214 sources = [ "capture_replay/CaptureReplay.cpp" ] 215 216 deps = [ 217 "$angle_root:angle_compression", 218 "$angle_root/util:angle_frame_capture_test_utils", 219 "capture_replay:capture_replay_sample_trace", 220 ] 221 222 _data_path = rebase_path("capture_replay", root_out_dir) 223 defines = [ "ANGLE_CAPTURE_REPLAY_SAMPLE_DATA_DIR=\"${_data_path}\"" ] 224 225 suppressed_configs = [ "$angle_root:constructor_and_destructor_warnings" ] 226 configs = [] 227 228 # Disable optimization to avoid optimizing huge files. 229 if (!is_debug) { 230 suppressed_configs += [ "//build/config/compiler:default_optimization" ] 231 configs += [ "//build/config/compiler:no_optimize" ] 232 } 233 } 234} 235 236group("angle_samples") { 237 testonly = true 238 deps = [] 239 if (!is_ios) { 240 deps += [ 241 ":gles1_draw_texture", 242 ":gles1_flat_shading", 243 ":gles1_hello_triangle", 244 ":gles1_simple_lighting", 245 ":gles1_simple_texture_2d", 246 ":gles1_torus_lighting", 247 ":gles2_torus_lighting", 248 ":gles3_torus_bufferstorage", 249 ":hello_triangle", 250 ":mip_map_2d", 251 ":multi_texture", 252 ":multi_window", 253 ":multiple_contexts", 254 ":multiple_draw_buffers", 255 ":multiview", 256 ":particle_system", 257 ":post_sub_buffer", 258 ":sample_util", 259 ":simple_instancing", 260 ":simple_texture_2d", 261 ":simple_texture_cubemap", 262 ":simple_vertex_shader", 263 ":stencil_operations", 264 ":tex_redef_microbench", 265 ":texture_wrap", 266 ":tri_fan_microbench", 267 ":window_test", 268 ] 269 } 270} 271