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("//build/config/ui.gni") 16import("../../swiftshader.gni") 17 18# Need a separate config to ensure the warnings are added to the end. 19config("swiftshader_libEGL_private_config") { 20 defines = [ "EGL_EGLEXT_PROTOTYPES" ] 21 22 if (is_win) { 23 cflags = [ 24 "/wd4201", # nameless struct/union 25 "/wd4065", # switch statement contains 'default' but no 'case' labels 26 "/wd5030", # attribute is not recognized 27 ] 28 29 defines += [ "EGLAPI=" ] 30 } else { 31 cflags = [ 32 "-Wno-sign-compare", 33 "-Wno-unused-function", 34 ] 35 if (!is_clang) { 36 cflags += [ "-Wno-unused-but-set-variable" ] 37 } 38 39 if (is_mac) { 40 cflags += [ "-fvisibility=protected" ] 41 defines += [ "EGLAPI=__attribute__((no_sanitize(\"function\")))" ] 42 } else { 43 defines += [ "EGLAPI=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ] 44 } 45 } 46} 47 48swiftshader_shared_library("swiftshader_libEGL") { 49 if (!is_mac && !is_fuchsia) { 50 output_name = "libEGL" 51 output_dir = "$root_out_dir/swiftshader" 52 } 53 54 sources = [ 55 "../../Common/SharedLibrary.cpp", 56 "../common/Object.cpp", 57 "../common/debug.cpp", 58 "Config.cpp", 59 "Display.cpp", 60 "Surface.cpp", 61 "libEGL.cpp", 62 "libEGL.def", 63 "libEGL.rc", 64 "main.cpp", 65 "resource.h", 66 ] 67 68 if (is_mac) { 69 sources += [ "OSXUtils.mm" ] 70 libs = [ 71 "Quartz.framework", 72 "Cocoa.framework", 73 "CoreFoundation.framework", 74 "IOSurface.framework", 75 ] 76 ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib" ] 77 } else if (is_linux) { 78 if (use_x11) { 79 sources += [ "../../Main/libX11.cpp" ] 80 } 81 ldflags = 82 [ "-Wl,--version-script=" + rebase_path("libEGL.lds", root_build_dir) ] 83 } 84 85 configs = [ ":swiftshader_libEGL_private_config" ] 86 87 include_dirs = [ 88 "../../../include", 89 "../..", 90 "..", 91 ] 92} 93