blob: bec953df0fd64749418700eb9fb20986d56f2eeb [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
Nicolas Capensd51e2162017-06-05 13:59:55 -040015import("//build/config/compiler/compiler.gni")
16
Alexis Hetu91f10e32016-06-07 19:53:42 -040017config("swiftshader_config") {
Alexis Hetu2ddef882017-03-14 15:11:15 -040018 defines = [ "STRICT_CONFORMANCE" ] # Disables OpenGL ES 3.0
19
Alexis Hetu03b67af2016-08-31 17:25:40 -040020 if (is_win) {
21 cflags = [
Alexis Hetud6d10f92016-11-22 13:47:04 -050022 "/GS", # Detects some buffer overruns
Alexis Hetu03b67af2016-08-31 17:25:40 -040023 "/Zc:wchar_t",
Alexis Hetu03b67af2016-08-31 17:25:40 -040024 "/EHsc",
25 "/nologo",
Alexis Hetud6d10f92016-11-22 13:47:04 -050026 "/Gd", # Default calling convention
Alexis Hetu2ddef882017-03-14 15:11:15 -040027 ]
28
29 defines += [
30 "_CRT_SECURE_NO_DEPRECATE",
31 "NOMINMAX",
32 "_WINDLL",
Nicolas Capens506cc5e2017-07-24 11:30:55 -040033 "NO_SANITIZE_FUNCTION=",
Alexis Hetu9441b072017-08-02 08:40:37 -040034 "ANGLE_DISABLE_TRACE",
Alexis Hetu03b67af2016-08-31 17:25:40 -040035 ]
Alexis Hetu03b67af2016-08-31 17:25:40 -040036 } else {
Alexis Hetua11d03e2017-01-27 11:38:59 -050037 cflags = [
38 "-std=c++11",
39 "-Wall",
Alexis Hetu2c0546d2017-05-24 11:16:26 -040040 "-fno-exceptions",
Alexis Hetua11d03e2017-01-27 11:38:59 -050041 "-fno-operator-names",
Alexis Hetu9441b072017-08-02 08:40:37 -040042 "-ffunction-sections",
43 "-fdata-sections",
44 "-fomit-frame-pointer",
45 "-Os",
Alexis Hetu2ddef882017-03-14 15:11:15 -040046 ]
47
48 defines += [
49 "__STDC_CONSTANT_MACROS",
50 "__STDC_LIMIT_MACROS",
Nicolas Capens506cc5e2017-07-24 11:30:55 -040051 "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
Alexis Hetu9441b072017-08-02 08:40:37 -040052 "ANGLE_DISABLE_TRACE",
53 "NDEBUG",
Alexis Hetua11d03e2017-01-27 11:38:59 -050054 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040055
Alexis Hetud6d10f92016-11-22 13:47:04 -050056 if (target_cpu == "x64") { # 64 bit version
Alexis Hetu91f10e32016-06-07 19:53:42 -040057 cflags += [
58 "-m64",
59 "-fPIC",
Alexis Hetua11d03e2017-01-27 11:38:59 -050060 "-march=core2",
Alexis Hetu91f10e32016-06-07 19:53:42 -040061 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050062 } else { # 32 bit version
Alexis Hetua11d03e2017-01-27 11:38:59 -050063 cflags += [
64 "-m32",
65 "-msse2",
66 "-march=i686",
67 ]
Alexis Hetu91f10e32016-06-07 19:53:42 -040068 }
Alexis Hetua11d03e2017-01-27 11:38:59 -050069
Alexis Hetub1031c82017-01-30 13:46:08 -050070 if (is_linux) {
71 ldflags = [
72 "-Wl,--hash-style=both",
73 "-Wl,--gc-sections",
74 ]
Alexis Hetu9441b072017-08-02 08:40:37 -040075
Nicolas Capens0f7d4272017-06-05 13:24:09 -040076 # A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
77 if (use_gold && target_cpu == "x86") {
Alexis Hetu9441b072017-08-02 08:40:37 -040078 ldflags += [ "-Wl,--icf=none" ]
Nicolas Capens0f7d4272017-06-05 13:24:09 -040079 }
Alexis Hetub1031c82017-01-30 13:46:08 -050080 }
Alexis Hetu91f10e32016-06-07 19:53:42 -040081 }
82}
83
Alexis Hetu68f564d2016-07-06 17:43:22 -040084group("swiftshader") {
Alexis Hetu996663b2016-09-21 13:47:42 -040085 data_deps = [
86 "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
87 "src/OpenGL/libEGL:swiftshader_libEGL",
88 ]
Alexis Hetua6e99c02016-11-16 13:53:57 -050089}
90
91group("swiftshader_tests") {
92 testonly = true
93
94 data_deps = [
95 "tests/unittests:swiftshader_unittests",
96 ]
Alexis Hetud6d10f92016-11-22 13:47:04 -050097}