| # Copyright 2019 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("../gn/build_rules.gni") |
| import("../gn/glsl_shader_rules.gni") |
| import("vulkan_testing.gni") |
| |
| config("common_public_config") { |
| # Unlike the sources here, clients use "tests/common/..." to include the headers. |
| include_dirs = [ graphics_compute_dir ] |
| } |
| |
| # NOTE: The CQ runs graphics_compute_unittests on the host, even for Fuchsia |
| # builds. And the CQ runs host executables in an environment without Vulkan |
| # support (i.e. libvulkan.so.1 is not available). |
| # |
| # Due to this Vulkan-specific sources are split from |common| into |common_vk| |
| # so only the former can be unit-tested properly on the CQ. The latter will |
| # be tested when src/graphics/lib/compute:all_tests is built. |
| |
| source_set("common") { |
| public = [ |
| "common/affine_transform.h", |
| "common/arc_parameters.h", |
| "common/argparse.h", |
| "common/fps_counter.h", |
| "common/list_ostream.h", |
| "common/path_sink.h", |
| "common/scoped_struct.h", |
| "common/utils.h", |
| ] |
| sources = [ |
| "common/affine_transform.c", |
| "common/affine_transform.h", |
| "common/arc_parameters.cc", |
| "common/arc_parameters.h", |
| "common/argparse.c", |
| "common/argparse.h", |
| "common/fps_counter.c", |
| "common/fps_counter.h", |
| "common/list_ostream.h", |
| "common/path_sink.cc", |
| "common/path_sink.h", |
| "common/scoped_struct.h", |
| "common/utils.c", |
| "common/utils.h", |
| ] |
| public_configs = [ ":common_public_config" ] |
| configs += [ |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| "//build/config:Wno-conversion", |
| ] |
| } |
| |
| source_set("common_test_utils") { |
| sources = [ |
| "common/affine_transform_test_utils.cc", |
| "common/affine_transform_test_utils.h", |
| "common/path_sink_test_utils.h", |
| ] |
| public_deps = [ |
| ":common", |
| graphics_compute_gtest_target, |
| ] |
| testonly = true |
| configs += [ |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| "//build/config:Wno-conversion", |
| ] |
| } |
| |
| graphics_compute_unittests("common_unittests") { |
| sources = [ |
| "common/affine_transform_unittest.cc", |
| "common/arc_parameters_unittest.cc", |
| "common/argparse_unittest.cc", |
| "common/fps_counter_unittest.cc", |
| "common/list_ostream_unittest.cc", |
| "common/path_sink_unittest.cc", |
| "common/scoped_struct_unittest.cc", |
| ] |
| deps = [ |
| ":common", |
| ":common_test_utils", |
| ] |
| configs = [ |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| "//build/config:Wno-conversion", |
| ] |
| } |
| |
| # Vulkan-dependent files. |
| # NOTE: This includes |common| as a public_deps for convenience. |
| source_set("common_vk") { |
| public = [ |
| "common/vk_app_state.h", |
| "common/vk_buffer.h", |
| "common/vk_device_surface_info.h", |
| "common/vk_format_matcher.h", |
| "common/vk_image.h", |
| "common/vk_image_utils.h", |
| "common/vk_sampler.h", |
| "common/vk_strings.h", |
| "common/vk_surface.h", |
| "common/vk_swapchain.h", |
| "common/vk_swapchain_queue.h", |
| "common/vk_swapchain_staging.h", |
| "common/vk_utils.h", |
| ] |
| sources = [ |
| "common/vk_app_state.c", |
| "common/vk_app_state.h", |
| "common/vk_buffer.c", |
| "common/vk_buffer.h", |
| "common/vk_device_surface_info.c", |
| "common/vk_device_surface_info.h", |
| "common/vk_format_matcher.c", |
| "common/vk_format_matcher.h", |
| "common/vk_image.c", |
| "common/vk_image.h", |
| "common/vk_image_utils.c", |
| "common/vk_image_utils.h", |
| "common/vk_sampler.c", |
| "common/vk_sampler.h", |
| "common/vk_strings.c", |
| "common/vk_strings.h", |
| "common/vk_surface.h", |
| "common/vk_swapchain.c", |
| "common/vk_swapchain.h", |
| "common/vk_swapchain_queue.c", |
| "common/vk_swapchain_queue.h", |
| "common/vk_swapchain_staging.c", |
| "common/vk_swapchain_staging.h", |
| "common/vk_utils.c", |
| "common/vk_utils.h", |
| ] |
| deps = [] |
| |
| if (is_fuchsia) { |
| sources += [ "common/vk_surface_fuchsia.cc" ] |
| deps += [ |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/trace-provider:trace-provider-with-fdio", |
| ] |
| } else { |
| sources += [ "common/vk_surface_glfw.c" ] |
| deps += [ "//third_party/glfw:glfw" ] |
| |
| # Work-around bug in //third_party/glfw:glfw definition. |
| if (is_linux) { |
| libs = [ |
| "X11", |
| "Xinerama", |
| "Xcursor", |
| "Xrandr", |
| ] |
| } |
| } |
| |
| public_deps = [ |
| ":common", |
| graphics_compute_vulkan_loader_target, |
| ] |
| public_configs = [ ":common_public_config" ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| graphics_compute_unittests("common_vk_unittests") { |
| sources = [ |
| "common/vk_app_state_unittest.cc", |
| "common/vk_buffer_unittest.cc", |
| "common/vk_format_matcher_unittest.cc", |
| "common/vk_image_unittest.cc", |
| "common/vk_sampler_unittest.cc", |
| "common/vk_strings_unittest.cc", |
| "common/vk_surface_unittest.cc", |
| "common/vk_swapchain_unittest.cc", |
| "common/vk_utils_unittest.cc", |
| ] |
| deps = [ ":common_vk" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| "vk-app-state-test", |
| "vk-swapchain-test", |
| "vk-transfer-test", |
| "vk-triangle-test", |
| ] |
| } |