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 15import("../../swiftshader.gni") 16 17# Need a separate config to ensure the warnings are added to the end. 18config("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 63swiftshader_static_library("swiftshader_libGLESv2_static") { 64 deps = [ 65 "../../OpenGL/common:swiftshader_opengl_common", 66 "../../OpenGL/compiler:swiftshader_opengl_compiler", 67 "../../Reactor:swiftshader_reactor", 68 "../../Renderer:swiftshader_renderer", 69 ] 70 71 sources = [ 72 "../../Common/SharedLibrary.cpp", 73 "Buffer.cpp", 74 "Context.cpp", 75 "Device.cpp", 76 "Fence.cpp", 77 "Framebuffer.cpp", 78 "IndexDataManager.cpp", 79 "Program.cpp", 80 "Query.cpp", 81 "Renderbuffer.cpp", 82 "ResourceManager.cpp", 83 "Shader.cpp", 84 "Texture.cpp", 85 "TransformFeedback.cpp", 86 "VertexArray.cpp", 87 "VertexDataManager.cpp", 88 "libGLESv2.cpp", 89 "libGLESv3.cpp", 90 "main.cpp", 91 "resource.h", 92 "utilities.cpp", 93 ] 94 95 if (is_mac) { 96 libs = [ 97 "CoreFoundation.framework", 98 "IOSurface.framework", 99 ] 100 } 101 102 configs = [ ":swiftshader_libGLESv2_private_config" ] 103 104 include_dirs = [ 105 "../../../include", 106 "../..", 107 "..", 108 ] 109} 110 111swiftshader_shared_library("swiftshader_libGLESv2") { 112 if (!is_mac && !is_fuchsia) { 113 output_name = "libGLESv2" 114 output_dir = "$root_out_dir/swiftshader" 115 } 116 117 deps = [ 118 ":swiftshader_libGLESv2_static", 119 ] 120 121 sources = [ 122 "entry_points.cpp", 123 "libGLESv2.def", 124 "libGLESv2.rc", 125 ] 126 127 if (is_mac) { 128 ldflags = [ 129 "-Wl,-install_name,@rpath/libswiftshader_libGLESv2.dylib", 130 "-Wl,-exported_symbols_list," + 131 rebase_path("libGLESv2.exports", root_build_dir), 132 ] 133 } else if (is_linux) { 134 inputs = [ 135 "libGLESv2.lds", 136 ] 137 ldflags = [ "-Wl,--version-script=" + 138 rebase_path("libGLESv2.lds", root_build_dir) ] 139 } 140 141 configs = [ ":swiftshader_libGLESv2_private_config" ] 142 143 include_dirs = [ 144 "../../../include", 145 "../..", 146 "..", 147 ] 148} 149