blob: ae6087e94631960b4b707d8662d35b4569da2290 [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 Hetu8be41102016-09-12 17:45:55 -040034 cflags = [ "-std=c++11" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040035
36 if (is_debug) {
Alexis Hetu8be41102016-09-12 17:45:55 -040037 cflags += [ "-g" ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050038 } else { # Release
Alexis Hetu91f10e32016-06-07 19:53:42 -040039 # All Release builds use function/data sections to make the shared libraries smaller
40 cflags += [
41 "-ffunction-sections",
42 "-fdata-sections",
Alexis Hetu91f10e32016-06-07 19:53:42 -040043 "-fomit-frame-pointer",
Alexis Hetu68f564d2016-07-06 17:43:22 -040044 "-DANGLE_DISABLE_TRACE",
Alexis Hetu91f10e32016-06-07 19:53:42 -040045 ]
46
47 # Choose the right Release architecture
48 if (target_cpu == "x64") {
Alexis Hetu8be41102016-09-12 17:45:55 -040049 cflags += [ "-march=core2" ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050050 } else { # 32
Alexis Hetu8be41102016-09-12 17:45:55 -040051 cflags += [ "-march=i686" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040052 }
53 }
54
Alexis Hetud6d10f92016-11-22 13:47:04 -050055 if (target_cpu == "x64") { # 64 bit version
Alexis Hetu91f10e32016-06-07 19:53:42 -040056 cflags += [
57 "-m64",
58 "-fPIC",
59 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050060 } else { # 32 bit version
Alexis Hetu8be41102016-09-12 17:45:55 -040061 cflags += [ "-m32" ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040062 }
63 }
64}
65
Alexis Hetu68f564d2016-07-06 17:43:22 -040066group("swiftshader") {
Alexis Hetu996663b2016-09-21 13:47:42 -040067 data_deps = [
68 "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
69 "src/OpenGL/libEGL:swiftshader_libEGL",
70 ]
Alexis Hetua6e99c02016-11-16 13:53:57 -050071}
72
73group("swiftshader_tests") {
74 testonly = true
75
76 data_deps = [
77 "tests/unittests:swiftshader_unittests",
78 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050079}