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 17cc_defaults { 18 name: "libswiftshader", 19 20 device_supported: false, 21 host_supported: true, 22 vendor: true, 23 24 defaults: [ "swiftshader_common" ], 25 26 cflags: [ 27 "-D_GNU_SOURCE", 28 "-D__STDC_LIMIT_MACROS", 29 "-D__STDC_CONSTANT_MACROS", 30 "-D__STDC_FORMAT_MACROS", 31 "-DHAVE_GRALLOC1", 32 "-DNO_SANITIZE_FUNCTION=", 33 // FIXME: Use <android/api-level.h> instead? 34 "-DANDROID_PLATFORM_SDK_VERSION=10000", 35 "-Wno-implicit-fallthrough", 36 "-Wno-unused-parameter", 37 "-Wno-unused-local-typedef", 38 ], 39 40 cppflags: [ 41 "-Wno-sign-promo", 42 "-Wno-non-virtual-dtor", 43 ], 44 45 local_include_dirs: [ "OpenGL" ], 46 47 target: { 48 android: { 49 relative_install_path: "hw", 50 header_libs: [ 51 "swiftshader_platform_headers", 52 ], 53 shared_libs: [ 54 "libnativewindow", 55 "libhardware", 56 "libcutils", 57 "libsync", 58 "liblog", 59 ], 60 }, 61 62 host: { 63 header_libs: [ 64 "swiftshader_host_headers", 65 "swiftshader_platform_headers", 66 ], 67 68 // Pretend to build for Android 69 cflags: [ "-D__ANDROID__", "-DANDROID_HOST_BUILD" ], 70 71 allow_undefined_symbols: true, 72 host_ldlibs: ["-ldl"], 73 }, 74 }, 75} 76 77cc_defaults { 78 name: "libswiftshader_release", 79 80 defaults: [ "libswiftshader" ], 81 82 cflags: [ 83 "-fomit-frame-pointer", 84 "-ffunction-sections", 85 "-fdata-sections", 86 "-DANGLE_DISABLE_TRACE", 87 ], 88} 89 90cc_defaults { 91 name: "libswiftshader_debug", 92 93 defaults: [ "libswiftshader" ], 94 95 cflags: [ 96 "-UNDEBUG", 97 "-g", 98 "-O0", 99 "-DDEFAULT_THREAD_COUNT=1", 100 ], 101} 102 103// Common libraries 104 105cc_defaults { 106 name: "libswiftshader_common_defaults", 107 108 cflags: [ 109 "-DLOG_TAG=\"swiftshader\"", 110 ], 111 112 srcs: [ 113 "Common/CPUID.cpp", 114 "Common/Configurator.cpp", 115 "Common/DebugAndroid.cpp", 116 "Common/GrallocAndroid.cpp", 117 "Common/Half.cpp", 118 "Common/Math.cpp", 119 "Common/Memory.cpp", 120 "Common/Resource.cpp", 121 "Common/Socket.cpp", 122 "Common/Thread.cpp", 123 "Common/Timer.cpp", 124 "Main/Config.cpp", 125 "Main/FrameBuffer.cpp", 126 "Main/FrameBufferAndroid.cpp", 127 "Main/SwiftConfig.cpp", 128 "Renderer/Blitter.cpp", 129 "Renderer/Clipper.cpp", 130 "Renderer/Color.cpp", 131 "Renderer/Context.cpp", 132 "Renderer/ETC_Decoder.cpp", 133 "Renderer/Matrix.cpp", 134 "Renderer/PixelProcessor.cpp", 135 "Renderer/Plane.cpp", 136 "Renderer/Point.cpp", 137 "Renderer/QuadRasterizer.cpp", 138 "Renderer/Renderer.cpp", 139 "Renderer/Sampler.cpp", 140 "Renderer/SetupProcessor.cpp", 141 "Renderer/Surface.cpp", 142 "Renderer/TextureStage.cpp", 143 "Renderer/Vector.cpp", 144 "Renderer/VertexProcessor.cpp", 145 "Shader/Constants.cpp", 146 "Shader/PixelPipeline.cpp", 147 "Shader/PixelProgram.cpp", 148 "Shader/PixelRoutine.cpp", 149 "Shader/PixelShader.cpp", 150 "Shader/SamplerCore.cpp", 151 "Shader/SetupRoutine.cpp", 152 "Shader/Shader.cpp", 153 "Shader/ShaderCore.cpp", 154 "Shader/VertexPipeline.cpp", 155 "Shader/VertexProgram.cpp", 156 "Shader/VertexRoutine.cpp", 157 "Shader/VertexShader.cpp", 158 "OpenGL/common/Image.cpp", 159 "OpenGL/common/Object.cpp", 160 "OpenGL/common/MatrixStack.cpp", 161 ], 162 163 target: { 164 host: { 165 exclude_srcs: [ "Common/DebugAndroid.cpp" ], 166 srcs: [ "Common/Debug.cpp" ], 167 }, 168 }, 169} 170 171cc_defaults { 172 name: "libswiftshader_llvm_defaults", 173 174 defaults: [ "libswiftshader_common_defaults" ], 175 176 srcs: [ 177 "Reactor/LLVMReactor.cpp", 178 "Reactor/Routine.cpp", 179 "Reactor/LLVMRoutine.cpp", 180 "Reactor/LLVMRoutineManager.cpp", 181 ], 182 183 static_libs: [ 184 "libLLVM_swiftshader", 185 ], 186} 187 188cc_defaults { 189 name: "libswiftshader_common", 190 191 defaults: [ "libswiftshader_release", "libswiftshader_common_defaults" ], 192} 193 194cc_defaults { 195 name: "libswiftshader_common_debug", 196 197 srcs: [ "OpenGL/common/debug.cpp" ], 198 199 defaults: [ "libswiftshader_debug", "libswiftshader_common_defaults" ], 200} 201 202cc_library_static { 203 name: "libswiftshader_llvm", 204 205 defaults: [ "libswiftshader_common", "libswiftshader_llvm_defaults" ], 206 device_supported: false, 207} 208 209cc_library_static { 210 name: "libswiftshader_llvm_debug", 211 device_supported: false, 212 213 defaults: [ "libswiftshader_common_debug", "libswiftshader_llvm_defaults" ], 214} 215 216// compiler libraries 217 218cc_defaults { 219 name: "libswiftshader_compiler_defaults", 220 221 defaults: [ "libswiftshader" ], 222 223 cflags: [ 224 "-DLOG_TAG=\"swiftshader_compiler\"", 225 ], 226 227 srcs: [ 228 "OpenGL/compiler/preprocessor/DiagnosticsBase.cpp", 229 "OpenGL/compiler/preprocessor/DirectiveHandlerBase.cpp", 230 "OpenGL/compiler/preprocessor/DirectiveParser.cpp", 231 "OpenGL/compiler/preprocessor/ExpressionParser.cpp", 232 "OpenGL/compiler/preprocessor/Input.cpp", 233 "OpenGL/compiler/preprocessor/Lexer.cpp", 234 "OpenGL/compiler/preprocessor/Macro.cpp", 235 "OpenGL/compiler/preprocessor/MacroExpander.cpp", 236 "OpenGL/compiler/preprocessor/Preprocessor.cpp", 237 "OpenGL/compiler/preprocessor/Token.cpp", 238 "OpenGL/compiler/preprocessor/Tokenizer.cpp", 239 "OpenGL/compiler/AnalyzeCallDepth.cpp", 240 "OpenGL/compiler/Compiler.cpp", 241 "OpenGL/compiler/debug.cpp", 242 "OpenGL/compiler/Diagnostics.cpp", 243 "OpenGL/compiler/DirectiveHandler.cpp", 244 "OpenGL/compiler/glslang_lex.cpp", 245 "OpenGL/compiler/glslang_tab.cpp", 246 "OpenGL/compiler/InfoSink.cpp", 247 "OpenGL/compiler/Initialize.cpp", 248 "OpenGL/compiler/InitializeParseContext.cpp", 249 "OpenGL/compiler/IntermTraverse.cpp", 250 "OpenGL/compiler/Intermediate.cpp", 251 "OpenGL/compiler/intermOut.cpp", 252 "OpenGL/compiler/ossource_posix.cpp", 253 "OpenGL/compiler/OutputASM.cpp", 254 "OpenGL/compiler/parseConst.cpp", 255 "OpenGL/compiler/ParseHelper.cpp", 256 "OpenGL/compiler/PoolAlloc.cpp", 257 "OpenGL/compiler/SymbolTable.cpp", 258 "OpenGL/compiler/TranslatorASM.cpp", 259 "OpenGL/compiler/util.cpp", 260 "OpenGL/compiler/ValidateLimitations.cpp", 261 "OpenGL/compiler/ValidateSwitch.cpp", 262 ], 263} 264 265cc_library_static { 266 name: "libswiftshader_compiler", 267 268 defaults: [ "libswiftshader_release", "libswiftshader_compiler_defaults" ], 269} 270 271cc_library_static { 272 name: "libswiftshader_compiler_debug", 273 274 defaults: [ "libswiftshader_debug", "libswiftshader_compiler_defaults" ], 275} 276 277// libEGL libraries 278 279cc_defaults { 280 name: "swiftshader_client_libraries_subzero_or_llvm", 281 282 defaults: [ "libswiftshader_release" ], 283 284 target: { 285 android: { 286 static_libs: [ 287 "libswiftshader_llvm", 288 "libLLVM_swiftshader", 289 ], 290 }, 291 292 host: { 293 static_libs: [ 294 "libswiftshader_llvm", 295 "libLLVM_swiftshader", 296 ], 297 }, 298 }, 299} 300 301cc_defaults { 302 name: "swiftshader_client_libraries_subzero_or_llvm_debug", 303 304 defaults: [ "libswiftshader_debug" ], 305 306 target: { 307 android: { 308 static_libs: [ 309 "libswiftshader_llvm_debug", 310 "libLLVM_swiftshader", 311 ], 312 }, 313 314 host: { 315 static_libs: [ 316 "libswiftshader_llvm_debug", 317 "libLLVM_swiftshader", 318 ], 319 }, 320 }, 321} 322 323cc_defaults { 324 name: "libEGL_swiftshader_defaults", 325 326 defaults: [ "libswiftshader" ], 327 328 cflags: [ 329 "-DLOG_TAG=\"libEGL_swiftshader\"", 330 "-DEGLAPI=", 331 "-DEGL_EGLEXT_PROTOTYPES", 332 "-Wno-format", 333 ], 334 335 srcs: [ 336 "OpenGL/libEGL/Config.cpp", 337 "OpenGL/libEGL/Display.cpp", 338 "OpenGL/libEGL/Surface.cpp", 339 "OpenGL/libEGL/libEGL.cpp", 340 "OpenGL/libEGL/main.cpp", 341 ], 342 343 version_script: "OpenGL/libEGL/libEGL.lds", 344} 345 346cc_library_shared { 347 name: "libEGL_swiftshader", 348 349 defaults: [ 350 "libEGL_swiftshader_defaults", 351 "swiftshader_client_libraries_subzero_or_llvm", 352 ], 353 device_supported: false, 354} 355 356cc_library_shared { 357 name: "libEGL_swiftshader_debug", 358 359 defaults: [ 360 "libEGL_swiftshader_defaults", 361 "swiftshader_client_libraries_subzero_or_llvm_debug", 362 ], 363 device_supported: false, 364} 365 366// libGLESv1_CM libraries 367 368cc_defaults { 369 name: "libGLESv1_CM_swiftshader_defaults", 370 371 defaults: [ "libswiftshader" ], 372 373 cflags: [ 374 "-DLOG_TAG=\"libGLES_CM_swiftshader\"", 375 "-DEGLAPI=", 376 "-DGL_API=", 377 "-DGL_APICALL=", 378 "-DGL_GLEXT_PROTOTYPES", 379 "-Wno-format", 380 ], 381 382 srcs: [ 383 "OpenGL/libGLES_CM/Buffer.cpp", 384 "OpenGL/libGLES_CM/Context.cpp", 385 "OpenGL/libGLES_CM/Device.cpp", 386 "OpenGL/libGLES_CM/Framebuffer.cpp", 387 "OpenGL/libGLES_CM/IndexDataManager.cpp", 388 "OpenGL/libGLES_CM/libGLES_CM.cpp", 389 "OpenGL/libGLES_CM/main.cpp", 390 "OpenGL/libGLES_CM/Renderbuffer.cpp", 391 "OpenGL/libGLES_CM/ResourceManager.cpp", 392 "OpenGL/libGLES_CM/Texture.cpp", 393 "OpenGL/libGLES_CM/utilities.cpp", 394 "OpenGL/libGLES_CM/VertexDataManager.cpp", 395 ], 396 397 version_script: "OpenGL/libGLES_CM/libGLES_CM.lds", 398} 399 400cc_library_shared { 401 name: "libGLESv1_CM_swiftshader", 402 403 defaults: [ 404 "libGLESv1_CM_swiftshader_defaults", 405 "swiftshader_client_libraries_subzero_or_llvm", 406 ], 407 device_supported: false, 408} 409 410cc_library_shared { 411 name: "libGLESv1_CM_swiftshader_debug", 412 413 defaults: [ 414 "libGLESv1_CM_swiftshader_defaults", 415 "swiftshader_client_libraries_subzero_or_llvm_debug", 416 ], 417 device_supported: false, 418} 419 420// libGLESv2 libraries 421 422cc_defaults { 423 name: "libGLESv2_swiftshader_defaults", 424 425 defaults: [ "libswiftshader" ], 426 device_supported: false, 427 428 cflags: [ 429 "-DLOG_TAG=\"libGLESv2_swiftshader\"", 430 "-DEGLAPI=", 431 "-DGL_API=", 432 "-DGL_APICALL=", 433 "-DGL_GLEXT_PROTOTYPES", 434 "-Wno-format", 435 ], 436 437 srcs: [ 438 "OpenGL/libGLESv2/Buffer.cpp", 439 "OpenGL/libGLESv2/Context.cpp", 440 "OpenGL/libGLESv2/Device.cpp", 441 "OpenGL/libGLESv2/Fence.cpp", 442 "OpenGL/libGLESv2/Framebuffer.cpp", 443 "OpenGL/libGLESv2/IndexDataManager.cpp", 444 "OpenGL/libGLESv2/libGLESv2.cpp", 445 "OpenGL/libGLESv2/libGLESv3.cpp", 446 "OpenGL/libGLESv2/main.cpp", 447 "OpenGL/libGLESv2/entry_points.cpp", 448 "OpenGL/libGLESv2/Program.cpp", 449 "OpenGL/libGLESv2/Query.cpp", 450 "OpenGL/libGLESv2/Renderbuffer.cpp", 451 "OpenGL/libGLESv2/ResourceManager.cpp", 452 "OpenGL/libGLESv2/Shader.cpp", 453 "OpenGL/libGLESv2/Texture.cpp", 454 "OpenGL/libGLESv2/TransformFeedback.cpp", 455 "OpenGL/libGLESv2/utilities.cpp", 456 "OpenGL/libGLESv2/VertexArray.cpp", 457 "OpenGL/libGLESv2/VertexDataManager.cpp", 458 ], 459 460 version_script: "OpenGL/libGLESv2/libGLESv2.lds", 461} 462 463cc_library_shared { 464 name: "libGLESv2_swiftshader", 465 466 defaults: [ 467 "libGLESv2_swiftshader_defaults", 468 "swiftshader_client_libraries_subzero_or_llvm", 469 ], 470 device_supported: false, 471 472 static_libs: [ "libswiftshader_compiler" ], 473} 474 475cc_library_shared { 476 name: "libGLESv2_swiftshader_debug", 477 478 defaults: [ 479 "libGLESv2_swiftshader_defaults", 480 "swiftshader_client_libraries_subzero_or_llvm_debug", 481 ], 482 device_supported: false, 483 484 static_libs: [ "libswiftshader_compiler_debug" ], 485} 486