OSDN Git Service

Update to gn files for Windows
[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_clang) {
17     cflags = [
18       "-std=c++11",
19     ]
20
21     if (is_debug) {
22         cflags += [
23         "-g",
24       ]
25     } else { # Release
26       # All Release builds use function/data sections to make the shared libraries smaller
27       cflags += [
28         "-ffunction-sections",
29         "-fdata-sections",
30         "-Wl",
31         "--gc-sections",
32         "-s",
33         "-fomit-frame-pointer",
34       ]
35
36       # Choose the right Release architecture
37       if (target_cpu == "x64") {
38         cflags += [
39           "-march=core2",
40         ]
41       } else { # 32
42         cflags += [
43           "-march=i686",
44         ]
45       }
46     }
47
48     if (target_cpu == "x64") { # 64 bit version
49       cflags += [
50         "-m64",
51         "-fPIC",
52       ]
53     } else { # 32 bit version
54       cflags += [
55         "-m32",
56       ]
57     }
58   }
59 }
60
61 component("swiftshader") {
62   configs -= [ "//build/config/compiler:chromium_code" ]
63   configs += [
64     "//build/config/compiler:no_chromium_code",
65     ":swiftshader_config",
66   ]
67
68   deps = [
69     "src/OpenGL/libEGL:swiftshader_libEGL",
70     "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
71   ]
72 }