blob: cc80175cd4b4cbeb60825ebe3a902f8e08eb0881 [file] [log] [blame]
# Copyright 2017 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# TODO: change to //starboard eventually
import("//cobalt/build/config/base.gni")
import("//starboard/build/delegated_config.gni")
# =============================================================================
# COMPILER DEFAULTS
# =============================================================================
# TODO: only set these defines on the files that actually need them
config("compiler_defaults") {
# The canonical way to detect Starboard is #if defined(STARBOARD). This
# should be defined both when building Starboard itself, and when building
# any other source file in a Starboard-based project.
defines = [ "STARBOARD" ]
if (gl_type == "none") {
defines += [ "SB_GYP_GL_TYPE_IS_NONE=1" ]
} else {
defines += [ "SB_GYP_GL_TYPE_IS_NONE=0" ]
}
if (abort_on_allocation_failure) {
defines += [ "SB_ABORT_ON_ALLOCATION_FAILURE" ]
}
if (sb_allow_memory_tracking) {
defines += [ "STARBOARD_ALLOWS_MEMORY_TRACKING" ]
}
if (sb_enable_lib) {
defines += [ "SB_IS_LIBRARY=1" ]
}
# There doesn't appear to be any way to use the C preprocessor to do
# string concatenation with the / character. This prevents us from using
# the preprocessor to assemble an include file path, so we have to do
# the concatenation here in GN.
# http://stackoverflow.com/questions/29601786/c-preprocessor-building-a-path-string
defines += [
"STARBOARD_ATOMIC_INCLUDE=\"$starboard_path/atomic_public.h\"",
"STARBOARD_CONFIGURATION_INCLUDE=\"$starboard_path/configuration_public.h\"",
"STARBOARD_THREAD_TYPES_INCLUDE=\"$starboard_path/thread_types_public.h\"",
]
# TODO: find a way to remove this dependence on Cobalt
if (sb_media_platform == "starboard") {
defines += [ "SB_GYP_CAN_MEDIA_USE_STARBOARD_PIPELINE=1" ]
} else {
defines += [ "SB_GYP_CAN_MEDIA_USE_STARBOARD_PIPELINE=0" ]
}
}
# =============================================================================
# DELEGATED CONFIGS
# =============================================================================
# Enables pedantic levels of warnings for the current toolchain.
delegated_config("pedantic_warnings") {
path = "//$starboard_path"
generate_default = false
}
# Controls the optimization level
delegated_config("optimizations") {
path = "//$starboard_path"
prefixes = [ "no", "debuggable", "full" ]
}
# Enables/disables rtti
delegated_config("rtti") {
path = "//$starboard_path"
}
# Enables the exit-time-destructors warning.
config("wexit_time_destructors") {
configs = [ "//$starboard_path:wexit_time_destructors" ]
}