blob: b04b321cba1c65d318621a8c77a0ebaacae28d7b [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
15config("swiftshader_config") {
Alexis Hetu2ddef882017-03-14 15:11:15 -040016 defines = [ "STRICT_CONFORMANCE" ] # Disables OpenGL ES 3.0
17
Alexis Hetu03b67af2016-08-31 17:25:40 -040018 if (is_win) {
19 cflags = [
Alexis Hetud6d10f92016-11-22 13:47:04 -050020 "/GS", # Detects some buffer overruns
Alexis Hetu03b67af2016-08-31 17:25:40 -040021 "/Zc:wchar_t",
Alexis Hetu03b67af2016-08-31 17:25:40 -040022 "/EHsc",
23 "/nologo",
Alexis Hetud6d10f92016-11-22 13:47:04 -050024 "/Gd", # Default calling convention
Alexis Hetu2ddef882017-03-14 15:11:15 -040025 ]
26
27 defines += [
28 "_CRT_SECURE_NO_DEPRECATE",
29 "NOMINMAX",
30 "_WINDLL",
Alexis Hetu03b67af2016-08-31 17:25:40 -040031 ]
32
33 if (is_debug) {
Alexis Hetud6d10f92016-11-22 13:47:04 -050034 cflags += [ "/RTC1" ] # Run-Time Error Checks
Alexis Hetu03b67af2016-08-31 17:25:40 -040035 } else {
Alexis Hetu2ddef882017-03-14 15:11:15 -040036 defines += [ "ANGLE_DISABLE_TRACE" ]
Alexis Hetu03b67af2016-08-31 17:25:40 -040037 }
38 } else {
Alexis Hetua11d03e2017-01-27 11:38:59 -050039 cflags = [
40 "-std=c++11",
41 "-Wall",
Alexis Hetu2c0546d2017-05-24 11:16:26 -040042 "-fno-exceptions",
Alexis Hetua11d03e2017-01-27 11:38:59 -050043 "-fno-operator-names",
Alexis Hetu2ddef882017-03-14 15:11:15 -040044 ]
45
46 defines += [
47 "__STDC_CONSTANT_MACROS",
48 "__STDC_LIMIT_MACROS",
Alexis Hetua11d03e2017-01-27 11:38:59 -050049 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040050
51 if (is_debug) {
Alexis Hetua11d03e2017-01-27 11:38:59 -050052 cflags += [
53 "-g",
54 "-g3",
55 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050056 } else { # Release
Alexis Hetu91f10e32016-06-07 19:53:42 -040057 # All Release builds use function/data sections to make the shared libraries smaller
58 cflags += [
59 "-ffunction-sections",
60 "-fdata-sections",
Alexis Hetu91f10e32016-06-07 19:53:42 -040061 "-fomit-frame-pointer",
Alexis Hetua11d03e2017-01-27 11:38:59 -050062 "-Os",
Alexis Hetu91f10e32016-06-07 19:53:42 -040063 ]
Alexis Hetu2ddef882017-03-14 15:11:15 -040064
65 defines += [
66 "ANGLE_DISABLE_TRACE",
67 "NDEBUG",
68 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040069 }
70
Alexis Hetud6d10f92016-11-22 13:47:04 -050071 if (target_cpu == "x64") { # 64 bit version
Alexis Hetu91f10e32016-06-07 19:53:42 -040072 cflags += [
73 "-m64",
74 "-fPIC",
Alexis Hetua11d03e2017-01-27 11:38:59 -050075 "-march=core2",
Alexis Hetu91f10e32016-06-07 19:53:42 -040076 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050077 } else { # 32 bit version
Alexis Hetua11d03e2017-01-27 11:38:59 -050078 cflags += [
79 "-m32",
80 "-msse2",
81 "-march=i686",
82 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040083 }
Alexis Hetua11d03e2017-01-27 11:38:59 -050084
Alexis Hetub1031c82017-01-30 13:46:08 -050085 if (is_linux) {
86 ldflags = [
87 "-Wl,--hash-style=both",
88 "-Wl,--gc-sections",
89 ]
Nicolas Capens0f7d4272017-06-05 13:24:09 -040090 # A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
91 if (use_gold && target_cpu == "x86") {
92 ldflags += [
93 "-Wl,--icf=none",
94 ]
95 }
Alexis Hetub1031c82017-01-30 13:46:08 -050096 }
Alexis Hetu91f10e32016-06-07 19:53:42 -040097 }
98}
99
Alexis Hetu68f564d2016-07-06 17:43:22 -0400100group("swiftshader") {
Alexis Hetu996663b2016-09-21 13:47:42 -0400101 data_deps = [
102 "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
103 "src/OpenGL/libEGL:swiftshader_libEGL",
104 ]
Alexis Hetua6e99c02016-11-16 13:53:57 -0500105}
106
107group("swiftshader_tests") {
108 testonly = true
109
110 data_deps = [
111 "tests/unittests:swiftshader_unittests",
112 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -0500113}