blob: 0225f7d6e0bd7943541de8832e466a5f00ecfd19 [file] [log] [blame]
Alexis Hetu9441b072017-08-02 08:40:37 -04001# Copyright (c) 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# This file contains configs that need to be added or removed to all
6# SwiftShader libraries
7
Saman Sami7e954712019-06-06 11:46:59 -04008import("//build_overrides/build.gni")
Jamie Madillbbd8c422019-08-28 17:08:17 -04009import("//build_overrides/spirv_tools.gni")
10import("//build_overrides/swiftshader.gni")
Saman Sami7e954712019-06-06 11:46:59 -040011
Jamie Madillbbd8c422019-08-28 17:08:17 -040012if (!swiftshader_standalone) {
Saman Sami7e954712019-06-06 11:46:59 -040013 import("//build/config/sanitizers/sanitizers.gni")
14} else {
15 declare_args() {
16 is_ubsan_vptr = false
17 }
18}
19
Antonio Maiorano072466a2019-09-18 16:21:49 -040020declare_args() {
21 # By default, build SwiftShader with optimizations enabled in debug
22 # for performance reasons. Set to false to build as unoptimized.
23 swiftshader_optimized_debug_build = true
24}
25
Alexis Hetu9441b072017-08-02 08:40:37 -040026configs_to_add = []
27configs_to_delete = []
28
29if (is_win) {
30 configs_to_delete += [ "//build/config/win:unicode" ]
31}
32
Antonio Maiorano072466a2019-09-18 16:21:49 -040033if (is_debug && swiftshader_optimized_debug_build) {
Alexis Hetu5bf72ee2017-08-10 13:52:42 -040034 configs_to_delete += [ "//build/config/compiler:default_optimization" ]
35 configs_to_add += [ "//build/config/compiler:optimize" ]
36}
37
Alexis Hetu9441b072017-08-02 08:40:37 -040038configs_to_delete += [ "//build/config/compiler:chromium_code" ]
39configs_to_add += [
40 "//build/config/compiler:no_chromium_code",
Jamie Madillbbd8c422019-08-28 17:08:17 -040041 "$swiftshader_dir:swiftshader_config",
Alexis Hetu9441b072017-08-02 08:40:37 -040042]
43
44template("swiftshader_source_set") {
45 source_set(target_name) {
Alexis Hetu8aa07682017-08-02 17:00:55 -040046 configs -= configs_to_delete
47 configs += configs_to_add
Alexis Hetu9441b072017-08-02 08:40:37 -040048 forward_variables_from(invoker, "*", [ "configs" ])
49 if (defined(invoker.configs)) {
50 configs += invoker.configs
51 }
Alexis Hetu9441b072017-08-02 08:40:37 -040052 }
53}
54
55template("swiftshader_shared_library") {
56 shared_library(target_name) {
Alexis Hetu8aa07682017-08-02 17:00:55 -040057 configs -= configs_to_delete
58 configs += configs_to_add
Alexis Hetu9441b072017-08-02 08:40:37 -040059 forward_variables_from(invoker, "*", [ "configs" ])
60 if (defined(invoker.configs)) {
61 configs += invoker.configs
62 }
Alexis Hetu9441b072017-08-02 08:40:37 -040063 }
64}
Corentin Wallez57eb0632017-10-24 15:17:18 -040065
66template("swiftshader_static_library") {
67 static_library(target_name) {
68 configs -= configs_to_delete
69 configs += configs_to_add
70 forward_variables_from(invoker, "*", [ "configs" ])
71 if (defined(invoker.configs)) {
72 configs += invoker.configs
73 }
74 }
75}