| # Copyright (C) 2018-2019 The ANGLE Project Authors. |
| # Copyright (C) 2019-2023 LunarG, 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 |
| # |
| # 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_overrides/build.gni") |
| import("//build_overrides/vulkan_tools.gni") |
| |
| if (!is_android) { |
| vulkan_undefine_configs = [] |
| if (is_win && build_with_chromium) { |
| vulkan_undefine_configs += [ |
| "//build/config/win:nominmax", |
| "//build/config/win:unicode", |
| ] |
| } |
| |
| # Vulkan Mock ICD |
| # --------------- |
| shared_library("VkICD_mock_icd") { |
| configs -= vulkan_undefine_configs |
| deps = [ |
| "$vulkan_headers_dir:vulkan_headers" |
| ] |
| data_deps = [ ":vulkan_gen_icd_json_file" ] |
| sources = [ |
| "icd/mock_icd.h", |
| "icd/mock_icd.cpp", |
| "icd/generated/function_declarations.h", |
| "icd/generated/function_definitions.h", |
| "icd/generated/vk_typemap_helper.h", |
| ] |
| include_dirs = [ |
| "icd", |
| "icd/generated", |
| ] |
| if (is_win) { |
| sources += [ "icd/VkICD_mock_icd.def" ] |
| } |
| if (build_with_chromium) { |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ "//build/config/compiler:no_chromium_code" ] |
| } |
| } |
| |
| action("vulkan_gen_icd_json_file") { |
| script = "scripts/gn/generate_vulkan_icd_json.py" |
| |
| public_deps = [ "$vulkan_headers_dir:vulkan_headers" ] |
| |
| sources = [ "icd/VkICD_mock_icd.json.in" ] |
| |
| vulkan_data_dir = "$root_out_dir/$vulkan_data_subdir" |
| |
| outputs = [ "$vulkan_data_dir/VkICD_mock_icd.json" ] |
| |
| if (is_linux) { |
| _platform = "Linux" |
| } else if (is_win) { |
| _platform = "Windows" |
| } else if (is_mac) { |
| _platform = "Darwin" |
| } else if (is_fuchsia) { |
| _platform = "Fuchsia" |
| } else { |
| _platform = "Other" |
| } |
| |
| args = [ |
| "--icd", |
| "--platform", _platform, |
| rebase_path("icd/", root_build_dir), |
| rebase_path(vulkan_data_dir, root_build_dir) |
| ] + rebase_path(sources, root_build_dir) |
| |
| if (is_win) { |
| args += [ "--no-path-prefix" ] |
| } |
| |
| data = outputs |
| } |
| } |