blob: 3665e71941edb9a792d7f4affe92704de1e7adfa [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
Alexis Hetu03b67af2016-08-31 17:25:40 -040026 ]
27
28 if (is_debug) {
Alexis Hetud6d10f92016-11-22 13:47:04 -050029 cflags += [ "/RTC1" ] # Run-Time Error Checks
Alexis Hetu03b67af2016-08-31 17:25:40 -040030 } else {
Alexis Hetu8be41102016-09-12 17:45:55 -040031 cflags += [ "/DANGLE_DISABLE_TRACE" ]
Alexis Hetu03b67af2016-08-31 17:25:40 -040032 }
33 } else {
Alexis Hetua11d03e2017-01-27 11:38:59 -050034 cflags = [
35 "-std=c++11",
36 "-Wall",
37 "-fexceptions",
38 "-fvisibility=protected",
39 "-fno-operator-names",
40 "-D__STDC_CONSTANT_MACROS",
41 "-D__STDC_LIMIT_MACROS",
42 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040043
44 if (is_debug) {
Alexis Hetua11d03e2017-01-27 11:38:59 -050045 cflags += [
46 "-g",
47 "-g3",
48 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050049 } else { # Release
Alexis Hetu91f10e32016-06-07 19:53:42 -040050 # All Release builds use function/data sections to make the shared libraries smaller
51 cflags += [
52 "-ffunction-sections",
53 "-fdata-sections",
Alexis Hetu91f10e32016-06-07 19:53:42 -040054 "-fomit-frame-pointer",
Alexis Hetu68f564d2016-07-06 17:43:22 -040055 "-DANGLE_DISABLE_TRACE",
Alexis Hetua11d03e2017-01-27 11:38:59 -050056 "-DNDEBUG",
57 "-O2",
58 "-Os",
Alexis Hetu91f10e32016-06-07 19:53:42 -040059 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040060 }
61
Alexis Hetud6d10f92016-11-22 13:47:04 -050062 if (target_cpu == "x64") { # 64 bit version
Alexis Hetu91f10e32016-06-07 19:53:42 -040063 cflags += [
64 "-m64",
65 "-fPIC",
Alexis Hetua11d03e2017-01-27 11:38:59 -050066 "-march=core2",
Alexis Hetu91f10e32016-06-07 19:53:42 -040067 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050068 } else { # 32 bit version
Alexis Hetua11d03e2017-01-27 11:38:59 -050069 cflags += [
70 "-m32",
71 "-msse2",
72 "-march=i686",
73 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040074 }
Alexis Hetua11d03e2017-01-27 11:38:59 -050075
76 ldflags = [
77 "-Wl,--hash-style=both",
78 "-Wl,--gc-sections",
79 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040080 }
81}
82
Alexis Hetu68f564d2016-07-06 17:43:22 -040083group("swiftshader") {
Alexis Hetu996663b2016-09-21 13:47:42 -040084 data_deps = [
85 "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
86 "src/OpenGL/libEGL:swiftshader_libEGL",
87 ]
Alexis Hetua6e99c02016-11-16 13:53:57 -050088}
89
90group("swiftshader_tests") {
91 testonly = true
92
93 data_deps = [
94 "tests/unittests:swiftshader_unittests",
95 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050096}