| # Copyright 2016 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/test.gni") |
| |
| if (is_mac) { |
| test("escher_unittests") { |
| # Escher cannot be built on macOS, as the latter does not |
| # support Vulkan. So that we may include Escher host tests in |
| # the default build, we substitute in a dummy no-op test in the |
| # case of a mac build. |
| sources = [ |
| "no_op_mac_unittest.cc", |
| ] |
| deps = [ |
| "//third_party/googletest:gtest_main", |
| ] |
| } |
| } else { |
| test("escher_unittests") { |
| sources = [ |
| "fake_gpu_allocator.cc", |
| "fs/hack_filesystem_unittest.cc", |
| "geometry/bounding_box_unittest.cc", |
| "geometry/clip_planes_unittest.cc", |
| "geometry/indexed_triangle_mesh_clip_unittest.cc", |
| "geometry/plane_unittest.cc", |
| "gpu_allocator_unittest.cc", |
| "gpu_mem_unittest.cc", |
| "impl/glsl_compiler_unittest.cc", |
| "impl/image_cache_unittest.cc", |
| "impl/pipeline_cache_unittest.cc", |
| "math/rotations_unittest.cc", |
| "mesh_spec_unittest.cc", |
| "object_unittest.cc", |
| "paper/paper_draw_call_factory_unittest.cc", |
| "paper/paper_shape_cache_unittest.cc", |
| "paper/paper_transform_stack_unittest.cc", |
| "pose_buffer_latching_test.cc", |
| "renderer/batch_gpu_uploader_unittest.cc", |
| "renderer/buffer_cache_unittest.cc", |
| "renderer/frame_unittest.cc", |
| "renderer/render_queue_unittest.cc", |
| "run_all_unittests.cc", |
| "scene/directional_light_unittest.cc", |
| "shape/rounded_rect_factory_unittest.cc", |
| "shape/rounded_rect_unittest.cc", |
| "transform_unittest.cc", |
| "util/align_unittest.cc", |
| "util/bit_ops_unittest.cc", |
| "util/bitmap_unittest.cc", |
| "util/block_allocator_unittest.cc", |
| "util/enum_utils_unittest.cc", |
| "util/hash_cache_unittest.cc", |
| "util/hash_unittest.cc", |
| "util/hashable_unittest.cc", |
| "util/hashmap_unittest.cc", |
| "util/intrusive_list_unittest.cc", |
| "util/object_pool_unittest.cc", |
| "util/stack_allocator_unittest.cc", |
| "vk/buffer_unittest.cc", |
| "vk/command_buffer_unittest.cc", |
| "vk/descriptor_set_allocator_unittest.cc", |
| "vk/descriptor_set_layout_unittest.cc", |
| "vk/framebuffer_allocator_unittest.cc", |
| "vk/render_pass_cache_unittest.cc", |
| "vk/shader_module_template_unittest.cc", |
| "vk/shader_program_unittest.cc", |
| "vk/vulkan_tester.h", |
| "vk/vulkan_utils_unittest.cc", |
| ] |
| |
| deps = [ |
| ":force_waterfall_to_build_on_host", |
| ":gtest_escher", |
| "base:base_unittests", |
| "//garnet/public/lib/fxl", |
| "//third_party/googletest:gmock", |
| "//third_party/shaderc/libshaderc", |
| "//third_party/shaderc/third_party/glslang", |
| "//third_party/shaderc/third_party/glslang:SPIRV", |
| "//third_party/shaderc/third_party/glslang:glslang-default-resource-limits", |
| ] |
| |
| if (is_fuchsia) { |
| sources += [ |
| "flib/fence_listener_unittest.cc", |
| "flib/fence_set_listener_unittest.cc", |
| "flib/release_fence_signaller_unittest.cc", |
| "flib/util.cc", |
| "flib/util.h", |
| "profiling/timestamp_profiler_unittest.cc", |
| ] |
| deps += [ |
| "//garnet/public/lib/gtest", |
| "//zircon/public/lib/async-loop-cpp", |
| ] |
| } |
| |
| libs = [ "pthread" ] |
| |
| include_dirs = [ |
| "//lib", |
| "//garnet/public/lib/escher", |
| "//third_party/glm", |
| ] |
| } |
| } |
| |
| # Extends GTest with VK_TEST() and VK_TEST_F() macros, which behave just like |
| # TEST() and TEST_F(), except that they are dynamically disabled when Vulkan |
| # is not available. |
| source_set("gtest_vulkan") { |
| testonly = true |
| |
| public_deps = [ |
| "//garnet/public/lib/escher:vulkan", |
| "//third_party/googletest:gtest", |
| ] |
| |
| deps = [ |
| "//garnet/public/lib/escher/util:check_vulkan_support", |
| ] |
| |
| sources = [ |
| "gtest_vulkan.cc", |
| "gtest_vulkan.h", |
| "gtest_vulkan_internal.h", |
| ] |
| } |
| |
| # Builds upon gtest_vulkan to provide the functions SetUpTestEscher() |
| # and TearDownTestEscher(), which should be called from main(), and |
| # GetTestEscher(), which may be called from VK_TEST(). All of these |
| # functions are in namespace escher. |
| source_set("gtest_escher") { |
| testonly = true |
| |
| public_deps = [ |
| ":gtest_vulkan", |
| "//garnet/public/lib/escher", |
| ] |
| |
| sources = [ |
| "gtest_escher.cc", |
| "gtest_escher.h", |
| ] |
| } |
| |
| group("force_waterfall_to_build_on_host") { |
| if (is_linux) { |
| deps = [ |
| "//garnet/examples/escher/waterfall($host_toolchain)", |
| "//garnet/examples/escher/waterfall2($host_toolchain)", |
| ] |
| } |
| } |