| # Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # This file contains configs that need to be added or removed to all |
| # SwiftShader libraries |
| |
| configs_to_add = [] |
| configs_to_delete = [] |
| |
| if (is_win) { |
| configs_to_delete += [ "//build/config/win:unicode" ] |
| } |
| |
| if (is_debug) { |
| # always build release version of SwiftShader for performance reasons |
| configs_to_delete += [ |
| "//build/config:debug", |
| "//build/config/compiler:default_optimization", |
| ] |
| configs_to_add += [ |
| "//build/config:release", |
| "//build/config/compiler:optimize_max", |
| ] |
| if (is_win) { |
| configs_to_delete += [ "//build/config/win:default_crt" ] |
| configs_to_add += [ "//build/config/win:release_crt" ] |
| } |
| } |
| |
| configs_to_delete += [ "//build/config/compiler:chromium_code" ] |
| configs_to_add += [ |
| "//build/config/compiler:no_chromium_code", |
| "//third_party/swiftshader:swiftshader_config", |
| ] |
| |
| template("swiftshader_source_set") { |
| source_set(target_name) { |
| forward_variables_from(invoker, "*", [ "configs" ]) |
| if (defined(invoker.configs)) { |
| configs += invoker.configs |
| } |
| configs -= configs_to_delete |
| configs += configs_to_add |
| } |
| } |
| |
| template("swiftshader_shared_library") { |
| shared_library(target_name) { |
| forward_variables_from(invoker, "*", [ "configs" ]) |
| if (defined(invoker.configs)) { |
| configs += invoker.configs |
| } |
| configs -= configs_to_delete |
| configs += configs_to_add |
| } |
| } |