blob: 68909f235c40b431a7db3b5a205bae17de106228 [file] [log] [blame] [edit]
# 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
import("//build_overrides/build.gni")
import("//build_overrides/spirv_tools.gni")
import("//build_overrides/swiftshader.gni")
if (!swiftshader_standalone) {
import("//build/config/sanitizers/sanitizers.gni")
} else {
declare_args() {
is_ubsan_vptr = false
}
}
declare_args() {
# By default, build SwiftShader with optimizations enabled in debug
# for performance reasons. Set to false to build as unoptimized.
swiftshader_optimized_debug_build = true
# If enabled, debug builds on Windows will pop up a dialog when the
# SwiftShader DLL gets loaded, to facilitate attaching a debugger.
swiftshader_startup_dialog = false
}
configs_to_add = []
configs_to_delete = []
if (is_win) {
configs_to_delete += [ "//build/config/win:unicode" ]
}
if (is_debug && swiftshader_optimized_debug_build) {
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",
"$swiftshader_dir: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
}
}
}