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
55 "$vulkan_headers_dir:vulkan_headers",
58 ":vulkan_gen_icd_json_file",
61 "icd/generated/mock_icd.cpp",
62 "icd/generated/mock_icd.h",
65 sources += [ "icd/VkICD_mock_icd.def" ]
67 configs -= [ "//build/config/compiler:chromium_code" ]
68 configs += [ "//build/config/compiler:no_chromium_code" ]
71 action("vulkan_gen_icd_json_file") {
72 script = "build-gn/generate_vulkan_layers_json.py"
74 "$vulkan_headers_dir/include/vulkan/vulkan_core.h",
78 sources += [ "icd/windows/VkICD_mock_icd.json" ]
79 args += [ "$raw_vulkan_icd_dir/windows" ]
82 sources += [ "icd/linux/VkICD_mock_icd.json" ]
83 args += [ "$raw_vulkan_icd_dir/linux" ]
86 sources += [ "icd/macos/VkICD_mock_icd.json" ]
87 args += [ "$raw_vulkan_icd_dir/macos" ]
90 # The layer JSON files are part of the necessary data deps.
92 "$vulkan_data_dir/VkICD_mock_icd.json",
95 args += [ raw_vulkan_data_dir ] + rebase_path(sources, root_build_dir)