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 | |
| 15 | config("swiftshader_config") { |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 16 | defines = [ "STRICT_CONFORMANCE" ] # Disables OpenGL ES 3.0 |
| 17 | |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 18 | if (is_win) { |
| 19 | cflags = [ |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 20 | "/GS", # Detects some buffer overruns |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 21 | "/Zc:wchar_t", |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 22 | "/EHsc", |
| 23 | "/nologo", |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 24 | "/Gd", # Default calling convention |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 25 | ] |
| 26 | |
| 27 | defines += [ |
| 28 | "_CRT_SECURE_NO_DEPRECATE", |
| 29 | "NOMINMAX", |
| 30 | "_WINDLL", |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 31 | ] |
| 32 | |
| 33 | if (is_debug) { |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 34 | cflags += [ "/RTC1" ] # Run-Time Error Checks |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 35 | } else { |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 36 | defines += [ "ANGLE_DISABLE_TRACE" ] |
Alexis Hetu | 03b67af | 2016-08-31 17:25:40 -0400 | [diff] [blame] | 37 | } |
| 38 | } else { |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 39 | cflags = [ |
| 40 | "-std=c++11", |
| 41 | "-Wall", |
Alexis Hetu | 2c0546d | 2017-05-24 11:16:26 -0400 | [diff] [blame^] | 42 | "-fno-exceptions", |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 43 | "-fno-operator-names", |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 44 | ] |
| 45 | |
| 46 | defines += [ |
| 47 | "__STDC_CONSTANT_MACROS", |
| 48 | "__STDC_LIMIT_MACROS", |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 49 | ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 50 | |
| 51 | if (is_debug) { |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 52 | cflags += [ |
| 53 | "-g", |
| 54 | "-g3", |
| 55 | ] |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 56 | } else { # Release |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 57 | # All Release builds use function/data sections to make the shared libraries smaller |
| 58 | cflags += [ |
| 59 | "-ffunction-sections", |
| 60 | "-fdata-sections", |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 61 | "-fomit-frame-pointer", |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 62 | "-Os", |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 63 | ] |
Alexis Hetu | 2ddef88 | 2017-03-14 15:11:15 -0400 | [diff] [blame] | 64 | |
| 65 | defines += [ |
| 66 | "ANGLE_DISABLE_TRACE", |
| 67 | "NDEBUG", |
| 68 | ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 69 | } |
| 70 | |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 71 | if (target_cpu == "x64") { # 64 bit version |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 72 | cflags += [ |
| 73 | "-m64", |
| 74 | "-fPIC", |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 75 | "-march=core2", |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 76 | ] |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 77 | } else { # 32 bit version |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 78 | cflags += [ |
| 79 | "-m32", |
| 80 | "-msse2", |
| 81 | "-march=i686", |
| 82 | ] |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 83 | } |
Alexis Hetu | a11d03e | 2017-01-27 11:38:59 -0500 | [diff] [blame] | 84 | |
Alexis Hetu | b1031c8 | 2017-01-30 13:46:08 -0500 | [diff] [blame] | 85 | if (is_linux) { |
| 86 | ldflags = [ |
| 87 | "-Wl,--hash-style=both", |
| 88 | "-Wl,--gc-sections", |
| 89 | ] |
| 90 | } |
Alexis Hetu | 91f10e3 | 2016-06-07 19:53:42 -0400 | [diff] [blame] | 91 | } |
| 92 | } |
| 93 | |
Alexis Hetu | 68f564d | 2016-07-06 17:43:22 -0400 | [diff] [blame] | 94 | group("swiftshader") { |
Alexis Hetu | 996663b | 2016-09-21 13:47:42 -0400 | [diff] [blame] | 95 | data_deps = [ |
| 96 | "src/OpenGL/libGLESv2:swiftshader_libGLESv2", |
| 97 | "src/OpenGL/libEGL:swiftshader_libEGL", |
| 98 | ] |
Alexis Hetu | a6e99c0 | 2016-11-16 13:53:57 -0500 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | group("swiftshader_tests") { |
| 102 | testonly = true |
| 103 | |
| 104 | data_deps = [ |
| 105 | "tests/unittests:swiftshader_unittests", |
| 106 | ] |
Alexis Hetu | d6d10f9 | 2016-11-22 13:47:04 -0500 | [diff] [blame] | 107 | } |