blob: 61054d4b572248d0c11903a739cac994779134af [file] [log] [blame]
Alexis Hetu91f10e32016-06-07 19:53:42 -04001# 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
Alexis Hetu20eea3c2018-06-19 14:50:41 -040015import("//build/config/ui.gni")
Alexis Hetu9441b072017-08-02 08:40:37 -040016import("../swiftshader.gni")
17
Alexis Hetu91f10e32016-06-07 19:53:42 -040018# Need a separate config to ensure the warnings are added to the end.
19config("swiftshader_main_private_config") {
Alexis Hetu03b67af2016-08-31 17:25:40 -040020 if (is_win) {
Nicolas Capens9ed48ba2017-05-11 11:25:00 -040021 cflags = [
22 "/wd4201", # nameless struct/union
23 "/wd5030", # attribute is not recognized
24 ]
Alexis Hetu03b67af2016-08-31 17:25:40 -040025
26 if (is_clang) {
27 cflags += [
Alexis Hetu03b67af2016-08-31 17:25:40 -040028 "-Wno-string-conversion",
29 "-Wno-sign-compare",
30 ]
31 }
Stephen Lanhamfe796492018-09-07 11:59:54 -070032 } else if (target_cpu == "x86" || target_cpu == "x64") {
Alexis Hetu2ddef882017-03-14 15:11:15 -040033 cflags = [ "-msse2" ]
Alexis Hetu9441b072017-08-02 08:40:37 -040034 defines =
35 [ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040036 }
37}
38
Alexis Hetu9441b072017-08-02 08:40:37 -040039swiftshader_source_set("swiftshader_main") {
Alexis Hetud6d10f92016-11-22 13:47:04 -050040 deps = [
41 "../Common:swiftshader_common",
42 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040043
44 sources = [
45 "Config.cpp",
46 "FrameBuffer.cpp",
47 "SwiftConfig.cpp",
48 ]
49
Mustafa Çamurcu885a96b2018-03-23 16:39:02 -040050 if (use_ozone && !is_win) {
Alexis Hetu64ed0d72017-08-08 11:31:11 -040051 sources += [ "FrameBufferOzone.cpp" ]
52 } else if (is_linux) {
Alexis Hetu20eea3c2018-06-19 14:50:41 -040053 if (use_x11) {
54 sources += [
55 "FrameBufferX11.cpp",
56 "libX11.cpp",
57 ]
58 }
Alexis Hetu8be41102016-09-12 17:45:55 -040059 } else if (is_mac) {
60 sources += [ "FrameBufferOSX.mm" ]
61 } else if (is_win) {
Alexis Hetu91f10e32016-06-07 19:53:42 -040062 sources += [
63 "FrameBufferDD.cpp",
64 "FrameBufferGDI.cpp",
65 "FrameBufferWin.cpp",
66 ]
67 }
68
Alexis Hetu8be41102016-09-12 17:45:55 -040069 if (is_win) {
Alexis Hetud6d10f92016-11-22 13:47:04 -050070 libs = [ "dxguid.lib" ] # For FrameBufferDD
Alexis Hetu46c1b912016-06-23 11:06:46 -040071 }
Alexis Hetud6d10f92016-11-22 13:47:04 -050072
Alexis Hetu9441b072017-08-02 08:40:37 -040073 configs = [ ":swiftshader_main_private_config" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040074
Mustafa Çamurcu885a96b2018-03-23 16:39:02 -040075 include_dirs = [ ".." ]
Alexis Hetu8be41102016-09-12 17:45:55 -040076
77 if (is_mac) {
78 include_dirs += [ "../../include" ]
79 libs = [
80 "Quartz.framework",
Alexis Hetud6d10f92016-11-22 13:47:04 -050081 "Cocoa.framework",
Alexis Hetu8be41102016-09-12 17:45:55 -040082 ]
83 }
Alexis Hetud6d10f92016-11-22 13:47:04 -050084}