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 if (is_clang) { 43 defines += [ "EGLAPI=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ] 44 } else { 45 defines += [ "EGLAPI= " ] 46 } 47 } 48} 49 50swiftshader_shared_library("swiftshader_libEGL") { 51 if (!is_mac && !is_fuchsia) { 52 output_name = "libEGL" 53 output_dir = "$root_out_dir/swiftshader" 54 } 55 56 sources = [ 57 "../../Common/SharedLibrary.cpp", 58 "../common/Object.cpp", 59 "../common/debug.cpp", 60 "Config.cpp", 61 "Display.cpp", 62 "Surface.cpp", 63 "libEGL.cpp", 64 "main.cpp", 65 "resource.h", 66 ] 67 68 if (is_win) { 69 sources += [ 70 "libEGL.def", 71 "libEGL.rc", 72 ] 73 } 74 75 if (is_mac) { 76 sources += [ "OSXUtils.mm" ] 77 frameworks = [ 78 "Quartz.framework", 79 "Cocoa.framework", 80 "CoreFoundation.framework", 81 "IOSurface.framework", 82 ] 83 ldflags = [ 84 "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib", 85 "-Wl,-exported_symbols_list," + 86 rebase_path("libEGL.exports", root_build_dir), 87 ] 88 } else if (is_linux || is_chromeos) { 89 if (use_x11) { 90 sources += [ "../../Main/libX11.cpp" ] 91 } 92 inputs = [ "libEGL.lds" ] 93 ldflags = 94 [ "-Wl,--version-script=" + rebase_path("libEGL.lds", root_build_dir) ] 95 } 96 97 configs = [ ":swiftshader_libEGL_private_config" ] 98 99 include_dirs = [ 100 "../../../include", 101 "../..", 102 "..", 103 ] 104} 105