blob: 24727cf2f2c637af58547a08d85167f2f1cd915d [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 Hetu9441b072017-08-02 08:40:37 -040015import("../../swiftshader.gni")
16
Alexis Hetu91f10e32016-06-07 19:53:42 -040017# Need a separate config to ensure the warnings are added to the end.
18config("swiftshader_libEGL_private_config") {
Alexis Hetu2ddef882017-03-14 15:11:15 -040019 defines = [ "EGL_EGLEXT_PROTOTYPES" ]
20
Alexis Hetu03b67af2016-08-31 17:25:40 -040021 if (is_win) {
22 cflags = [
Alexis Hetud6d10f92016-11-22 13:47:04 -050023 "/wd4201", # nameless struct/union
24 "/wd4065", # switch statement contains 'default' but no 'case' labels
Nicolas Capens9ed48ba2017-05-11 11:25:00 -040025 "/wd5030", # attribute is not recognized
Alexis Hetu03b67af2016-08-31 17:25:40 -040026 ]
Alexis Hetu2ddef882017-03-14 15:11:15 -040027
Alexis Hetu9441b072017-08-02 08:40:37 -040028 defines += [ "EGLAPI=" ]
Alexis Hetu2ddef882017-03-14 15:11:15 -040029 } else {
30 cflags = [ "-Wno-sign-compare" ]
Tom Anderson6f432a62017-03-28 13:58:52 -070031 if (!is_clang) {
32 cflags += [ "-Wno-unused-but-set-variable" ]
33 }
34
Alexis Hetu9441b072017-08-02 08:40:37 -040035 defines += [ "EGLAPI=__attribute__((visibility(\"default\"))) __attribute__((no_sanitize(\"function\")))" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040036 }
37}
38
Alexis Hetu9441b072017-08-02 08:40:37 -040039swiftshader_shared_library("swiftshader_libEGL") {
Nicolas Capens9282c6d2017-06-23 15:44:37 -040040 if (!is_mac) {
41 output_name = "libEGL"
42 output_dir = "$root_out_dir/swiftshader"
43 }
Alexis Hetu3e204de2016-07-20 17:05:17 -040044
Nicolas Capens399a2982017-05-24 17:41:30 -040045 deps = [
46 "//build/config:exe_and_shlib_deps",
47 ]
48
Alexis Hetu91f10e32016-06-07 19:53:42 -040049 sources = [
Alexis Hetud6d10f92016-11-22 13:47:04 -050050 "../common/Object.cpp",
Alexis Hetu91f10e32016-06-07 19:53:42 -040051 "Config.cpp",
52 "Display.cpp",
Nicolas Capens31c07a32017-06-13 23:44:13 -040053 "Surface.cpp",
Alexis Hetu91f10e32016-06-07 19:53:42 -040054 "libEGL.cpp",
Alexis Hetud7260e22016-07-15 13:58:14 -040055 "libEGL.def",
56 "libEGL.rc",
Alexis Hetud6d10f92016-11-22 13:47:04 -050057 "main.cpp",
Alexis Hetud7260e22016-07-15 13:58:14 -040058 "resource.h",
Alexis Hetu91f10e32016-06-07 19:53:42 -040059 ]
60
Alexis Hetuc55dd842017-08-08 08:31:13 -040061 if (is_debug) {
62 sources += [ "../common/debug.cpp" ]
63 }
64
Alexis Hetu8be41102016-09-12 17:45:55 -040065 if (is_mac) {
66 sources += [ "OSXUtils.mm" ]
67 libs = [
68 "Quartz.framework",
69 "Cocoa.framework",
Alexis Hetu91f10e32016-06-07 19:53:42 -040070 ]
Nicolas Capens9282c6d2017-06-23 15:44:37 -040071 ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib" ]
Alexis Hetu8be41102016-09-12 17:45:55 -040072 } else if (is_win) {
Alexis Hetu8be41102016-09-12 17:45:55 -040073 ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
74 } else if (is_linux) {
Nicolas Capens77de5472017-06-21 13:12:42 -040075 sources += [ "../../Main/libX11.cpp" ]
Alexis Hetua11d03e2017-01-27 11:38:59 -050076 ldflags =
Nicolas Capense75d3342017-10-06 11:24:13 -040077 [ "-Wl,--version-script=" + rebase_path("libEGL.lds", root_build_dir) ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040078 }
79
Alexis Hetu9441b072017-08-02 08:40:37 -040080 configs = [ ":swiftshader_libEGL_private_config" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040081
82 include_dirs = [
83 "../../../include",
84 "../..",
85 "..",
86 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050087}