Alistair Strachan | 60f8662 | 2018-03-22 17:37:55 -0700 | [diff] [blame] | 1 | // |
| 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 Capens | 0ca03fb | 2021-05-10 13:37:21 -0400 | [diff] [blame] | 17 | package { |
| 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 Strachan | 60f8662 | 2018-03-22 17:37:55 -0700 | [diff] [blame] | 26 | cc_defaults { |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 27 | name: "libswiftshadervk_llvm_defaults", |
| 28 | |
Ben Clayton | 25e06e0 | 2020-02-07 11:19:08 +0000 | [diff] [blame] | 29 | header_libs: [ |
| 30 | "swiftshader_platform_headers", |
| 31 | ], |
| 32 | |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 33 | srcs: [ |
Nicolas Capens | 08c6200 | 2021-11-17 00:25:05 -0500 | [diff] [blame] | 34 | "Reactor/Assert.cpp", |
Ben Clayton | b3b2a4f | 2020-02-08 14:20:20 +0000 | [diff] [blame] | 35 | "Reactor/CPUID.cpp", |
| 36 | "Reactor/Debug.cpp", |
Ben Clayton | b3b2a4f | 2020-02-08 14:20:20 +0000 | [diff] [blame] | 37 | "Reactor/ExecutableMemory.cpp", |
Nicolas Capens | f1223ce | 2020-11-02 12:53:45 -0500 | [diff] [blame] | 38 | "Reactor/LLVMJIT.cpp", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 39 | "Reactor/LLVMReactor.cpp", |
Nicolas Capens | 9c5d0d7 | 2021-06-29 12:55:27 -0400 | [diff] [blame] | 40 | "Reactor/Pragma.cpp", |
Ben Clayton | b3b2a4f | 2020-02-08 14:20:20 +0000 | [diff] [blame] | 41 | "Reactor/Reactor.cpp", |
Nicolas Capens | 3b0ad20 | 2022-06-02 15:02:31 -0400 | [diff] [blame] | 42 | "Reactor/SIMD.cpp", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 43 | ], |
| 44 | |
| 45 | cflags: [ |
Alistair Delva | 790b325 | 2021-02-09 13:20:14 -0800 | [diff] [blame] | 46 | "-DREACTOR_ANONYMOUS_MMAP_NAME=swiftshader_jit", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 47 | "-Wno-unused-parameter", |
| 48 | "-Wno-implicit-fallthrough", |
| 49 | ], |
| 50 | |
| 51 | static_libs: [ |
Antonio Maiorano | 522b34c | 2020-07-09 15:04:13 -0400 | [diff] [blame] | 52 | "libLLVM10_swiftshader", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 53 | ], |
| 54 | |
| 55 | shared_libs: [ |
| 56 | "libcutils", |
Ben Clayton | 25e06e0 | 2020-02-07 11:19:08 +0000 | [diff] [blame] | 57 | "liblog", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 58 | ], |
| 59 | } |
| 60 | |
Alistair Strachan | 60f8662 | 2018-03-22 17:37:55 -0700 | [diff] [blame] | 61 | cc_library_static { |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 62 | name: "libswiftshadervk_llvm", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 63 | vendor: true, |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 64 | defaults: [ "libswiftshadervk_llvm_defaults" ], |
| 65 | } |
| 66 | |
| 67 | cc_library_static { |
| 68 | name: "libswiftshadervk_llvm_debug", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 69 | vendor: true, |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 70 | defaults: [ "libswiftshadervk_llvm_defaults" ], |
| 71 | } |
| 72 | |
Tim Van Patten | 9da287f | 2019-11-07 10:27:18 -0700 | [diff] [blame] | 73 | genrule { |
| 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 Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 80 | cc_defaults { |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 81 | name: "libvk_swiftshader_defaults", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 82 | 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 Macnak | 1de497c | 2020-04-08 11:31:50 -0700 | [diff] [blame] | 92 | "-DHAVE_GRALLOC3", |
Jason Macnak | b33e0b3 | 2020-04-08 11:31:50 -0700 | [diff] [blame] | 93 | "-DHAVE_GRALLOC4", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 94 | // 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 Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 99 | "-Wno-missing-field-initializers", |
Tim Van Patten | 9da287f | 2019-11-07 10:27:18 -0700 | [diff] [blame] | 100 | // Enable to output commit hash when SwiftShader is initialized |
| 101 | //"-DENABLE_BUILD_VERSION_OUTPUT", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 102 | ], |
| 103 | |
| 104 | cppflags: [ |
| 105 | "-Wno-sign-promo", |
| 106 | "-Wno-non-virtual-dtor", |
| 107 | ], |
| 108 | |
Nicolas Capens | e3621dc | 2020-02-25 22:45:42 -0500 | [diff] [blame] | 109 | 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 Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 115 | local_include_dirs: [ "Vulkan" ], |
| 116 | |
Lingfeng Yang | ddee0f3 | 2020-02-03 18:04:48 -0800 | [diff] [blame] | 117 | version_script: "Vulkan/android_vk_swiftshader.lds", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 118 | |
Tim Van Patten | 9da287f | 2019-11-07 10:27:18 -0700 | [diff] [blame] | 119 | generated_headers: [ "commit_header" ], |
| 120 | |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 121 | target: { |
| 122 | android: { |
| 123 | relative_install_path: "hw", |
| 124 | header_libs: [ |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 125 | "swiftshader_platform_headers", |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 126 | "vulkan_headers", |
Chris Forbes | d6ccc31 | 2019-04-23 17:39:58 -0700 | [diff] [blame] | 127 | "hwvulkan_headers", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 128 | ], |
| 129 | shared_libs: [ |
Jason Macnak | 1de497c | 2020-04-08 11:31:50 -0700 | [diff] [blame] | 130 | "android.hardware.graphics.mapper@3.0", |
Jason Macnak | b33e0b3 | 2020-04-08 11:31:50 -0700 | [diff] [blame] | 131 | "android.hardware.graphics.mapper@4.0", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 132 | "libnativewindow", |
| 133 | "libhardware", |
Jason Macnak | 1de497c | 2020-04-08 11:31:50 -0700 | [diff] [blame] | 134 | "libhidlbase", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 135 | "libcutils", |
| 136 | "libsync", |
| 137 | "liblog", |
Jason Macnak | 1de497c | 2020-04-08 11:31:50 -0700 | [diff] [blame] | 138 | "libutils", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 139 | ], |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 140 | static_libs: [ |
| 141 | "libarect", |
| 142 | ], |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 143 | }, |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 144 | }, |
| 145 | } |
| 146 | |
Alexis Hetu | 1b90087 | 2020-02-24 12:09:16 -0500 | [diff] [blame] | 147 | cc_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 Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 169 | cc_defaults { |
| 170 | name: "libvk_swiftshader_common_defaults", |
| 171 | |
| 172 | cflags: [ |
| 173 | "-DLOG_TAG=\"swiftshader\"", |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 174 | "-DSWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER", |
Nicolas Capens | a4347a9 | 2020-03-01 08:29:25 -0500 | [diff] [blame] | 175 | "-DSWIFTSHADER_ENABLE_ASTC", // TODO(b/150130101) |
Yiwei Zhang | 0600201 | 2020-11-08 16:09:35 -0800 | [diff] [blame] | 176 | //"-DSWIFTSHADER_DEVICE_MEMORY_REPORT", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 177 | ], |
| 178 | |
| 179 | srcs: [ |
Ben Clayton | 77c89ff | 2020-01-08 19:10:14 +0000 | [diff] [blame] | 180 | "System/Build.cpp", |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 181 | "System/Configurator.cpp", |
Ben Clayton | 25e06e0 | 2020-02-07 11:19:08 +0000 | [diff] [blame] | 182 | "System/CPUID.cpp", |
Ben Clayton | 25e06e0 | 2020-02-07 11:19:08 +0000 | [diff] [blame] | 183 | "System/GrallocAndroid.cpp", |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 184 | "System/Half.cpp", |
David 'Digit' Turner | c9fa9fe | 2019-08-13 19:05:01 +0200 | [diff] [blame] | 185 | "System/Linux/MemFd.cpp", |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 186 | "System/Math.cpp", |
| 187 | "System/Memory.cpp", |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 188 | "System/Socket.cpp", |
Daniele Vettorel | 366db5a | 2022-01-24 17:01:45 +0000 | [diff] [blame] | 189 | "System/SwiftConfig.cpp", |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 190 | "System/Timer.cpp", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 191 | "Device/*.cpp", |
| 192 | "Pipeline/*.cpp", |
| 193 | "Vulkan/*.cpp", |
Jason Macnak | 99e54b1 | 2021-01-25 06:57:54 -0800 | [diff] [blame] | 194 | "WSI/HeadlessSurfaceKHR.cpp", |
| 195 | "WSI/VkSurfaceKHR.cpp", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 196 | ], |
| 197 | |
| 198 | static_libs: [ |
Alexis Hetu | 1b90087 | 2020-02-24 12:09:16 -0500 | [diff] [blame] | 199 | "swiftshader_astc", |
| 200 | "swiftshader_debug", |
Ben Clayton | e693b62 | 2019-09-05 12:48:37 +0100 | [diff] [blame] | 201 | "swiftshader_marl", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 202 | "swiftshader_spirv-tools", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 203 | ], |
| 204 | |
| 205 | include_dirs: [ |
| 206 | "external/swiftshader/third_party/SPIRV-Headers/include", |
Trevor David Black | 16636f4 | 2020-09-16 23:11:08 +0000 | [diff] [blame] | 207 | "external/swiftshader/include", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 208 | ], |
| 209 | } |
| 210 | |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 211 | cc_library_shared { |
| 212 | name: "vulkan.pastel", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 213 | |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 214 | static_libs: [ |
| 215 | "libswiftshadervk_llvm_debug", |
Antonio Maiorano | 522b34c | 2020-07-09 15:04:13 -0400 | [diff] [blame] | 216 | "libLLVM10_swiftshader", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 217 | ], |
| 218 | |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 219 | defaults: [ |
| 220 | "libvk_swiftshader_common_defaults", |
| 221 | "libvk_swiftshader_defaults" |
| 222 | ], |
| 223 | } |
| 224 | |
| 225 | cc_library_shared { |
| 226 | name: "vulkan.pastel.debug", |
| 227 | |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 228 | static_libs: [ |
| 229 | "libswiftshadervk_llvm_debug", |
Jason Macnak | fefd085 | 2020-11-10 09:29:03 -0800 | [diff] [blame] | 230 | "libLLVM10_swiftshader_debug", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 231 | ], |
| 232 | |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 233 | cflags: [ |
| 234 | "-UNDEBUG", |
| 235 | "-g", |
| 236 | "-O0", |
| 237 | "-DDEFAULT_THREAD_COUNT=1", |
| 238 | ], |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 239 | |
| 240 | defaults: [ |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 241 | "libvk_swiftshader_common_defaults", |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 242 | "libvk_swiftshader_defaults", |
Hernan Liatis | 94e0305 | 2019-03-29 11:55:30 -0700 | [diff] [blame] | 243 | ], |
Chris Forbes | 0deebed | 2019-04-05 10:07:33 -0700 | [diff] [blame] | 244 | } |