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