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