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 += [ "GL_APICALL=" ] 32 33 if (is_clang) { 34 defines += [ 35 "__STDC_CONSTANT_MACROS", 36 "__STDC_LIMIT_MACROS", 37 ] 38 } 39 } else { 40 cflags = [ "-Wno-sign-compare" ] 41 if (!is_clang) { 42 cflags += [ "-Wno-unused-but-set-variable" ] 43 } 44 45 defines += [ 46 "__STDC_CONSTANT_MACROS", 47 "__STDC_LIMIT_MACROS", 48 "GL_APICALL=__attribute__((visibility(\"default\"))) __attribute__((no_sanitize(\"function\")))", 49 ] 50 } 51 } 52 53 swiftshader_static_library("swiftshader_libGLESv2_static") { 54 deps = [ 55 "../../OpenGL/compiler:swiftshader_opengl_compiler", 56 "../../Reactor:swiftshader_reactor", 57 "../../Renderer:swiftshader_renderer", 58 ] 59 60 sources = [ 61 "Buffer.cpp", 62 "Context.cpp", 63 "Device.cpp", 64 "Fence.cpp", 65 "Framebuffer.cpp", 66 "IndexDataManager.cpp", 67 "Program.cpp", 68 "Query.cpp", 69 "Renderbuffer.cpp", 70 "ResourceManager.cpp", 71 "Shader.cpp", 72 "Texture.cpp", 73 "TransformFeedback.cpp", 74 "VertexArray.cpp", 75 "VertexDataManager.cpp", 76 "libGLESv2.cpp", 77 "libGLESv3.cpp", 78 "main.cpp", 79 "resource.h", 80 "utilities.cpp", 81 ] 82 83 configs = [ ":swiftshader_libGLESv2_private_config" ] 84 85 include_dirs = [ 86 "../../../include", 87 "../..", 88 "..", 89 ] 90 } 91 92 swiftshader_shared_library("swiftshader_libGLESv2") { 93 if (!is_mac) { 94 output_name = "libGLESv2" 95 output_dir = "$root_out_dir/swiftshader" 96 } 97 98 deps = [ 99 ":swiftshader_libGLESv2_static", 100 "//build/config:exe_and_shlib_deps", 101 ] 102 103 sources = [ 104 "entry_points.cpp", 105 "libGLESv2.def", 106 "libGLESv2.rc", 107 ] 108 109 if (is_win) { 110 ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ] 111 } else if (is_mac) { 112 libs = [ 113 "CoreFoundation.framework", 114 "IOSurface.framework", 115 ] 116 ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libGLESv2.dylib" ] 117 } else if (is_linux) { 118 ldflags = 119 [ "-Wl,--version-script=" + rebase_path("libGLESv2.lds", root_build_dir) ] 120 } 121 122 configs = [ ":swiftshader_libGLESv2_private_config" ] 123 124 include_dirs = [ 125 "../../../include", 126 "../..", 127 "..", 128 ] 129 } 130