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
15import("//build/config/ui.gni")
16import("../swiftshader.gni")
17
18# Need a separate config to ensure the warnings are added to the end.
19config("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 (current_cpu == "x86" || current_cpu == "x64") {
33    cflags = [ "-msse2" ]
34    defines =
35        [ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
36  }
37}
38
39swiftshader_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 += [
52      "FrameBufferOzone.cpp",
53      "FrameBufferFactoryOzone.cpp",
54    ]
55  } else if (is_mac) {
56    sources += [ "FrameBufferOSX.mm" ]
57  } else if (is_win) {
58    sources += [
59      "FrameBufferDD.cpp",
60      "FrameBufferGDI.cpp",
61      "FrameBufferWin.cpp",
62    ]
63  }
64
65  if (use_x11) {
66    sources += [
67      "FrameBufferX11.cpp",
68      "libX11.cpp",
69    ]
70  }
71
72  if (is_win) {
73    libs = [ "dxguid.lib" ]  # For FrameBufferDD
74  }
75
76  configs = [ ":swiftshader_main_private_config" ]
77
78  include_dirs = [ ".." ]
79
80  if (is_mac) {
81    include_dirs += [ "../../include" ]
82    frameworks = [
83      "Quartz.framework",
84      "Cocoa.framework",
85    ]
86  }
87}
88