OSDN Git Service

Update BUILD.gn configs to support ARM[64] builds.
[android-x86/external-swiftshader.git] / src / Main / 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/ui.gni")
16 import("../swiftshader.gni")
17
18 # Need a separate config to ensure the warnings are added to the end.
19 config("swiftshader_main_private_config") {
20   if (is_win) {
21     cflags = [
22       "/wd4201",  # nameless struct/union
23       "/wd5030",  # attribute is not recognized
24     ]
25
26     if (is_clang) {
27       cflags += [
28         "-Wno-string-conversion",
29         "-Wno-sign-compare",
30       ]
31     }
32   } else if (target_cpu == "x86" || target_cpu == "x64") {
33     cflags = [ "-msse2" ]
34     defines =
35         [ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
36   }
37 }
38
39 swiftshader_source_set("swiftshader_main") {
40   deps = [
41     "../Common:swiftshader_common",
42   ]
43
44   sources = [
45     "Config.cpp",
46     "FrameBuffer.cpp",
47     "SwiftConfig.cpp",
48   ]
49
50   if (use_ozone && !is_win) {
51     sources += [ "FrameBufferOzone.cpp" ]
52   } else if (is_linux) {
53     if (use_x11) {
54       sources += [
55         "FrameBufferX11.cpp",
56         "libX11.cpp",
57       ]
58     }
59   } else if (is_mac) {
60     sources += [ "FrameBufferOSX.mm" ]
61   } else if (is_win) {
62     sources += [
63       "FrameBufferDD.cpp",
64       "FrameBufferGDI.cpp",
65       "FrameBufferWin.cpp",
66     ]
67   }
68
69   if (is_win) {
70     libs = [ "dxguid.lib" ]  # For FrameBufferDD
71   }
72
73   configs = [ ":swiftshader_main_private_config" ]
74
75   include_dirs = [ ".." ]
76
77   if (is_mac) {
78     include_dirs += [ "../../include" ]
79     libs = [
80       "Quartz.framework",
81       "Cocoa.framework",
82     ]
83   }
84 }