| # Copyright 2019 The SwiftShader Authors. All Rights Reserved. | |
| # | |
| # 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. | |
| import("//build_overrides/build.gni") | |
| import("../swiftshader.gni") | |
| # Need a separate config to ensure the warnings are added to the end. | |
| config("swiftshader_libvulkan_private_config") { | |
| if (is_linux) { | |
| defines = [ | |
| "VK_USE_PLATFORM_XLIB_KHR", | |
| "VK_USE_PLATFORM_XCB_KHR", | |
| "VK_EXPORT=__attribute__((visibility(\"default\")))", | |
| ] | |
| } else if (is_fuchsia) { | |
| defines = [ | |
| "VK_USE_PLATFORM_FUCHSIA=1", | |
| "VK_EXPORT=__attribute__((visibility(\"default\")))", | |
| ] | |
| } else if (is_win) { | |
| defines = [ | |
| "VK_USE_PLATFORM_WIN32_KHR=1", | |
| "VK_EXPORT=", | |
| ] | |
| } else { | |
| defines = [ "VK_EXPORT=" ] | |
| } | |
| if (is_clang) { | |
| cflags = [ | |
| "-Wno-unused-private-field", | |
| "-Wno-switch", | |
| ] | |
| } | |
| } | |
| swiftshader_source_set("swiftshader_libvulkan_headers") { | |
| sources = [ | |
| "Version.h", | |
| "VkBuffer.hpp", | |
| "VkBufferView.hpp", | |
| "VkCommandBuffer.hpp", | |
| "VkCommandPool.hpp", | |
| "VkConfig.h", | |
| "VkDebug.hpp", | |
| "VkDescriptorPool.hpp", | |
| "VkDescriptorSet.hpp", | |
| "VkDescriptorSetLayout.hpp", | |
| "VkDescriptorUpdateTemplate.hpp", | |
| "VkDestroy.h", | |
| "VkDevice.hpp", | |
| "VkDeviceMemory.hpp", | |
| "VkEvent.hpp", | |
| "VkFence.hpp", | |
| "VkFormat.h", | |
| "VkFramebuffer.hpp", | |
| "VkGetProcAddress.h", | |
| "VkImage.hpp", | |
| "VkImageView.hpp", | |
| "VkInstance.hpp", | |
| "VkMemory.h", | |
| "VkObject.hpp", | |
| "VkPhysicalDevice.hpp", | |
| "VkPipeline.hpp", | |
| "VkPipelineCache.hpp", | |
| "VkPipelineLayout.hpp", | |
| "VkQueryPool.hpp", | |
| "VkQueue.hpp", | |
| "VkRenderPass.hpp", | |
| "VkSampler.hpp", | |
| "VkSemaphore.hpp", | |
| "VkShaderModule.hpp", | |
| "VulkanPlatform.h", | |
| ] | |
| } | |
| swiftshader_shared_library("swiftshader_libvulkan") { | |
| sources = [ | |
| "VkBuffer.cpp", | |
| "VkBufferView.cpp", | |
| "VkCommandBuffer.cpp", | |
| "VkCommandPool.cpp", | |
| "VkDebug.cpp", | |
| "VkDescriptorPool.cpp", | |
| "VkDescriptorSetLayout.cpp", | |
| "VkDescriptorUpdateTemplate.cpp", | |
| "VkDevice.cpp", | |
| "VkDeviceMemory.cpp", | |
| "VkFormat.cpp", | |
| "VkFramebuffer.cpp", | |
| "VkGetProcAddress.cpp", | |
| "VkImage.cpp", | |
| "VkImageView.cpp", | |
| "VkInstance.cpp", | |
| "VkMemory.cpp", | |
| "VkPhysicalDevice.cpp", | |
| "VkPipeline.cpp", | |
| "VkPipelineCache.cpp", | |
| "VkPipelineLayout.cpp", | |
| "VkPromotedExtensions.cpp", | |
| "VkQueryPool.cpp", | |
| "VkQueue.cpp", | |
| "VkRenderPass.cpp", | |
| "VkSampler.cpp", | |
| "VkShaderModule.cpp", | |
| "Vulkan.rc", | |
| "libVulkan.cpp", | |
| "main.cpp", | |
| "resource.h", | |
| "vk_swiftshader.def", | |
| ] | |
| configs = [ ":swiftshader_libvulkan_private_config" ] | |
| # TODO(capn): Use the same ICD name on both Windows and non-Windows. | |
| if (is_win) { | |
| output_name = "vk_swiftshader" | |
| } else { | |
| output_name = "libvk_swiftshader" | |
| } | |
| if (is_mac) { | |
| ldflags = [ | |
| "-Wl,-install_name,@rpath/libvk_swiftshader.dylib", | |
| "-Wl,-exported_symbols_list," + | |
| rebase_path("vk_swiftshader.exports", root_build_dir), | |
| ] | |
| } else if (is_linux || is_fuchsia) { | |
| inputs = [ | |
| "vk_swiftshader.lds", | |
| ] | |
| ldflags = [ "-Wl,--version-script=" + | |
| rebase_path("vk_swiftshader.lds", root_build_dir) ] | |
| } | |
| deps = [ | |
| "../../third_party/marl:Marl", | |
| "${swiftshader_spirv_tools_dir}:SPIRV-Tools", | |
| "../Device", | |
| "../Pipeline", | |
| "../Reactor:swiftshader_llvm_reactor", | |
| "../System", | |
| "../WSI", | |
| ] | |
| include_dirs = [ | |
| "..", | |
| "../../include", | |
| "$swiftshader_spirv_tools_dir/include", | |
| "$spirv_tools_spirv_headers_dir/include", | |
| ] | |
| public_deps = [ | |
| ":swiftshader_libvulkan_headers", | |
| ] | |
| } |