blob: a17a3a7562386d3f0f34353c380d3a9f05d69552 [file] [log] [blame]
Alexis Hetu91f10e32016-06-07 19:53:42 -04001# 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 Hetu20eea3c2018-06-19 14:50:41 -040015import("//build/config/ui.gni")
Alexis Hetu9441b072017-08-02 08:40:37 -040016import("../../swiftshader.gni")
17
Alexis Hetu91f10e32016-06-07 19:53:42 -040018# Need a separate config to ensure the warnings are added to the end.
19config("swiftshader_libEGL_private_config") {
Alexis Hetu2ddef882017-03-14 15:11:15 -040020 defines = [ "EGL_EGLEXT_PROTOTYPES" ]
21
Alexis Hetu03b67af2016-08-31 17:25:40 -040022 if (is_win) {
23 cflags = [
Alexis Hetud6d10f92016-11-22 13:47:04 -050024 "/wd4201", # nameless struct/union
25 "/wd4065", # switch statement contains 'default' but no 'case' labels
Nicolas Capens9ed48ba2017-05-11 11:25:00 -040026 "/wd5030", # attribute is not recognized
Alexis Hetu03b67af2016-08-31 17:25:40 -040027 ]
Alexis Hetu2ddef882017-03-14 15:11:15 -040028
Alexis Hetu9441b072017-08-02 08:40:37 -040029 defines += [ "EGLAPI=" ]
Alexis Hetu2ddef882017-03-14 15:11:15 -040030 } else {
Stephen Lanhamfe796492018-09-07 11:59:54 -070031 cflags = [
32 "-Wno-sign-compare",
33 "-Wno-unused-function",
34 ]
Tom Anderson6f432a62017-03-28 13:58:52 -070035 if (!is_clang) {
36 cflags += [ "-Wno-unused-but-set-variable" ]
37 }
38
Nicolas Capensc4972612018-07-04 09:33:21 -040039 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 Hetu91f10e32016-06-07 19:53:42 -040045 }
46}
47
Alexis Hetu9441b072017-08-02 08:40:37 -040048swiftshader_shared_library("swiftshader_libEGL") {
Alexis Hetu170766a2018-06-12 14:57:58 -040049 if (!is_mac && !is_fuchsia) {
Nicolas Capens9282c6d2017-06-23 15:44:37 -040050 output_name = "libEGL"
51 output_dir = "$root_out_dir/swiftshader"
52 }
Alexis Hetu3e204de2016-07-20 17:05:17 -040053
Alexis Hetu91f10e32016-06-07 19:53:42 -040054 sources = [
Alexis Hetu0ab9f3b2018-11-26 17:25:23 -050055 "../../Common/SharedLibrary.cpp",
Alexis Hetud6d10f92016-11-22 13:47:04 -050056 "../common/Object.cpp",
Nico Webera4afa242019-01-04 15:28:34 -050057 "../common/debug.cpp",
Alexis Hetu91f10e32016-06-07 19:53:42 -040058 "Config.cpp",
59 "Display.cpp",
Nicolas Capens31c07a32017-06-13 23:44:13 -040060 "Surface.cpp",
Alexis Hetu91f10e32016-06-07 19:53:42 -040061 "libEGL.cpp",
Alexis Hetud7260e22016-07-15 13:58:14 -040062 "libEGL.def",
63 "libEGL.rc",
Alexis Hetud6d10f92016-11-22 13:47:04 -050064 "main.cpp",
Alexis Hetud7260e22016-07-15 13:58:14 -040065 "resource.h",
Alexis Hetu91f10e32016-06-07 19:53:42 -040066 ]
67
Alexis Hetu8be41102016-09-12 17:45:55 -040068 if (is_mac) {
69 sources += [ "OSXUtils.mm" ]
70 libs = [
71 "Quartz.framework",
72 "Cocoa.framework",
Alexis Hetuc80eada2018-02-13 15:02:40 -050073 "CoreFoundation.framework",
74 "IOSurface.framework",
Alexis Hetu91f10e32016-06-07 19:53:42 -040075 ]
Alexis Hetuec63fbe2019-07-15 14:33:11 -040076 ldflags = [
77 "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib",
78 "-Wl,-exported_symbols_list," +
79 rebase_path("libEGL.exports", root_build_dir),
80 ]
Alexis Hetu8be41102016-09-12 17:45:55 -040081 } else if (is_linux) {
Alexis Hetu20eea3c2018-06-19 14:50:41 -040082 if (use_x11) {
83 sources += [ "../../Main/libX11.cpp" ]
84 }
Tom Anderson42d64612019-06-12 11:05:21 -070085 inputs = [
86 "libEGL.lds",
87 ]
Alexis Hetua11d03e2017-01-27 11:38:59 -050088 ldflags =
Nicolas Capense75d3342017-10-06 11:24:13 -040089 [ "-Wl,--version-script=" + rebase_path("libEGL.lds", root_build_dir) ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040090 }
91
Alexis Hetu9441b072017-08-02 08:40:37 -040092 configs = [ ":swiftshader_libEGL_private_config" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040093
94 include_dirs = [
95 "../../../include",
96 "../..",
97 "..",
98 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050099}