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