OSDN Git Service

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