blob: 5ead1c628ed4db8f5b590e18ad38dbc9d5db8e91 [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/package.gni")
import("//build_overrides/vulkan_tools.gni")
import("//src/lib/vulkan/image_pipe_swapchain.gni")
import("//src/lib/vulkan/layers.gni")
group("cube") {
testonly = true
deps = [
":vkcube-on-fb",
":vkcube-on-scenic",
":vkcube-skip-present",
]
}
package("vkcube-on-fb") {
testonly = true
deps = [ ":cube-fb" ]
binaries = [
{
name = "cube-fb"
dest = "vkcube-on-fb"
},
]
meta = [
{
path = rebase_path("fuchsia/meta/vkcube-on-fb.cmx")
dest = "vkcube-on-fb.cmx"
},
]
public_deps =
vulkan_validation_layers.public_deps + image_pipe_swapchain_fb.public_deps
loadable_modules = vulkan_validation_layers.loadable_modules +
image_pipe_swapchain_fb.loadable_modules
resources =
vulkan_validation_layers.resources + image_pipe_swapchain_fb.resources
}
package("vkcube-on-scenic") {
testonly = true
deps = [ ":cube-scenic" ]
binaries = [
{
name = "cube-scenic"
dest = "vkcube-on-scenic"
},
]
meta = [
{
path = rebase_path("fuchsia/meta/vkcube-on-scenic.cmx")
dest = "vkcube-on-scenic.cmx"
},
]
public_deps =
vulkan_validation_layers.public_deps + image_pipe_swapchain.public_deps
loadable_modules = vulkan_validation_layers.loadable_modules +
image_pipe_swapchain.loadable_modules
resources =
vulkan_validation_layers.resources + image_pipe_swapchain.resources
}
package("vkcube-skip-present") {
testonly = true
deps = [ ":cube-skip-present" ]
binaries = [
{
name = "cube-skip-present"
dest = "vkcube-skip-present"
},
]
meta = [
{
path = rebase_path("fuchsia/meta/vkcube-skip-present.cmx")
dest = "vkcube-skip-present.cmx"
},
]
public_deps = vulkan_validation_layers.public_deps +
image_pipe_swapchain_fb_skip_present.public_deps
loadable_modules = vulkan_validation_layers.loadable_modules +
image_pipe_swapchain_fb_skip_present.loadable_modules
resources = vulkan_validation_layers.resources +
image_pipe_swapchain_fb_skip_present.resources
}
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") {
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") {
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") {
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),
]
}