OSDN Git Service

SwiftShader always builds its release version in Chromium
[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 = [ "STRICT_CONFORMANCE" ]  # Disables OpenGL ES 3.0
19
20   if (is_win) {
21     cflags = [
22       "/GS",  # Detects some buffer overruns
23       "/Zc:wchar_t",
24       "/EHsc",
25       "/nologo",
26       "/Gd",  # Default calling convention
27     ]
28
29     defines += [
30       "_CRT_SECURE_NO_DEPRECATE",
31       "NOMINMAX",
32       "_WINDLL",
33       "NO_SANITIZE_FUNCTION=",
34       "ANGLE_DISABLE_TRACE",
35     ]
36   } else {
37     cflags = [
38       "-std=c++11",
39       "-Wall",
40       "-fno-exceptions",
41       "-fno-operator-names",
42       "-ffunction-sections",
43       "-fdata-sections",
44       "-fomit-frame-pointer",
45       "-Os",
46     ]
47
48     defines += [
49       "__STDC_CONSTANT_MACROS",
50       "__STDC_LIMIT_MACROS",
51       "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
52       "ANGLE_DISABLE_TRACE",
53       "NDEBUG",
54     ]
55
56     if (target_cpu == "x64") {  # 64 bit version
57       cflags += [
58         "-m64",
59         "-fPIC",
60         "-march=core2",
61       ]
62     } else {  # 32 bit version
63       cflags += [
64         "-m32",
65         "-msse2",
66         "-march=i686",
67       ]
68     }
69
70     if (is_linux) {
71       ldflags = [
72         "-Wl,--hash-style=both",
73         "-Wl,--gc-sections",
74       ]
75
76       # A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
77       if (use_gold && target_cpu == "x86") {
78         ldflags += [ "-Wl,--icf=none" ]
79       }
80     }
81   }
82 }
83
84 group("swiftshader") {
85   data_deps = [
86     "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
87     "src/OpenGL/libEGL:swiftshader_libEGL",
88   ]
89 }
90
91 group("swiftshader_tests") {
92   testonly = true
93
94   data_deps = [
95     "tests/unittests:swiftshader_unittests",
96   ]
97 }