blob: 57cbf337101ce1c1aff00c68587367f34a070089 [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 Hetu03b67af2016-08-31 17:25:40 -040016 if (is_win) {
17 cflags = [
Alexis Hetud6d10f92016-11-22 13:47:04 -050018 "/GS", # Detects some buffer overruns
Alexis Hetu03b67af2016-08-31 17:25:40 -040019 "/Zc:wchar_t",
20 "/D_CRT_SECURE_NO_DEPRECATE",
21 "/DNOMINMAX",
22 "/D_WINDLL",
23 "/EHsc",
24 "/nologo",
Alexis Hetud6d10f92016-11-22 13:47:04 -050025 "/Gd", # Default calling convention
Nicolas Capenseb84fe02017-02-14 10:03:08 -050026 "/DSTRICT_CONFORMANCE", # Disables OpenGL ES 3.0
Alexis Hetu03b67af2016-08-31 17:25:40 -040027 ]
28
29 if (is_debug) {
Alexis Hetud6d10f92016-11-22 13:47:04 -050030 cflags += [ "/RTC1" ] # Run-Time Error Checks
Alexis Hetu03b67af2016-08-31 17:25:40 -040031 } else {
Alexis Hetu8be41102016-09-12 17:45:55 -040032 cflags += [ "/DANGLE_DISABLE_TRACE" ]
Alexis Hetu03b67af2016-08-31 17:25:40 -040033 }
34 } else {
Alexis Hetua11d03e2017-01-27 11:38:59 -050035 cflags = [
36 "-std=c++11",
37 "-Wall",
38 "-fexceptions",
Alexis Hetua11d03e2017-01-27 11:38:59 -050039 "-fno-operator-names",
40 "-D__STDC_CONSTANT_MACROS",
41 "-D__STDC_LIMIT_MACROS",
Nicolas Capenseb84fe02017-02-14 10:03:08 -050042 "-DSTRICT_CONFORMANCE", # Disables OpenGL ES 3.0
Alexis Hetua11d03e2017-01-27 11:38:59 -050043 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040044
45 if (is_debug) {
Alexis Hetua11d03e2017-01-27 11:38:59 -050046 cflags += [
47 "-g",
48 "-g3",
49 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050050 } else { # Release
Alexis Hetu91f10e32016-06-07 19:53:42 -040051 # All Release builds use function/data sections to make the shared libraries smaller
52 cflags += [
53 "-ffunction-sections",
54 "-fdata-sections",
Alexis Hetu91f10e32016-06-07 19:53:42 -040055 "-fomit-frame-pointer",
Alexis Hetu68f564d2016-07-06 17:43:22 -040056 "-DANGLE_DISABLE_TRACE",
Alexis Hetua11d03e2017-01-27 11:38:59 -050057 "-DNDEBUG",
58 "-O2",
59 "-Os",
Alexis Hetu91f10e32016-06-07 19:53:42 -040060 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040061 }
62
Alexis Hetud6d10f92016-11-22 13:47:04 -050063 if (target_cpu == "x64") { # 64 bit version
Alexis Hetu91f10e32016-06-07 19:53:42 -040064 cflags += [
65 "-m64",
66 "-fPIC",
Alexis Hetua11d03e2017-01-27 11:38:59 -050067 "-march=core2",
Alexis Hetu91f10e32016-06-07 19:53:42 -040068 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050069 } else { # 32 bit version
Alexis Hetua11d03e2017-01-27 11:38:59 -050070 cflags += [
71 "-m32",
72 "-msse2",
73 "-march=i686",
74 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040075 }
Alexis Hetua11d03e2017-01-27 11:38:59 -050076
Alexis Hetub1031c82017-01-30 13:46:08 -050077 if (is_linux) {
78 ldflags = [
79 "-Wl,--hash-style=both",
80 "-Wl,--gc-sections",
81 ]
82 }
Alexis Hetu91f10e32016-06-07 19:53:42 -040083 }
84}
85
Alexis Hetu68f564d2016-07-06 17:43:22 -040086group("swiftshader") {
Alexis Hetu996663b2016-09-21 13:47:42 -040087 data_deps = [
88 "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
89 "src/OpenGL/libEGL:swiftshader_libEGL",
90 ]
Alexis Hetua6e99c02016-11-16 13:53:57 -050091}
92
93group("swiftshader_tests") {
94 testonly = true
95
96 data_deps = [
97 "tests/unittests:swiftshader_unittests",
98 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050099}