1 # Copyright (C) 2018-2019 The ANGLE Project Authors.
2 # Copyright (C) 2019 LunarG, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # https://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 import("//build_overrides/vulkan_tools.gni")
18 # Vulkan-tools isn't ported to Fuchsia yet.
19 # TODO(spang): Port mock ICD to Fuchsia.
22 vulkan_undefine_configs = []
24 vulkan_undefine_configs += [
25 "//build/config/win:nominmax",
26 "//build/config/win:unicode",
30 raw_vulkan_icd_dir = rebase_path("icd", root_build_dir)
32 vulkan_data_dir = "$root_out_dir/$vulkan_data_subdir"
33 raw_vulkan_data_dir = rebase_path(vulkan_data_dir, root_build_dir)
35 config("vulkan_internal_config") {
36 defines = [ "VULKAN_NON_CMAKE_BUILD" ]
37 if (is_clang || !is_win) {
38 cflags = [ "-Wno-unused-function" ]
42 "SYSCONFDIR=\"/etc\"",
43 "FALLBACK_CONFIG_DIRS=\"/etc/xdg\"",
44 "FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"",
52 shared_library("VkICD_mock_icd") {
53 configs -= vulkan_undefine_configs
54 public_deps = [ "$vulkan_headers_dir:vulkan_headers" ]
55 data_deps = [ ":vulkan_gen_icd_json_file" ]
57 "icd/generated/mock_icd.cpp",
58 "icd/generated/mock_icd.h",
59 "icd/generated/vk_typemap_helper.h",
62 sources += [ "icd/VkICD_mock_icd.def" ]
64 configs -= [ "//build/config/compiler:chromium_code" ]
65 configs += [ "//build/config/compiler:no_chromium_code" ]
68 action("vulkan_gen_icd_json_file") {
69 script = "build-gn/generate_vulkan_layers_json.py"
70 public_deps = [ "$vulkan_headers_dir:vulkan_headers" ]
71 sources = [ "$vulkan_headers_dir/include/vulkan/vulkan_core.h" ]
74 sources += [ "icd/windows/VkICD_mock_icd.json" ]
75 args += [ "$raw_vulkan_icd_dir/windows" ]
78 sources += [ "icd/linux/VkICD_mock_icd.json" ]
79 args += [ "$raw_vulkan_icd_dir/linux" ]
82 sources += [ "icd/macos/VkICD_mock_icd.json" ]
83 args += [ "$raw_vulkan_icd_dir/macos" ]
86 # The layer JSON files are part of the necessary data deps.
87 outputs = [ "$vulkan_data_dir/VkICD_mock_icd.json" ]
89 args += [ raw_vulkan_data_dir ] + rebase_path(sources, root_build_dir)