Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 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 | |
Alexis Hetu | 20eea3c | 2018-06-19 14:50:41 -0400 | [diff] [blame] | 15 | import("//build/config/ui.gni") |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 16 | import("../swiftshader.gni") |
| 17 | |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 18 | # Need a separate config to ensure the warnings are added to the end. |
| 19 | config("swiftshader_main_private_config") { |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 20 | if (is_win) { |
Nicolas Capens | 9ed48ba | 2017-05-11 11:25:00 -0400 | [diff] [blame] | 21 | cflags = [ |
| 22 | "/wd4201", # nameless struct/union |
| 23 | "/wd5030", # attribute is not recognized |
| 24 | ] |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 25 | |
| 26 | if (is_clang) { |
| 27 | cflags += [ |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 28 | "-Wno-string-conversion", |
| 29 | "-Wno-sign-compare", |
| 30 | ] |
| 31 | } |
Stephen Lanham | fe79649 | 2018-09-07 11:59:54 -0700 | [diff] [blame] | 32 | } else if (target_cpu == "x86" || target_cpu == "x64") { |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 33 | cflags = [ "-msse2" ] |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 34 | defines = |
| 35 | [ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 36 | } |
| 37 | } |
| 38 | |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 39 | swiftshader_source_set("swiftshader_main") { |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 40 | deps = [ |
| 41 | "../Common:swiftshader_common", |
| 42 | ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 43 | |
| 44 | sources = [ |
| 45 | "Config.cpp", |
| 46 | "FrameBuffer.cpp", |
| 47 | "SwiftConfig.cpp", |
| 48 | ] |
| 49 | |
Mustafa Çamurcu | 885a96b | 2018-03-23 16:39:02 -0400 | [diff] [blame] | 50 | if (use_ozone && !is_win) { |
Alexis Hetu | 64ed0d7 | 2017-08-08 11:31:11 -0400 | [diff] [blame] | 51 | sources += [ "FrameBufferOzone.cpp" ] |
| 52 | } else if (is_linux) { |
Alexis Hetu | 20eea3c | 2018-06-19 14:50:41 -0400 | [diff] [blame] | 53 | if (use_x11) { |
| 54 | sources += [ |
| 55 | "FrameBufferX11.cpp", |
| 56 | "libX11.cpp", |
| 57 | ] |
| 58 | } |
Alexis Hetu | 8be4110 | 2016-09-12 17:45:55 -0400 | [diff] [blame] | 59 | } else if (is_mac) { |
| 60 | sources += [ "FrameBufferOSX.mm" ] |
| 61 | } else if (is_win) { |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 62 | sources += [ |
| 63 | "FrameBufferDD.cpp", |
| 64 | "FrameBufferGDI.cpp", |
| 65 | "FrameBufferWin.cpp", |
| 66 | ] |
| 67 | } |
| 68 | |
Alexis Hetu | 8be4110 | 2016-09-12 17:45:55 -0400 | [diff] [blame] | 69 | if (is_win) { |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 70 | libs = [ "dxguid.lib" ] # For FrameBufferDD |
Alexis Hetu | 46c1b91 | 2016-06-23 11:06:46 -0400 | [diff] [blame] | 71 | } |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 72 | |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 73 | configs = [ ":swiftshader_main_private_config" ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 74 | |
Mustafa Çamurcu | 885a96b | 2018-03-23 16:39:02 -0400 | [diff] [blame] | 75 | include_dirs = [ ".." ] |
Alexis Hetu | 8be4110 | 2016-09-12 17:45:55 -0400 | [diff] [blame] | 76 | |
| 77 | if (is_mac) { |
| 78 | include_dirs += [ "../../include" ] |
| 79 | libs = [ |
| 80 | "Quartz.framework", |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 81 | "Cocoa.framework", |
Alexis Hetu | 8be4110 | 2016-09-12 17:45:55 -0400 | [diff] [blame] | 82 | ] |
| 83 | } |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 84 | } |