OSDN Git Service

Functionality to update borders of cube textures.
[android-x86/external-swiftshader.git] / 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 import("//build/config/compiler/compiler.gni")
16
17 config("swiftshader_config") {
18   defines = []
19
20   if (is_win) {
21     cflags = [
22       "/GS",  # Detects some buffer overruns
23       "/Zc:wchar_t",
24       "/EHs-c-",  # Disable C++ exceptions
25       "/nologo",
26       "/Gd",  # Default calling convention
27     ]
28
29     defines += [
30       "_HAS_EXCEPTIONS=0",  # Disable EH usage in STL headers
31       "_CRT_SECURE_NO_DEPRECATE",
32       "NOMINMAX",
33       "_WINDLL",
34       "NO_SANITIZE_FUNCTION=",
35     ]
36
37     if (!is_debug) {
38       defines += [ "ANGLE_DISABLE_TRACE" ]
39     }
40   } else {
41     cflags = [
42       "-std=c++11",
43       "-fno-exceptions",
44       "-fno-operator-names",
45     ]
46
47     defines += [
48       "__STDC_CONSTANT_MACROS",
49       "__STDC_LIMIT_MACROS",
50       "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
51     ]
52
53     if (is_debug) {
54       cflags += [
55         "-g",
56         "-g3",
57       ]
58     } else {  # Release
59       # All Release builds use function/data sections to make the shared libraries smaller
60       cflags += [
61         "-ffunction-sections",
62         "-fdata-sections",
63         "-fomit-frame-pointer",
64         "-Os",
65       ]
66
67       defines += [
68         "ANGLE_DISABLE_TRACE",
69         "NDEBUG",
70       ]
71     }
72
73     if (target_cpu == "x64") {  # 64 bit version
74       cflags += [
75         "-m64",
76         "-fPIC",
77         "-march=core2",
78       ]
79     } else {  # 32 bit version
80       cflags += [
81         "-m32",
82         "-msse2",
83         "-march=i686",
84       ]
85     }
86
87     if (is_linux) {
88       ldflags = [
89         "-Wl,--hash-style=both",
90         "-Wl,--gc-sections",
91       ]
92
93       # A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
94       if (use_gold && target_cpu == "x86") {
95         ldflags += [ "-Wl,--icf=none" ]
96       }
97     }
98   }
99 }
100
101 source_set("vertex_routine_fuzzer") {
102   sources = [
103     "tests/fuzzers/VertexRoutineFuzzer.cpp"
104   ]
105   if (is_win) {
106     cflags = [
107       "/wd4201",  # nameless struct/union
108       "/wd4065",  # switch statement contains 'default' but no 'case' labels
109       "/wd5030",  # attribute is not recognized
110     ]
111   }
112   include_dirs = [
113     "src/",
114   ]
115   deps = [
116     "src/OpenGL/libGLESv2:swiftshader_libGLESv2_static",
117   ]
118 }
119
120 group("swiftshader") {
121   data_deps = [
122     "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
123     "src/OpenGL/libEGL:swiftshader_libEGL",
124   ]
125 }
126
127 group("swiftshader_tests") {
128   testonly = true
129
130   data_deps = [
131     "tests/unittests:swiftshader_unittests",
132   ]
133 }