blob: 06620187e069bd0466e67d478f5a1e55ddda8f51 [file] [log] [blame]
# Copyright (C) 2020 The Fuchsia Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/compiled_action.gni")
import("//build/components/fuchsia_package_with_single_component.gni")
import("//build_overrides/vulkan_tools.gni")
import("//src/lib/vulkan/image_pipe_swapchain.gni")
import("//src/lib/vulkan/layers.gni")
import("//src/sys/component_index/component_index.gni")
group("cube") {
testonly = true
deps = [
":vkcube-on-fb",
":vkcube-on-scenic",
":vkcube-skip-present",
]
}
add_to_component_index("fb-component-index") {
package_name = "vkcube-on-fb"
manifest = "meta/vkcube-on-fb.cmx"
}
fuchsia_package_with_single_component("vkcube-on-fb") {
testonly = true
deps = [
":cube-fb",
":fb-component-index",
"//src/lib/vulkan/swapchain:image_pipe_swapchain_fb_layer",
"//src/lib/vulkan/validation_layers",
]
component_name = "vkcube-on-fb"
manifest = "fuchsia/meta/vkcube-on-fb.cmx"
}
add_to_component_index("scenic-component-index") {
package_name = "vkcube-on-scenic"
manifest = "meta/vkcube-on-scenic.cmx"
}
fuchsia_package_with_single_component("vkcube-on-scenic") {
testonly = true
deps = [
":cube-scenic",
":scenic-component-index",
"//src/lib/vulkan/swapchain:image_pipe_swapchain_layer",
"//src/lib/vulkan/validation_layers",
]
component_name = "vkcube-on-scenic"
manifest = "fuchsia/meta/vkcube-on-scenic.cmx"
}
add_to_component_index("skip-present-component-index") {
package_name = "vkcube-skip-present"
manifest = "meta/vkcube-skip-present.cmx"
}
fuchsia_package_with_single_component("vkcube-skip-present") {
testonly = true
deps = [
":cube-skip-present",
":skip-present-component-index",
"//src/lib/vulkan/swapchain:image_pipe_swapchain_fb_skip_present_layer",
"//src/lib/vulkan/validation_layers",
]
component_name = "vkcube-skip-present"
manifest = "fuchsia/meta/vkcube-skip-present.cmx"
}
config("cube_config") {
cube_frag_inc = "$target_gen_dir/cube.frag.inc"
cube_vert_inc = "$target_gen_dir/cube.vert.inc"
cube_frag_inc_rebased = rebase_path(cube_frag_inc, root_build_dir)
cube_vert_inc_rebased = rebase_path(cube_vert_inc, root_build_dir)
inputs = [
cube_frag_inc,
cube_vert_inc,
]
defines = [
"CUBE_FRAG_INC=\"$cube_frag_inc_rebased\"",
"CUBE_VERT_INC=\"$cube_vert_inc_rebased\"",
]
include_dirs = [ root_build_dir ]
cflags = [ "-Wno-implicit-int-float-conversion" ]
}
executable("cube-scenic") {
output_name = "vkcube-on-scenic"
defines = [
"FUCHSIA_USE_SCENIC=1",
"FUCHSIA_IMAGEPIPE_LAYER=\"VK_LAYER_FUCHSIA_imagepipe_swapchain\"",
]
if (defined(texture_ppm_h)) {
path = rebase_path(texture_ppm_h, root_build_dir)
defines += [ "TEXTURE_PPM_H=\"$path\"" ]
}
sources = [
"cube.cpp",
"fuchsia/imagepipe_view.cpp",
"fuchsia/imagepipe_view.h",
]
configs += [ ":cube_config" ]
deps = [
":glslang_frag",
":glslang_vert",
"//sdk/fidl/fuchsia.ui.app",
"//sdk/fidl/fuchsia.ui.gfx",
"//sdk/fidl/fuchsia.ui.scenic",
"//sdk/lib/sys/cpp",
"//sdk/lib/ui/scenic/cpp",
"//third_party/Vulkan-Loader:libvulkan",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/syslog",
]
}
executable("cube-fb") {
output_name = "vkcube-on-fb"
defines = [
"FUCHSIA_USE_SCENIC=0",
"FUCHSIA_IMAGEPIPE_LAYER=\"VK_LAYER_FUCHSIA_imagepipe_swapchain_fb\"",
]
if (defined(texture_ppm_h)) {
path = rebase_path(texture_ppm_h, root_build_dir)
defines += [ "TEXTURE_PPM_H=\"$path\"" ]
}
sources = [ "cube.cpp" ]
configs += [ ":cube_config" ]
deps = [
":glslang_frag",
":glslang_vert",
"//third_party/Vulkan-Loader:libvulkan",
]
}
executable("cube-skip-present") {
output_name = "vkcube-skip-present"
defines = [
"FUCHSIA_USE_SCENIC=0",
"FUCHSIA_IMAGEPIPE_LAYER=\"VK_LAYER_FUCHSIA_imagepipe_swapchain_fb_skip_present\"",
]
if (defined(texture_ppm_h)) {
path = rebase_path(texture_ppm_h, root_build_dir)
defines += [ "TEXTURE_PPM_H=\"$path\"" ]
}
sources = [ "cube.cpp" ]
configs += [ ":cube_config" ]
deps = [
":glslang_frag",
":glslang_vert",
"//third_party/Vulkan-Loader:libvulkan",
]
}
config("cube_wayland_config") {
cflags = [ "-Wno-missing-field-initializers" ]
}
executable("cube-wayland") {
defines = [ "USE_XDG_SHELL=1" ]
sources = [
"cube.cpp",
"xdg-shell-unstable-v6.c",
]
configs += [
":cube_config",
":cube_wayland_config",
]
deps = [
":glslang_frag",
":glslang_vert",
"//third_party/Vulkan-Loader:libvulkan",
"//third_party/wayland:client",
]
}
compiled_action("glslang_frag") {
tool = "//third_party/glslang:glslang_validator"
outputs = [ "$target_gen_dir/cube.frag.inc" ]
sources = [ "cube.frag" ]
args = [
"--quiet",
"-V",
"-x",
"-o",
rebase_path("$target_gen_dir/cube.frag.inc", root_build_dir),
rebase_path("cube.frag", root_build_dir),
]
}
compiled_action("glslang_vert") {
tool = "//third_party/glslang:glslang_validator"
outputs = [ "$target_gen_dir/cube.vert.inc" ]
sources = [ "cube.vert" ]
args = [
"--quiet",
"-V",
"-x",
"-o",
rebase_path("$target_gen_dir/cube.vert.inc", root_build_dir),
rebase_path("cube.vert", root_build_dir),
]
}