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