Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 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 | |
Alexis Hetu | 20eea3c | 2018-06-19 14:50:41 -0400 | [diff] [blame] | 15 | import("//build/config/ui.gni") |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 16 | import("../../swiftshader.gni") |
| 17 | |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 18 | # Need a separate config to ensure the warnings are added to the end. |
| 19 | config("swiftshader_libEGL_private_config") { |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 20 | defines = [ "EGL_EGLEXT_PROTOTYPES" ] |
| 21 | |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 22 | if (is_win) { |
| 23 | cflags = [ |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 24 | "/wd4201", # nameless struct/union |
| 25 | "/wd4065", # switch statement contains 'default' but no 'case' labels |
Nicolas Capens | 9ed48ba | 2017-05-11 11:25:00 -0400 | [diff] [blame] | 26 | "/wd5030", # attribute is not recognized |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 27 | ] |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 28 | |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 29 | defines += [ "EGLAPI=" ] |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 30 | } else { |
Stephen Lanham | fe79649 | 2018-09-07 11:59:54 -0700 | [diff] [blame] | 31 | cflags = [ |
| 32 | "-Wno-sign-compare", |
| 33 | "-Wno-unused-function", |
| 34 | ] |
Tom Anderson | 6f432a6 | 2017-03-28 13:58:52 -0700 | [diff] [blame] | 35 | if (!is_clang) { |
| 36 | cflags += [ "-Wno-unused-but-set-variable" ] |
| 37 | } |
| 38 | |
Nicolas Capens | c497261 | 2018-07-04 09:33:21 -0400 | [diff] [blame] | 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 | } |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 45 | } |
| 46 | } |
| 47 | |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 48 | swiftshader_shared_library("swiftshader_libEGL") { |
Alexis Hetu | 170766a | 2018-06-12 14:57:58 -0400 | [diff] [blame] | 49 | if (!is_mac && !is_fuchsia) { |
Nicolas Capens | 9282c6d | 2017-06-23 15:44:37 -0400 | [diff] [blame] | 50 | output_name = "libEGL" |
| 51 | output_dir = "$root_out_dir/swiftshader" |
| 52 | } |
Alexis Hetu | 3e204de | 2016-07-20 17:05:17 -0400 | [diff] [blame] | 53 | |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 54 | sources = [ |
Alexis Hetu | 0ab9f3b | 2018-11-26 17:25:23 -0500 | [diff] [blame] | 55 | "../../Common/SharedLibrary.cpp", |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 56 | "../common/Object.cpp", |
Nico Weber | a4afa24 | 2019-01-04 15:28:34 -0500 | [diff] [blame] | 57 | "../common/debug.cpp", |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 58 | "Config.cpp", |
| 59 | "Display.cpp", |
Nicolas Capens | 31c07a3 | 2017-06-13 23:44:13 -0400 | [diff] [blame] | 60 | "Surface.cpp", |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 61 | "libEGL.cpp", |
Alexis Hetu | d7260e2 | 2016-07-15 13:58:14 -0400 | [diff] [blame] | 62 | "libEGL.def", |
| 63 | "libEGL.rc", |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 64 | "main.cpp", |
Alexis Hetu | d7260e2 | 2016-07-15 13:58:14 -0400 | [diff] [blame] | 65 | "resource.h", |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 66 | ] |
| 67 | |
Alexis Hetu | 8be4110 | 2016-09-12 17:45:55 -0400 | [diff] [blame] | 68 | if (is_mac) { |
| 69 | sources += [ "OSXUtils.mm" ] |
| 70 | libs = [ |
| 71 | "Quartz.framework", |
| 72 | "Cocoa.framework", |
Alexis Hetu | c80eada | 2018-02-13 15:02:40 -0500 | [diff] [blame] | 73 | "CoreFoundation.framework", |
| 74 | "IOSurface.framework", |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 75 | ] |
Alexis Hetu | ec63fbe | 2019-07-15 14:33:11 -0400 | [diff] [blame] | 76 | ldflags = [ |
| 77 | "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib", |
| 78 | "-Wl,-exported_symbols_list," + |
| 79 | rebase_path("libEGL.exports", root_build_dir), |
| 80 | ] |
Alexis Hetu | 8be4110 | 2016-09-12 17:45:55 -0400 | [diff] [blame] | 81 | } else if (is_linux) { |
Alexis Hetu | 20eea3c | 2018-06-19 14:50:41 -0400 | [diff] [blame] | 82 | if (use_x11) { |
| 83 | sources += [ "../../Main/libX11.cpp" ] |
| 84 | } |
Tom Anderson | 42d6461 | 2019-06-12 11:05:21 -0700 | [diff] [blame] | 85 | inputs = [ |
| 86 | "libEGL.lds", |
| 87 | ] |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 88 | ldflags = |
Nicolas Capens | e75d334 | 2017-10-06 11:24:13 -0400 | [diff] [blame] | 89 | [ "-Wl,--version-script=" + rebase_path("libEGL.lds", root_build_dir) ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 90 | } |
| 91 | |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 92 | configs = [ ":swiftshader_libEGL_private_config" ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 93 | |
| 94 | include_dirs = [ |
| 95 | "../../../include", |
| 96 | "../..", |
| 97 | "..", |
| 98 | ] |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 99 | } |