OSDN Git Service

Rename libraries on Mac OS to prevent conflicts.
[android-x86/external-swiftshader.git] / src / OpenGL / libEGL / BUILD.gn
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
15 # Need a separate config to ensure the warnings are added to the end.
16 config("swiftshader_libEGL_private_config") {
17   defines = [ "EGL_EGLEXT_PROTOTYPES" ]
18
19   if (is_win) {
20     cflags = [
21       "/wd4201",  # nameless struct/union
22       "/wd4065",  # switch statement contains 'default' but no 'case' labels
23       "/wd5030",  # attribute is not recognized
24     ]
25
26     defines += [
27       "EGLAPI=",
28       "LIBEGL_EXPORTS",
29     ]
30   } else {
31     cflags = [ "-Wno-sign-compare" ]
32     if (!is_clang) {
33       cflags += [ "-Wno-unused-but-set-variable" ]
34     }
35
36     defines += [
37       "LOG_TAG=\"swiftshader_libEGL\"",
38       "EGLAPI=__attribute__((visibility(\"default\")))",
39     ]
40   }
41 }
42
43 shared_library("swiftshader_libEGL") {
44   if (!is_mac) {
45     output_name = "libEGL"
46     output_dir = "$root_out_dir/swiftshader"
47   }
48
49   deps = [
50     "//build/config:exe_and_shlib_deps",
51   ]
52
53   sources = [
54     "../common/Object.cpp",
55     "Config.cpp",
56     "Display.cpp",
57     "Surface.cpp",
58     "libEGL.cpp",
59     "libEGL.def",
60     "libEGL.rc",
61     "main.cpp",
62     "resource.h",
63   ]
64
65   if (is_debug) {
66     sources += [ "../common/debug.cpp" ]
67   }
68
69   if (is_mac) {
70     sources += [ "OSXUtils.mm" ]
71     libs = [
72       "Quartz.framework",
73       "Cocoa.framework",
74     ]
75     ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libEGL.dylib" ]
76   } else if (is_win) {
77     configs -= [ "//build/config/win:unicode" ]
78     ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
79   } else if (is_linux) {
80     sources += [ "../../Main/libX11.cpp" ]
81     ldflags =
82         [ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
83   }
84
85   configs -= [ "//build/config/compiler:chromium_code" ]
86   configs += [
87     "//build/config/compiler:no_chromium_code",
88     "//third_party/swiftshader:swiftshader_config",
89     ":swiftshader_libEGL_private_config",
90   ]
91
92   include_dirs = [
93     "../../../include",
94     "../..",
95     "..",
96   ]
97 }