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