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("${skia_root_dir}/build/config/ui.gni") 16import("${skia_root_dir}/build/config/ozone.gni") 17import("../../swiftshader.gni") 18 19# Need a separate config to ensure the warnings are added to the end. 20config("swiftshader_libEGL_private_config") { 21 defines = [ "EGL_EGLEXT_PROTOTYPES" ] 22 23 if (is_win) { 24 cflags = [ 25 "/wd4201", # nameless struct/union 26 "/wd4065", # switch statement contains 'default' but no 'case' labels 27 "/wd5030", # attribute is not recognized 28 ] 29 30 defines += [ "EGLAPI=" ] 31 } else { 32 cflags = [ 33 "-Wno-sign-compare", 34 "-Wno-unused-function", 35 ] 36 37 if (is_mac) { 38 cflags += [ "-fvisibility=default" ] 39 defines += [ "EGLAPI=__attribute__((no_sanitize(\"function\")))" ] 40 } else if (is_clang) { 41 defines += [ "EGLAPI=__attribute__((visibility(\"protected\"))) __attribute__((no_sanitize(\"function\")))" ] 42 } else { 43 defines += [ "EGLAPI=__attribute__((visibility(\"protected\")))" ] 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 "main.cpp", 63 "resource.h", 64 ] 65 66 if (is_win) { 67 sources += [ 68 "libEGL.def", 69 "libEGL.rc", 70 ] 71 } 72 73 defines = [] 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_deprecated.exports", root_build_dir), 87 ] 88 } else if (is_linux || is_chromeos) { 89 if (ozone_platform_x11) { 90 sources += [ "../../Main/libX11.cpp" ] 91 defines += [ "SWIFTSHADER_USE_X11" ] 92 } 93 inputs = [ "libEGL_deprecated.lds" ] 94 ldflags = 95 [ "-Wl,--version-script=" + rebase_path("libEGL_deprecated.lds", root_build_dir) ] 96 } 97 98 configs = [ ":swiftshader_libEGL_private_config" ] 99 100 include_dirs = [ 101 "../../../include", 102 "../..", 103 "..", 104 ] 105} 106