blob: b647f2a5dca29bd644029fc5c368945493ab2d60 [file] [log] [blame]
Alistair Strachan60f86622018-03-22 17:37:55 -07001//
2// Copyright (C) 2018 The Android Open Source Project
3//
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
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
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.
15//
16
Nicolas Capens0ca03fb2021-05-10 13:37:21 -040017package {
18 // http://go/android-license-faq
19 // A large-scale-change added 'default_applicable_licenses' to import
20 // the below license kinds from "external_swiftshader_license":
21 // SPDX-license-identifier-Apache-2.0
22 // SPDX-license-identifier-BSD
23 default_applicable_licenses: ["external_swiftshader_license"],
24}
25
Alistair Strachan60f86622018-03-22 17:37:55 -070026cc_defaults {
Chris Forbes0deebed2019-04-05 10:07:33 -070027 name: "libswiftshadervk_llvm_defaults",
28
Ben Clayton25e06e02020-02-07 11:19:08 +000029 header_libs: [
30 "swiftshader_platform_headers",
31 ],
32
Chris Forbes0deebed2019-04-05 10:07:33 -070033 srcs: [
Nicolas Capens08c62002021-11-17 00:25:05 -050034 "Reactor/Assert.cpp",
Ben Claytonb3b2a4f2020-02-08 14:20:20 +000035 "Reactor/CPUID.cpp",
36 "Reactor/Debug.cpp",
Ben Claytonb3b2a4f2020-02-08 14:20:20 +000037 "Reactor/ExecutableMemory.cpp",
Nicolas Capensf1223ce2020-11-02 12:53:45 -050038 "Reactor/LLVMJIT.cpp",
Chris Forbes0deebed2019-04-05 10:07:33 -070039 "Reactor/LLVMReactor.cpp",
Nicolas Capens9c5d0d72021-06-29 12:55:27 -040040 "Reactor/Pragma.cpp",
Ben Claytonb3b2a4f2020-02-08 14:20:20 +000041 "Reactor/Reactor.cpp",
Nicolas Capens3b0ad202022-06-02 15:02:31 -040042 "Reactor/SIMD.cpp",
Chris Forbes0deebed2019-04-05 10:07:33 -070043 ],
44
45 cflags: [
Alistair Delva790b3252021-02-09 13:20:14 -080046 "-DREACTOR_ANONYMOUS_MMAP_NAME=swiftshader_jit",
Chris Forbes0deebed2019-04-05 10:07:33 -070047 "-Wno-unused-parameter",
48 "-Wno-implicit-fallthrough",
49 ],
50
51 static_libs: [
Antonio Maiorano522b34c2020-07-09 15:04:13 -040052 "libLLVM10_swiftshader",
Chris Forbes0deebed2019-04-05 10:07:33 -070053 ],
54
55 shared_libs: [
56 "libcutils",
Ben Clayton25e06e02020-02-07 11:19:08 +000057 "liblog",
Chris Forbes0deebed2019-04-05 10:07:33 -070058 ],
59}
60
Alistair Strachan60f86622018-03-22 17:37:55 -070061cc_library_static {
Chris Forbes0deebed2019-04-05 10:07:33 -070062 name: "libswiftshadervk_llvm",
Chris Forbes0deebed2019-04-05 10:07:33 -070063 vendor: true,
Chris Forbes0deebed2019-04-05 10:07:33 -070064 defaults: [ "libswiftshadervk_llvm_defaults" ],
65}
66
67cc_library_static {
68 name: "libswiftshadervk_llvm_debug",
Chris Forbes0deebed2019-04-05 10:07:33 -070069 vendor: true,
Chris Forbes0deebed2019-04-05 10:07:33 -070070 defaults: [ "libswiftshadervk_llvm_defaults" ],
71}
72
Tim Van Patten9da287f2019-11-07 10:27:18 -070073genrule {
74 name: "commit_header",
75 out: ["commit.h"],
76 tool_files: ["commit_id.py"],
77 cmd: "$(location commit_id.py) gen $(genDir)/commit.h",
78}
79
Hernan Liatis94e03052019-03-29 11:55:30 -070080cc_defaults {
Chris Forbes0deebed2019-04-05 10:07:33 -070081 name: "libvk_swiftshader_defaults",
Hernan Liatis94e03052019-03-29 11:55:30 -070082 vendor: true,
83
84 defaults: [ "swiftshader_common" ],
85
86 cflags: [
87 "-D_GNU_SOURCE",
88 "-D__STDC_LIMIT_MACROS",
89 "-D__STDC_CONSTANT_MACROS",
90 "-D__STDC_FORMAT_MACROS",
91 "-DHAVE_GRALLOC1",
Jason Macnak1de497c2020-04-08 11:31:50 -070092 "-DHAVE_GRALLOC3",
Jason Macnakb33e0b32020-04-08 11:31:50 -070093 "-DHAVE_GRALLOC4",
Hernan Liatis94e03052019-03-29 11:55:30 -070094 // FIXME: Use <android/api-level.h> instead?
95 "-DANDROID_PLATFORM_SDK_VERSION=10000",
96 "-Wno-implicit-fallthrough",
97 "-Wno-unused-parameter",
98 "-Wno-unused-local-typedef",
Chris Forbes0deebed2019-04-05 10:07:33 -070099 "-Wno-missing-field-initializers",
Tim Van Patten9da287f2019-11-07 10:27:18 -0700100 // Enable to output commit hash when SwiftShader is initialized
101 //"-DENABLE_BUILD_VERSION_OUTPUT",
Hernan Liatis94e03052019-03-29 11:55:30 -0700102 ],
103
104 cppflags: [
105 "-Wno-sign-promo",
106 "-Wno-non-virtual-dtor",
107 ],
108
Nicolas Capense3621dc2020-02-25 22:45:42 -0500109 ldflags: [
110 // -Bsymbolic binds symbol references to their global definitions within
111 // a shared object, thereby preventing symbol preemption.
112 "-Wl,-Bsymbolic",
113 ],
114
Hernan Liatis94e03052019-03-29 11:55:30 -0700115 local_include_dirs: [ "Vulkan" ],
116
Lingfeng Yangddee0f32020-02-03 18:04:48 -0800117 version_script: "Vulkan/android_vk_swiftshader.lds",
Chris Forbes0deebed2019-04-05 10:07:33 -0700118
Tim Van Patten9da287f2019-11-07 10:27:18 -0700119 generated_headers: [ "commit_header" ],
120
Hernan Liatis94e03052019-03-29 11:55:30 -0700121 target: {
122 android: {
123 relative_install_path: "hw",
124 header_libs: [
Chris Forbes0deebed2019-04-05 10:07:33 -0700125 "swiftshader_platform_headers",
Chris Forbes9f1e03b2020-01-09 11:45:28 -0800126 "vulkan_headers",
Chris Forbesd6ccc312019-04-23 17:39:58 -0700127 "hwvulkan_headers",
Hernan Liatis94e03052019-03-29 11:55:30 -0700128 ],
129 shared_libs: [
Jason Macnak1de497c2020-04-08 11:31:50 -0700130 "android.hardware.graphics.mapper@3.0",
Jason Macnakb33e0b32020-04-08 11:31:50 -0700131 "android.hardware.graphics.mapper@4.0",
Hernan Liatis94e03052019-03-29 11:55:30 -0700132 "libnativewindow",
133 "libhardware",
Jason Macnak1de497c2020-04-08 11:31:50 -0700134 "libhidlbase",
Hernan Liatis94e03052019-03-29 11:55:30 -0700135 "libcutils",
136 "libsync",
137 "liblog",
Jason Macnak1de497c2020-04-08 11:31:50 -0700138 "libutils",
Hernan Liatis94e03052019-03-29 11:55:30 -0700139 ],
Chris Forbes9f1e03b2020-01-09 11:45:28 -0800140 static_libs: [
141 "libarect",
142 ],
Hernan Liatis94e03052019-03-29 11:55:30 -0700143 },
Hernan Liatis94e03052019-03-29 11:55:30 -0700144 },
145}
146
Alexis Hetu1b900872020-02-24 12:09:16 -0500147cc_library_static {
148 name: "swiftshader_debug",
149
150 vendor_available: true,
151
152 cflags: [
153 "-DLOG_TAG=\"swiftshader\"",
154 ],
155
156 srcs: [
157 "System/Debug.cpp",
158 ],
159
160 export_include_dirs: [
161 ".",
162 ],
163
164 shared_libs: [
165 "liblog",
166 ],
167}
168
Hernan Liatis94e03052019-03-29 11:55:30 -0700169cc_defaults {
170 name: "libvk_swiftshader_common_defaults",
171
172 cflags: [
173 "-DLOG_TAG=\"swiftshader\"",
Chris Forbes9f1e03b2020-01-09 11:45:28 -0800174 "-DSWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER",
Nicolas Capensa4347a92020-03-01 08:29:25 -0500175 "-DSWIFTSHADER_ENABLE_ASTC", // TODO(b/150130101)
Yiwei Zhang06002012020-11-08 16:09:35 -0800176 //"-DSWIFTSHADER_DEVICE_MEMORY_REPORT",
Hernan Liatis94e03052019-03-29 11:55:30 -0700177 ],
178
179 srcs: [
Ben Clayton77c89ff2020-01-08 19:10:14 +0000180 "System/Build.cpp",
Hernan Liatis628604e2019-05-07 15:30:18 -0700181 "System/Configurator.cpp",
Ben Clayton25e06e02020-02-07 11:19:08 +0000182 "System/CPUID.cpp",
Ben Clayton25e06e02020-02-07 11:19:08 +0000183 "System/GrallocAndroid.cpp",
Hernan Liatis628604e2019-05-07 15:30:18 -0700184 "System/Half.cpp",
David 'Digit' Turnerc9fa9fe2019-08-13 19:05:01 +0200185 "System/Linux/MemFd.cpp",
Hernan Liatis628604e2019-05-07 15:30:18 -0700186 "System/Math.cpp",
187 "System/Memory.cpp",
Hernan Liatis628604e2019-05-07 15:30:18 -0700188 "System/Socket.cpp",
Daniele Vettorel366db5a2022-01-24 17:01:45 +0000189 "System/SwiftConfig.cpp",
Hernan Liatis628604e2019-05-07 15:30:18 -0700190 "System/Timer.cpp",
Chris Forbes0deebed2019-04-05 10:07:33 -0700191 "Device/*.cpp",
192 "Pipeline/*.cpp",
193 "Vulkan/*.cpp",
Jason Macnak99e54b12021-01-25 06:57:54 -0800194 "WSI/HeadlessSurfaceKHR.cpp",
195 "WSI/VkSurfaceKHR.cpp",
Chris Forbes0deebed2019-04-05 10:07:33 -0700196 ],
197
198 static_libs: [
Alexis Hetu1b900872020-02-24 12:09:16 -0500199 "swiftshader_astc",
200 "swiftshader_debug",
Ben Claytone693b622019-09-05 12:48:37 +0100201 "swiftshader_marl",
Chris Forbes0deebed2019-04-05 10:07:33 -0700202 "swiftshader_spirv-tools",
Hernan Liatis94e03052019-03-29 11:55:30 -0700203 ],
204
205 include_dirs: [
206 "external/swiftshader/third_party/SPIRV-Headers/include",
Trevor David Black16636f42020-09-16 23:11:08 +0000207 "external/swiftshader/include",
Hernan Liatis94e03052019-03-29 11:55:30 -0700208 ],
209}
210
Chris Forbes0deebed2019-04-05 10:07:33 -0700211cc_library_shared {
212 name: "vulkan.pastel",
Hernan Liatis94e03052019-03-29 11:55:30 -0700213
Chris Forbes0deebed2019-04-05 10:07:33 -0700214 static_libs: [
215 "libswiftshadervk_llvm_debug",
Antonio Maiorano522b34c2020-07-09 15:04:13 -0400216 "libLLVM10_swiftshader",
Chris Forbes0deebed2019-04-05 10:07:33 -0700217 ],
218
Chris Forbes0deebed2019-04-05 10:07:33 -0700219 defaults: [
220 "libvk_swiftshader_common_defaults",
221 "libvk_swiftshader_defaults"
222 ],
223}
224
225cc_library_shared {
226 name: "vulkan.pastel.debug",
227
Chris Forbes0deebed2019-04-05 10:07:33 -0700228 static_libs: [
229 "libswiftshadervk_llvm_debug",
Jason Macnakfefd0852020-11-10 09:29:03 -0800230 "libLLVM10_swiftshader_debug",
Chris Forbes0deebed2019-04-05 10:07:33 -0700231 ],
232
Hernan Liatis94e03052019-03-29 11:55:30 -0700233 cflags: [
234 "-UNDEBUG",
235 "-g",
236 "-O0",
237 "-DDEFAULT_THREAD_COUNT=1",
238 ],
Hernan Liatis94e03052019-03-29 11:55:30 -0700239
240 defaults: [
Hernan Liatis94e03052019-03-29 11:55:30 -0700241 "libvk_swiftshader_common_defaults",
Chris Forbes0deebed2019-04-05 10:07:33 -0700242 "libvk_swiftshader_defaults",
Hernan Liatis94e03052019-03-29 11:55:30 -0700243 ],
Chris Forbes0deebed2019-04-05 10:07:33 -0700244}