| # Copyright 2020 Google LLC | |
| # | |
| # 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. | |
| load("@iree_core//build_tools/bazel:template_rule.bzl", "template_rule") | |
| package(default_visibility = ["//visibility:public"]) | |
| COMMON_COPTS = [ | |
| "-fno-builtin-memcmp", | |
| "-fno-strict-aliasing", | |
| "-fvisibility=hidden", | |
| "-Wall", | |
| "-Wextra", | |
| "-Wno-implicit-fallthrough", | |
| "-Wno-missing-field-initializers", | |
| "-Wno-nonnull", | |
| "-Wno-sign-compare", | |
| "-Wno-string-conversion", | |
| "-Wno-unused-const-variable", | |
| "-Wno-unused-function", | |
| "-Wno-unused-parameter", | |
| "-Wno-unused-private-field", | |
| "-Wpointer-arith", | |
| ] | |
| COPTS = COMMON_COPTS + [ | |
| "-std=c++11", | |
| "-fno-rtti", | |
| ] | |
| C_COPTS = COMMON_COPTS + [ | |
| "-std=c99", | |
| # Require a recent enough POSIX source to get # pthead_condattr_setclock. | |
| "-D_POSIX_C_SOURCE=200112", | |
| ] | |
| LINKOPTS = [ | |
| "-Wl,-Bsymbolic,--exclude-libs,ALL", | |
| # We ignore the -Wl,--version-script=... option from upstream | |
| ] | |
| cc_library( | |
| name = "hash_table", | |
| srcs = [ | |
| "layers/hash_table.cpp", | |
| "layers/hash_table.h", | |
| ], | |
| copts = COPTS, | |
| ) | |
| cc_binary( | |
| name = "libVkLayer_khronos_timeline_semaphore.so", | |
| srcs = [ | |
| "layers/hash_table.h", | |
| "layers/list.h", | |
| "layers/timeline_semaphore.c", | |
| "layers/vk_alloc.h", | |
| "layers/vk_util.h", | |
| ], | |
| copts = C_COPTS, | |
| linkopts = LINKOPTS, | |
| linkshared = 1, | |
| deps = [ | |
| ":hash_table", | |
| "@iree_vulkan_headers//:vulkan_headers", | |
| ], | |
| ) | |
| # TODO(scotttodd): Fetch VK_VERSION dynamically | |
| # CMake: `VK_VERSION=1.1.${vk_header_version}` | |
| # (regex match on vulkan_core.h from VulkanHeaders) | |
| template_rule( | |
| name = "VkLayer_khronos_timeline_semaphore_json", | |
| src = "layers/json/VkLayer_khronos_timeline_semaphore.json.in", | |
| out = "VkLayer_khronos_timeline_semaphore.json", | |
| substitutions = { | |
| "@RELATIVE_LAYER_BINARY@": "./libVkLayer_khronos_timeline_semaphore.so", | |
| "@VK_VERSION@": "1.1.133", | |
| } | |
| ) |