OSDN Git Service

gl_VertexID implementation
[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     ]
35
36     if (is_debug) {
37       cflags += [ "/RTC1" ]  # Run-Time Error Checks
38     } else {
39       defines += [ "ANGLE_DISABLE_TRACE" ]
40     }
41   } else {
42     cflags = [
43       "-std=c++11",
44       "-Wall",
45       "-fno-exceptions",
46       "-fno-operator-names",
47     ]
48
49     defines += [
50       "__STDC_CONSTANT_MACROS",
51       "__STDC_LIMIT_MACROS",
52       "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
53     ]
54
55     if (is_debug) {
56       cflags += [
57         "-g",
58         "-g3",
59       ]
60     } else {  # Release
61       # All Release builds use function/data sections to make the shared libraries smaller
62       cflags += [
63         "-ffunction-sections",
64         "-fdata-sections",
65         "-fomit-frame-pointer",
66         "-Os",
67       ]
68
69       defines += [
70         "ANGLE_DISABLE_TRACE",
71         "NDEBUG",
72       ]
73     }
74
75     if (target_cpu == "x64") {  # 64 bit version
76       cflags += [
77         "-m64",
78         "-fPIC",
79         "-march=core2",
80       ]
81     } else {  # 32 bit version
82       cflags += [
83         "-m32",
84         "-msse2",
85         "-march=i686",
86       ]
87     }
88
89     if (is_linux) {
90       ldflags = [
91         "-Wl,--hash-style=both",
92         "-Wl,--gc-sections",
93       ]
94       # A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
95       if (use_gold && target_cpu == "x86") {
96         ldflags += [
97           "-Wl,--icf=none",
98         ]
99       }
100     }
101   }
102 }
103
104 group("swiftshader") {
105   data_deps = [
106     "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
107     "src/OpenGL/libEGL:swiftshader_libEGL",
108   ]
109 }
110
111 group("swiftshader_tests") {
112   testonly = true
113
114   data_deps = [
115     "tests/unittests:swiftshader_unittests",
116   ]
117 }