OSDN Git Service

Keeping only the data_deps change to BUILD.gn files
[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 config("swiftshader_config") {
16   if (is_win) {
17     cflags = [
18       "/GS", # Detects some buffer overruns
19       "/Zc:wchar_t",
20       "/D_CRT_SECURE_NO_DEPRECATE",
21       "/DNOMINMAX",
22       "/D_WINDLL",
23       "/EHsc",
24       "/nologo",
25       "/Gd", # Default calling convention
26     ]
27
28     if (is_debug) {
29       cflags += [ "/RTC1" ] # Run-Time Error Checks
30     } else {
31       cflags += [ "/DANGLE_DISABLE_TRACE" ]
32     }
33   } else {
34     cflags = [ "-std=c++11" ]
35
36     if (is_debug) {
37       cflags += [ "-g" ]
38     } else { # Release
39       # All Release builds use function/data sections to make the shared libraries smaller
40       cflags += [
41         "-ffunction-sections",
42         "-fdata-sections",
43         "-fomit-frame-pointer",
44         "-DANGLE_DISABLE_TRACE",
45       ]
46
47       # Choose the right Release architecture
48       if (target_cpu == "x64") {
49         cflags += [ "-march=core2" ]
50       } else { # 32
51         cflags += [ "-march=i686" ]
52       }
53     }
54
55     if (target_cpu == "x64") { # 64 bit version
56       cflags += [
57         "-m64",
58         "-fPIC",
59       ]
60     } else { # 32 bit version
61       cflags += [ "-m32" ]
62     }
63   }
64 }
65
66 group("swiftshader") {
67   data_deps = [
68     "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
69     "src/OpenGL/libEGL:swiftshader_libEGL",
70   ]
71 }