blob: 43f4a3038a9fb75c9cfa98370b8be57c84950cfb [file] [edit]
# -------------------------------------------------------------------------
# Vulkan Conformance Tests
# ------------------------
#
# Copyright (c) 2022 Google Inc.
#
# 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
#
# http://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.
#
# --------------------------------------------------------------------
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
load(
"@rules_fuchsia//fuchsia:defs.bzl",
"fuchsia_component",
"fuchsia_component_manifest",
"fuchsia_component_manifest_shard",
"fuchsia_package",
"fuchsia_package_resource",
"fuchsia_package_resource_group",
"fuchsia_test_component",
"fuchsia_test_package",
"fuchsia_wrap_cc_binary",
)
load(
"utils.bzl",
"selectccinfo",
"split_cts",
)
load("@bazel_skylib//lib:dicts.bzl", "dicts")
# The default compile flags are used in unexpected places in the cmake build, causing it to fail. So remove them.
package(features = ["-default_compile_flags"])
cmake_cache = {
"CMAKE_BUILD_TYPE": "RelWithAsserts",
"DE_OS": "DE_OS_FUCHSIA",
"DEQP_TARGET": "fuchsia",
"CMAKE_SYSTEM_NAME": "Fuchsia",
"SKIP_SPIRV_TOOLS_INSTALL": "1",
}
cmake(
name = "vulkan_cts",
cache_entries = select({
"@platforms//cpu:x86_64": dicts.add(
cmake_cache,
{
"CMAKE_C_FLAGS": "--target=x86_64-fuchsia",
"CMAKE_CXX_FLAGS": "--target=x86_64-fuchsia",
},
),
"@platforms//cpu:aarch64": dicts.add(
cmake_cache,
{
"CMAKE_C_FLAGS": "--target=aarch64-fuchsia",
"CMAKE_CXX_FLAGS": "--target=aarch64-fuchsia",
},
),
}),
generate_args = [
"-GNinja",
],
lib_source = "@src//:all_srcs",
out_binaries = ["deqp-vk"],
# Local builds are currently necessary for external/glslang/CMakeLists.txt to find glslang.
tags = ["local"],
targets = [
"deqp-vk",
],
deps = [
"@fuchsia_sdk//pkg/fdio",
"@fuchsia_sdk//pkg/vulkan",
],
)
selectccinfo(
name = "vulkan-cts-file",
srcs = ":vulkan_cts",
filename = "deqp-vk",
)
# Wrap the binary as a resource that can be included in a package. This also keeps track of what
# shared library dependencies are needed for it to run, so they can be included in the package.
fuchsia_wrap_cc_binary(
name = "vulkan-cts-wrapped",
bin_name = "vulkan-cts",
cc_binary = ":vulkan-cts-file",
exact_cc_binary_deps = [
"@fuchsia_sdk//pkg/fdio",
"@fuchsia_sdk//pkg/vulkan",
],
)
fuchsia_package_resource(
name = "vulkan-cts-resource",
src = ":vulkan-cts-file",
dest = "test/vulkan-cts",
)
fuchsia_package_resource_group(
name = "data_include",
srcs = ["@src//:data_srcs"],
dest = "data",
strip_prefix = "../src/external/vulkancts/data/",
)
fuchsia_package_resource_group(
name = "mustpass_include",
srcs = ["@src//:mustpass_srcs"],
dest = "data",
strip_prefix = "../src/external/vulkancts/mustpass/master/",
)
fuchsia_component_manifest_shard(
name = "cts-shard",
src = "meta/vulkan-cts.shard.cml",
include_path = "meta",
)
fuchsia_component_manifest(
name = "manifest",
src = "meta/vulkan-cts.cml",
includes = [
":cts-shard",
"@fuchsia_sdk//pkg/sys/testing:elf_test_runner",
"@fuchsia_sdk//pkg/sys/testing:system-test",
"@fuchsia_sdk//pkg/syslog:client",
"@fuchsia_sdk//pkg/vulkan:client",
],
)
fuchsia_test_component(
name = "component",
manifest = ":manifest",
deps = [
":data_include",
":mustpass_include",
":vulkan-cts-wrapped",
"@fuchsia_sdk//pkg/fdio",
"@fuchsia_sdk//pkg/vulkan",
],
)
fuchsia_test_package(
name = "vulkan-cts",
package_name = "vulkan-cts",
components = [":component"],
)
split_cts(name = "vulkan-cts-split")