1 # Copyright 2016 The SwiftShader Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 import("../../swiftshader.gni") 16 17 # Need a separate config to ensure the warnings are added to the end. 18 config("swiftshader_libGLESv2_private_config") { 19 defines = [ 20 "GL_API=", 21 "GL_GLEXT_PROTOTYPES", 22 ] 23 24 if (is_win) { 25 cflags = [ 26 "/wd4201", # nameless struct/union 27 "/wd4324", # structure was padded due to alignment specifier 28 "/wd5030", # attribute is not recognized 29 ] 30 31 defines += [ 32 "GL_APICALL=", 33 "GLAPI=", 34 ] 35 36 if (is_clang) { 37 defines += [ 38 "__STDC_CONSTANT_MACROS", 39 "__STDC_LIMIT_MACROS", 40 ] 41 } 42 } else { 43 cflags = [ "-Wno-sign-compare" ] 44 if (!is_clang) { 45 cflags += [ "-Wno-unused-but-set-variable" ] 46 } 47 48 defines += [ 49 "__STDC_CONSTANT_MACROS", 50 "__STDC_LIMIT_MACROS", 51 "GLAPI=GL_APICALL", 52 ] 53 54 if (is_mac) { 55 cflags += [ "-fvisibility=protected" ] 56 defines += [ "GL_APICALL=__attribute__((no_sanitize(\"function\")))" ] 57 } else { 58 defines += [ "GL_APICALL=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ] 59 } 60 } 61 } 62 63 swiftshader_static_library("swiftshader_libGLESv2_static") { 64 deps = [ 65 "../../OpenGL/compiler:swiftshader_opengl_compiler", 66 "../../Reactor:swiftshader_reactor", 67 "../../Renderer:swiftshader_renderer", 68 ] 69 70 sources = [ 71 "../../Common/SharedLibrary.cpp", 72 "Buffer.cpp", 73 "Context.cpp", 74 "Device.cpp", 75 "Fence.cpp", 76 "Framebuffer.cpp", 77 "IndexDataManager.cpp", 78 "Program.cpp", 79 "Query.cpp", 80 "Renderbuffer.cpp", 81 "ResourceManager.cpp", 82 "Shader.cpp", 83 "Texture.cpp", 84 "TransformFeedback.cpp", 85 "VertexArray.cpp", 86 "VertexDataManager.cpp", 87 "libGLESv2.cpp", 88 "libGLESv3.cpp", 89 "main.cpp", 90 "resource.h", 91 "utilities.cpp", 92 ] 93 94 if (is_mac) { 95 libs = [ 96 "CoreFoundation.framework", 97 "IOSurface.framework", 98 ] 99 } 100 101 configs = [ ":swiftshader_libGLESv2_private_config" ] 102 103 include_dirs = [ 104 "../../../include", 105 "../..", 106 "..", 107 ] 108 } 109 110 swiftshader_shared_library("swiftshader_libGLESv2") { 111 if (!is_mac && !is_fuchsia) { 112 output_name = "libGLESv2" 113 output_dir = "$root_out_dir/swiftshader" 114 } 115 116 deps = [ 117 ":swiftshader_libGLESv2_static", 118 ] 119 120 sources = [ 121 "entry_points.cpp", 122 "libGLESv2.def", 123 "libGLESv2.rc", 124 ] 125 126 if (is_mac) { 127 ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libGLESv2.dylib" ] 128 } else if (is_linux) { 129 ldflags = [ "-Wl,--version-script=" + 130 rebase_path("libGLESv2.lds", root_build_dir) ] 131 } 132 133 configs = [ ":swiftshader_libGLESv2_private_config" ] 134 135 include_dirs = [ 136 "../../../include", 137 "../..", 138 "..", 139 ] 140 } 141