huangcm
2024-12-18 9d29be7f7249789d6ffd0440067187a9f040c2cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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 optimized version of SwiftShader for performance reasons
  configs_to_delete += [ "//build/config/compiler:default_optimization" ]
  configs_to_add += [ "//build/config/compiler:optimize" ]
}
 
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) {
    configs -= configs_to_delete
    configs += configs_to_add
    forward_variables_from(invoker, "*", [ "configs" ])
    if (defined(invoker.configs)) {
      configs += invoker.configs
    }
  }
}
 
template("swiftshader_shared_library") {
  shared_library(target_name) {
    configs -= configs_to_delete
    configs += configs_to_add
    forward_variables_from(invoker, "*", [ "configs" ])
    if (defined(invoker.configs)) {
      configs += invoker.configs
    }
  }
}
 
template("swiftshader_static_library") {
  static_library(target_name) {
    configs -= configs_to_delete
    configs += configs_to_add
    forward_variables_from(invoker, "*", [ "configs" ])
    if (defined(invoker.configs)) {
      configs += invoker.configs
    }
  }
}