Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 1 | # 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 Sami | 7e95471 | 2019-06-06 11:46:59 -0400 | [diff] [blame] | 8 | import("//build_overrides/build.gni") |
| 9 | |
| 10 | if (build_with_chromium) { |
| 11 | import("//build/config/sanitizers/sanitizers.gni") |
| 12 | } else { |
| 13 | declare_args() { |
| 14 | is_ubsan_vptr = false |
| 15 | } |
| 16 | } |
| 17 | |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 18 | configs_to_add = [] |
| 19 | configs_to_delete = [] |
| 20 | |
| 21 | if (is_win) { |
| 22 | configs_to_delete += [ "//build/config/win:unicode" ] |
| 23 | } |
| 24 | |
Alexis Hetu | 5bf72ee | 2017-08-10 13:52:42 -0400 | [diff] [blame] | 25 | if (is_debug) { |
| 26 | # always build optimized version of SwiftShader for performance reasons |
| 27 | configs_to_delete += [ "//build/config/compiler:default_optimization" ] |
| 28 | configs_to_add += [ "//build/config/compiler:optimize" ] |
| 29 | } |
| 30 | |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 31 | configs_to_delete += [ "//build/config/compiler:chromium_code" ] |
| 32 | configs_to_add += [ |
| 33 | "//build/config/compiler:no_chromium_code", |
| 34 | "//third_party/swiftshader:swiftshader_config", |
| 35 | ] |
| 36 | |
| 37 | template("swiftshader_source_set") { |
| 38 | source_set(target_name) { |
Alexis Hetu | 8aa0768 | 2017-08-02 17:00:55 -0400 | [diff] [blame] | 39 | configs -= configs_to_delete |
| 40 | configs += configs_to_add |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 41 | forward_variables_from(invoker, "*", [ "configs" ]) |
| 42 | if (defined(invoker.configs)) { |
| 43 | configs += invoker.configs |
| 44 | } |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 45 | } |
| 46 | } |
| 47 | |
| 48 | template("swiftshader_shared_library") { |
| 49 | shared_library(target_name) { |
Alexis Hetu | 8aa0768 | 2017-08-02 17:00:55 -0400 | [diff] [blame] | 50 | configs -= configs_to_delete |
| 51 | configs += configs_to_add |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 52 | forward_variables_from(invoker, "*", [ "configs" ]) |
| 53 | if (defined(invoker.configs)) { |
| 54 | configs += invoker.configs |
| 55 | } |
Alexis Hetu | 9441b07 | 2017-08-02 08:40:37 -0400 | [diff] [blame] | 56 | } |
| 57 | } |
Corentin Wallez | 57eb063 | 2017-10-24 15:17:18 -0400 | [diff] [blame] | 58 | |
| 59 | template("swiftshader_static_library") { |
| 60 | static_library(target_name) { |
| 61 | configs -= configs_to_delete |
| 62 | configs += configs_to_add |
| 63 | forward_variables_from(invoker, "*", [ "configs" ]) |
| 64 | if (defined(invoker.configs)) { |
| 65 | configs += invoker.configs |
| 66 | } |
| 67 | } |
| 68 | } |