aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Field <dnfield@google.com>2023-12-05 16:05:18 -0800
committerswiftshader-scoped@luci-project-accounts.iam.gserviceaccount.com <swiftshader-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-12-15 21:36:49 +0000
commit2fa7e9b99ae4e70ea5ae2cc9c8d3afb43391384f (patch)
tree69e982134f3f2817421223dad65b171c22afded0
parent77be35e337bb80df52c5ea4dd4cf2d2072abad25 (diff)
downloadswiftshader-2fa7e9b99ae4e70ea5ae2cc9c8d3afb43391384f.tar.gz
Support a static build rule for swiftshader
Change-Id: Ia0c6a6475a96df99e4cfe4665c4290ec99214c5d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/72768 Reviewed-by: Shahbaz Youssefi <syoussefi@google.com> Tested-by: Shahbaz Youssefi <syoussefi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@google.com>
-rw-r--r--src/Vulkan/BUILD.gn65
1 files changed, 37 insertions, 28 deletions
diff --git a/src/Vulkan/BUILD.gn b/src/Vulkan/BUILD.gn
index 81ba736e8..852068cad 100644
--- a/src/Vulkan/BUILD.gn
+++ b/src/Vulkan/BUILD.gn
@@ -126,7 +126,7 @@ swiftshader_source_set("swiftshader_libvulkan_headers") {
}
}
-swiftshader_shared_library("swiftshader_libvulkan") {
+swiftshader_source_set("_swiftshader_libvulkan") {
sources = [
"VkBuffer.cpp",
"VkBufferView.cpp",
@@ -170,6 +170,35 @@ swiftshader_shared_library("swiftshader_libvulkan") {
libs = []
+ if (is_win) {
+ libs += [
+ "gdi32.lib",
+ "user32.lib",
+ ]
+ }
+
+ public_deps = [
+ ":swiftshader_libvulkan_headers",
+ "../../third_party/SPIRV-Tools:spvtools_headers",
+ "../../third_party/SPIRV-Tools:spvtools_opt",
+ "../../third_party/SPIRV-Tools:spvtools_val",
+ "../../third_party/marl:Marl",
+ "../Device",
+ "../Pipeline",
+ "../Reactor:swiftshader_reactor",
+ "../System",
+ "../WSI",
+ ]
+
+ include_dirs = [
+ "..",
+ "../../include",
+ "../../third_party/SPIRV-Tools/include",
+ "../../third_party/SPIRV-Headers/include",
+ ]
+}
+
+swiftshader_shared_library("swiftshader_libvulkan") {
# TODO(capn): Use the same ICD name on both Windows and non-Windows.
if (is_win) {
output_name = "vk_swiftshader"
@@ -178,17 +207,11 @@ swiftshader_shared_library("swiftshader_libvulkan") {
}
if (is_win) {
- sources += [
+ sources = [
"Vulkan.rc",
"vk_swiftshader.def",
]
- libs += [
- "gdi32.lib",
- "user32.lib",
- ]
- }
-
- if (is_mac) {
+ } else if (is_mac) {
ldflags = [
"-Wl,-install_name,@rpath/libvk_swiftshader.dylib",
"-Wl,-exported_symbols_list," +
@@ -205,26 +228,12 @@ swiftshader_shared_library("swiftshader_libvulkan") {
]
}
- deps = [
- "../../third_party/SPIRV-Tools:spvtools_headers",
- "../../third_party/SPIRV-Tools:spvtools_opt",
- "../../third_party/SPIRV-Tools:spvtools_val",
- "../../third_party/marl:Marl",
- "../Device",
- "../Pipeline",
- "../Reactor:swiftshader_reactor",
- "../System",
- "../WSI",
- ]
-
- include_dirs = [
- "..",
- "../../include",
- "../../third_party/SPIRV-Tools/include",
- "../../third_party/SPIRV-Headers/include",
- ]
+ deps = [ ":_swiftshader_libvulkan" ]
+}
- public_deps = [ ":swiftshader_libvulkan_headers" ]
+swiftshader_static_library("swiftshader_libvulkan_static") {
+ complete_static_lib = true
+ deps = [ ":_swiftshader_libvulkan" ]
}
# Generates an ICD JSON file that can be used by all targets in this GN build